YouTube Related posts API
API health
- 24h health
- Normal
- Healthy / normal
- Available
Last 24 hours
Last 30 days
List the videos, Shorts and playlists YouTube recommends next to one video, from the video link. Each row has type, title, channel, view count, duration, the time YouTube shows and badges. About 20 per page; pass next_page_token back as page_token for more.
Send POST https://api.everyinfra.com/api/v1/social with platform set to youtube and action set to related_posts. Price $0.56 per 1,000 requests ($0.000556 per call). Failed calls and empty results are not charged. Synchronous. For slow jobs add "mode": "async" to the body, take the job_id and poll.
AI prompt
#Please help me write a data collection script with the EveryInfra YouTube Related posts endpoint (youtube/related_posts).
How the endpoint works:
- Request: POST https://api.everyinfra.com/api/v1/social with the header Authorization: Bearer <API key>. Read the key from the EVERYINFRA_API_KEY environment variable and never hard-code it.
- In the request body, set platform to youtube and action to related_posts, and put the parameters inside params.
- Required parameters:
- url: A YouTube video link (watch?v=, youtu.be, shorts and live links work).
- Optional parameters:
- page_token: Page token. Leave it out for the first page, then pass back the previous response's next_page_token exactly as received, with the other parameters unchanged. About 20 rows per page, as YouTube sends them.
- Returns a list of records. Main fields of each record: type, id, url, title, text, author_name, author_username, author_id, author_url, author_avatar_url, author_is_verified (Whether the channel has a verified badg…), view_count; 20 fields in total, full list at https://api.everyinfra.com/api/v1/social/catalog?platform=youtube.
- Example request body:
{
"platform": "youtube",
"action": "related_posts",
"params": {
"url": "https://www.youtube.com/watch?v=aqz-KE-bpKQ"
}
}
- Price: $0.56 per 1,000 requests; failed and empty results are not charged.
- For dozens or hundreds of targets, add "mode": "async" to the body: you get a job_id at once and poll GET https://api.everyinfra.com/api/v1/jobs/{job_id} for the result.
- On 422, fix the request using the suggested parameter names and allowed values in the error; on 429 or 503, wait for Retry-After and try again.
Before writing code, ask me which targets I need, how many, which fields, and what output format I want; then confirm the plan and the rough cost with me.Request parameters
#| Name | In | Type | Required | Default | Description |
|---|---|---|---|---|---|
Authorization | header | string | Yes | - | Bearer followed by your API key. Create it in the console; never put it in a URL or a code repository. |
platform | body | string | Yes | youtube | Platform identifier, fixed value. |
action | body | string | Yes | related_posts | Capability identifier, fixed value. |
url | body.params | string | Yes | - | A YouTube video link (watch?v=, youtu.be, shorts and live links work). |
page_token | body.params | string | No | - | Page token. Leave it out for the first page, then pass back the previous response's next_page_token exactly as received, with the other parameters unchanged. About 20 rows per page, as YouTube sends them; each page is one call and limit has no effect. Tokens last 24 hours, and the last page has no next_page_token. |
Code samples
#curl -X POST 'https://api.everyinfra.com/api/v1/social' \
-H "Authorization: Bearer $EVERYINFRA_API_KEY" \
-H 'Content-Type: application/json' \
--data-raw '{
"platform": "youtube",
"action": "related_posts",
"params": {
"url": "https://www.youtube.com/watch?v=aqz-KE-bpKQ"
}
}'OpenAPI definition (JSON)Samples read the key from the EVERYINFRA_API_KEY environment variable; copied code never contains your key.
Response example
#{ "id": "req_…", "platform": "youtube", "action": "related_posts", "results": [ { "type": "video", "id": "xOXolSQcEb4", "url": "https://www.youtube.com/watch?v=xOXolSQcEb4", "title": "SNOW BEAR - A Hand-Drawn Animated Short Film (4K) by Aaron Blaise", "author_name": "T•••e", "author_username": "A•••t", "author_id": "•••", "author_url": "https://www.youtube.com/•••", "author_avatar_url": "https://yt3.ggpht.com/•••", "view_count": 11000000, "duration": "00:11:46", "published_text": "11mo ago", "thumbnail_url": "https://i.ytimg.com/vi/xOXolSQcEb4/hqdefault.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLAf1ExPg1gBBVYH3kMo5P8-faPi6Q&usqp=CBQ", "badges": [ "Fundraiser" ], "platform": "youtube" }, { "type": "video", "id": "ShnDkbL2kwk", "url": "https://www.youtube.com/watch?v=ShnDkbL2kwk", "title": "A Small Miracle: Part 1", "author_name": "P•••r", "author_username": "p•••r", "author_id": "•••", "author_url": "https://www.youtube.com/•••", "author_avatar_url": "https://yt3.ggpht.com/•••", "view_count": 5400000, "duration": "00:15:54", "published_text": "6y ago", "thumbnail_url": "https://i.ytimg.com/vi/ShnDkbL2kwk/hqdefault.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLASFrfa5wvLyHrT624anyXI6qCDuw", "platform": "youtube" } ], "next_page_token": …, "pagination": { … }, "count": 26, "billing": { "charged": …, "charged_usd": …, "balance_after_usd": …, … }, "quota": { … }}
Response fields
#Business data is in results. The table lists the fields a record can contain. Values the platform does not show are never made up.
| Field | Meaning |
|---|---|
type | Record type; values depend on the capability (for example video / image / text). |
id | The record's unique ID on the platform. Unique only within one platform; IDs can repeat across platforms. |
url | Link to the record on the platform. |
title | Title. null when the platform has no titles (for example text-only posts). |
text | Body text with HTML removed, returned in full and never cut short (on a few platforms the list results themselves carry only an excerpt; the platform's field notes say so). |
author_name | Author's display name. |
author_username | Author's username (@handle), usually usable in URLs. |
author_id | Author's unique ID on the platform. |
author_url | Link to the author's profile on the platform. |
author_avatar_url | Keeps the platform's own meaning |
author_is_verified | Whether the channel has a verified badge. |
view_count | Views or plays. null means not disclosed, not 0. |
duration | Keeps the platform's own meaning |
published_text | Publish time as written on the YouTube page, in relative form (e.g. 2 years ago), returned as is; null when the page shows none. |
thumbnail_url | Thumbnail link, lower resolution than image_url. |
badges | Badges shown on the video, as an array of strings (e.g. 4K, CC, New); an empty array when there are none. |
is_live | Whether the video is live now. |
is_upcoming | Whether it is a premiere or scheduled live stream that has not started yet. |
playlist_id | ID of the playlist or mix when the row is one; otherwise null. |
video_count | Keeps the platform's own meaning |
platform | Source platform identifier, the same as platform in the request (for example xiaohongshu, tiktok). |
Errors and billing
#- 401
- Missing or invalid key.
- 402
- Insufficient balance. Top up first.
- 422
- Invalid parameter name or value. Fix it using the suggestions in the error. No charge.
- 429
- Per-minute request limit reached. Wait for Retry-After, then try again.
- 503
- Could not complete. The held charge is returned to your balance. If the outcome is unknown, verify it before you retry.
- 200 empty
- No data. No charge.