You need to pull YouTube video metadata, grab the latest comments, and recommend related videos without burning a week wrangling auth or scattered docs. By the end of this guide, you’ll query similar videos for a given video ID, fetch comments, and retrieve video details using the Youtube Data API on Zyla API Hub, with copy-pasteable requests and production-friendly tips.
What this API does and when to use it
The Youtube Data API on Zyla gives you three focused capabilities for media apps:
- Similar Videos: Get a list of related videos by passing a YouTube video ID. Useful for “Up next” carousels or content recommendations.
- Video Comments: Fetch the latest top-level comments with author, likes, and timestamps. Useful for moderation queues, sentiment pipelines, or community dashboards.
- Video Details: Retrieve canonical metadata like title, description, publish date, and engagement metrics. Useful for ingestion, indexing, and preview UIs.
These endpoints target common entertainment and media workflows such as building watch-next feeds, populating catalog details, and analyzing audience feedback.
Getting started on Zyla API Hub
Open the API page, subscribe, and call it with a single API key. Zyla API Hub provides one account, one API key, and a subscription + quota model across media APIs (not pay-per-call). For your first API, you’ll see a 7-day trial or 50 requests; there’s no Free Plan. Check the API page for current access options and pricing. When ready, subscribe and get your key here:
Start 7-day trial on Youtube Data API
All requests use the Authorization: Bearer YOUR_API_KEY header against Zyla’s hub URLs. You don’t need to manage different auth schemes per provider.
Endpoints you will use
Below are the three available endpoints in this listing, including their exact HTTP methods, URLs, and required parameters. Keep the URLs and parameter names exactly as shown.
1) Similar Videos
Receive a list of related videos. Pass a video ID and get videos that are most similar to it.
- Method: GET
- URL: https://zylalabs.com/api/14/youtube-data-api/56/similar-videos
- Required params:
- relatedToVideoId (string): 7ghhRHRP6t4
- part (string): id,snippet
- type (string): video
- Optional params:
- maxResults (string): 50
Official cURL example:
curl -s -X GET "https://zylalabs.com/api/14/youtube-data-api/56/similar-videos?relatedToVideoId=7ghhRHRP6t4&part=id%2Csnippet&type=video&maxResults=50" \
-H "Authorization: Bearer YOUR_API_KEY"
Official sample JSON response:
{"kind":"youtube#searchListResponse","nextPageToken":"CDIQAA","pageInfo":{"totalResults":108,"resultsPerPage":50},"items":[{"kind":"youtube#searchResult","id":{"kind":"youtube#video","videoId":"mj0XInqZMHY"},"snippet":{"publishedAt":"2019-06-27T14:44:32Z","channelId":"UC0C-w0YjGpqDXGB8IHb662A","title":"Ed Sheeran - Beautiful People (feat. Khalid) [Official Music Video]","description":"The official music video for Ed Sheeran - Beautiful People (feat. @khalid)\nSubtract, the new album, out 05.05.2023. Pre-order: https://es.lnk.to/subtract\n \nTaken from No.6 Collaborations Project released in 2019, which featured the hit singles 'I Don't Care', 'Cross Me', 'Beautiful People', 'Blow', 'Best Part of Me', 'Antisocial', 'South of the Border' &'Take Me Back To London'. \n \nSubscribe to the Ed Sheeran channel for all the best and latest official music videos, behind the scenes and live performances. \nhttp://bit.ly/SubscribeToEdSheeran \n \nSee more official videos from Ed Sheeran here: \nhttps://www.youtube.com/watch?v=ryJgDL9jzKk&list=PLjp0AEEJ0-fGKG_3skl0e1FQlJfnx-TJz \n\nListen to more from the No. 6 Collaborations Project here : \nhttps://www.youtube.com/playlist?list=PLjp0AEEJ0-fHZDWhxhKo0wG08bMUcRy3l\n \nFollow Ed Sheeran on: \nInstagram: http://instagram.com/teddysphotos\nTikTok: https://www.tiktok.com/@edsheeran\nFacebook: http://www.facebook.com/EdSheeranMusic\nTwitter: http://twitter.com/edsheeran\nDiscord: http://discord.gg/edsheeran\nOfficial Website: http://edsheeran.com \n\nAbout Ed Sheeran: \nEd Sheeran may be the quintessential pop star of the 2010s: an internationally acclaimed, multi-award winning singer/songwriter who seems to acknowledge no boundaries between styles or eras with elements of folk, hip-hop, pop, dance, soul, and rock woven throughout his music. \n\nHis incredible catalogue includes the studio albums ‘+’ (plus), ‘x’ (multiply) and ‘÷’ (divide) which spawned hit singles such as ‘The A team’ , ’Lego House’, ‘Sing', ‘Thinking Out Loud’, ‘Photograph’, ‘Shape Of You’, ‘Castle on The Hill’ and ‘Perfect’. \n \nIn 2019, Ed Sheeran released the genre-spanning ‘No.6 Collaborations Project’ which featured a wide-range of artists including ‘Justin Bieber’, ‘Camilla’ Cabello’, ‘Travis Scott’, ‘Eminem’, ‘Cardi B, ‘Paulo Londra’, ‘Bruno Mars’ and ‘Stormzy’ amongst many others, producing hits such as ‘I Don’t Care’, ‘Beautiful People’, ‘South of The Border’ and ‘Take Me Back To London’. \n \n#EdSheeran #Khalid #BeautifulPeople","thumbnails":{"…
What you’ll use in practice:
- items[].id.videoId: the related video’s ID (string).
- items[].snippet.title: display title for your UI.
- items[].snippet.publishedAt: ISO 8601 timestamp (Z = UTC).
- nextPageToken: pass this token back on subsequent calls (as the page token when supported) to paginate through more results.
2) Video Comments
Get a list of the latest comments about a specific video. You’ll receive the comment text, author information, likes, and creation/update timestamps.
- Method: GET
- URL: https://zylalabs.com/api/14/youtube-data-api/61/video-comments
- Required params:
- part (string): snippet
- videoId (string): 7ghhRHRP6t4
- maxResults (string): 100
Typical fields to read from the response:
- items[].snippet.topLevelComment.snippet.textDisplay or textOriginal: the comment body.
- items[].snippet.topLevelComment.snippet.authorDisplayName: commenter’s display name.
- items[].snippet.topLevelComment.snippet.likeCount: integer like count.
- items[].snippet.topLevelComment.snippet.publishedAt and updatedAt: ISO 8601 UTC times.
- nextPageToken: if provided, continue pagination.
3) Video Details
Get details of any video: title, description, publish date, and engagement counts.
- Method: GET
- URL: https://zylalabs.com/api/14/youtube-data-api/62/video-details
- Required params:
- id (string): 7ghhRHRP6t4
Typical fields to read from the response:
- items[].snippet.title and items[].snippet.description for display and indexing.
- items[].snippet.publishedAt for chronology and filtering.
- Other stats fields may be present depending on the upstream provider; refer to the payload you receive.
Python example: fetch and render related videos
This Python snippet calls the Similar Videos endpoint, extracts the videoId and title for rendering a watch-next list, and shows how to handle pagination via nextPageToken.
import requests
API_KEY = "YOUR_API_KEY"
url = "https://zylalabs.com/api/14/youtube-data-api/56/similar-videos"
params = {
"relatedToVideoId": "7ghhRHRP6t4",
"part": "id,snippet",
"type": "video",
"maxResults": "50",
}
headers = {"Authorization": f"Bearer {API_KEY}"}
resp = requests.get(url, params=params, headers=headers, timeout=20)
resp.raise_for_status()
data = resp.json()
# Extract items for UI
items = data.get("items", [])
related = []
for item in items:
vid = ((item or {}).get("id") or {}).get("videoId")
title = ((item or {}).get("snippet") or {}).get("title")
if vid and title:
related.append({"videoId": vid, "title": title})
print(f"Got {len(related)} related videos:")
for r in related[:5]:
print(f"- {r['videoId']}: {r['title']}")
# Handle pagination if nextPageToken is present (pass it as a page token when supported)
next_token = data.get("nextPageToken")
if next_token:
print("More pages available via nextPageToken:", next_token)
Real-world media use cases you can ship this week
- Watch-next and recommendations: Use Similar Videos to seed a “Because you watched X” rail in your app or embedded player UI.
- Video detail pages: Populate hero metadata with Video Details; cache the JSON response to minimize repeated fetches.
- Community and moderation: Feed Video Comments into a queue for moderation or a simple “Recent comments” widget; store authorDisplayName, textOriginal, likeCount, and timestamps.
- Editorial curation: Build internal tools where editors paste a video ID and instantly get related content for collection building.
- Notifications and alerts: Monitor comments on high-priority videos (poll at a reasonable interval) and alert creators or support teams.
Implementation notes that save time
- Timestamps: publishedAt and updatedAt fields are ISO 8601 strings with a trailing Z for UTC. Convert once and normalize across your services.
- Pagination: If nextPageToken is present in the response, capture it and issue follow-up requests to retrieve additional results. Don’t assume all results fit in one page.
- maxResults: Keep it at 50 when you need fewer round-trips; reduce it for lightweight UIs where initial render needs to be fast.
- Caching: Cache Video Details for stable videos to reduce latency and quota use. For comments, apply shorter cache windows since new comments arrive frequently.
- Error handling: Treat non-2xx responses as transient or permission-related issues. Log the request URL and status; avoid retry storms.
- Security: Use the Authorization: Bearer YOUR_API_KEY header server-side. Avoid exposing your API key in client-side code.
How to call it from an AI agent (MCP)
If you’re orchestrating tasks with an MCP-compatible client (e.g., Claude Code, Cursor, Windsurf), you can route calls through Zyla’s MCP endpoint and reuse the same key. Consult the MCP docs and configure your client to point to:
Pass your API key as indicated by your MCP client’s configuration (apikey=YOUR_API_KEY in the endpoint URL). From there, your agent can invoke the Youtube Data API tools exposed by the hub without hand-coding HTTP calls. This is helpful for scripted content curation or ad-hoc data pulls while you prototype.
Reference: exact requests and fields
Similar Videos
GET https://zylalabs.com/api/14/youtube-data-api/56/similar-videos
- relatedToVideoId (required)
- part (required)
- type (required)
- maxResults (optional)
Primary fields to read:
- items[].id.videoId
- items[].snippet.title
- items[].snippet.publishedAt
- nextPageToken
Video Comments
GET https://zylalabs.com/api/14/youtube-data-api/61/video-comments
- part (required)
- videoId (required)
- maxResults (required)
Primary fields to read:
- items[].snippet.topLevelComment.snippet.textDisplay
- items[].snippet.topLevelComment.snippet.authorDisplayName
- items[].snippet.topLevelComment.snippet.likeCount
- items[].snippet.topLevelComment.snippet.publishedAt
- nextPageToken (if present)
Video Details
GET https://zylalabs.com/api/14/youtube-data-api/62/video-details
- id (required)
Primary fields to read:
- items[].snippet.title
- items[].snippet.description
- items[].snippet.publishedAt
Operational guidance for media apps
- Throughput planning: Zyla uses a subscription + quota model, not pay-per-call. Your first API includes a 7-day trial or 50 requests. For higher volumes, monitor your usage and check the API page for current options.
- Data freshness: Comments change quickly; video details less so. Adjust your cache TTLs accordingly.
- Indexing strategy: Store stable identifiers (videoId) as your foreign key and denormalize title/description to support search and quick renders.
- Resilience: Apply backoff on 429/5xx responses. Log which endpoint and params were used to accelerate debugging.
- Internationalization: Titles and descriptions may contain Unicode and HTML entities. Normalize and escape for your UI framework.
FAQ
Q: What authentication do I use?
A: Use the Authorization: Bearer YOUR_API_KEY header on every request to the Zyla hub URLs.
Q: Is there a free plan?
A: No Free Plan. For your first API, you’ll see a 7-day trial or 50 requests. Check the API page for current access options and pricing.
Q: How do I paginate results?
A: Read nextPageToken from the response. When present, call the endpoint again and include that token as the page token where supported to fetch the next page.
Q: Which timestamps and timezone should I expect?
A: Timestamps such as publishedAt and updatedAt are ISO 8601 strings with a Z suffix indicating UTC.
Q: Can I call this from my AI coding agent?
A: Yes, via Zyla’s MCP endpoint. Configure your MCP-compatible client to use the MCP URL and your API key so the agent can call the Youtube Data API tools without manual HTTP code.
Ready to ship your media integration? Subscribe and get your API key from the marketplace listing: Start 7-day trial on Youtube Data API. Explore thousands more media APIs and ship faster on Zyla API Hub.
Official API response
{"kind":"youtube#searchListResponse","nextPageToken":"CDIQAA","pageInfo":{"totalResults":108,"resultsPerPage":50},"items":[{"kind":"youtube#searchResult","id":{"kind":"youtube#video","videoId":"mj0XInqZMHY"},"snippet":{"publishedAt":"2019-06-27T14:44:32Z","channelId":"UC0C-w0YjGpqDXGB8IHb662A","title":"Ed Sheeran - Beautiful People (feat. Khalid) [Official Music Video]","description":"The official music video for Ed Sheeran - Beautiful People (feat. @khalid)\nSubtract, the new album, out 05.05.2023. Pre-order: https://es.lnk.to/subtract\n \nTaken from No.6 Collaborations Project released in 2019, which featured the hit singles 'I Don't Care', 'Cross Me', 'Beautiful People', 'Blow', 'Best Part of Me', 'Antisocial', 'South of the Border' &'Take Me Back To London'. \n \nSubscribe to the Ed Sheeran channel for all the best and latest official music videos, behind the scenes and live performances. \nhttp://bit.ly/SubscribeToEdSheeran \n \nSee more official videos from Ed Sheeran here: \nhttps://www.youtube.com/watch?v=ryJgDL9jzKk&list=PLjp0AEEJ0-fGKG_3skl0e1FQlJfnx-TJz \n\nListen to more from the No. 6 Collaborations Project here : \nhttps://www.youtube.com/playlist?list=PLjp0AEEJ0-fHZDWhxhKo0wG08bMUcRy3l\n \nFollow Ed Sheeran on: \nInstagram: http://instagram.com/teddysphotos\nTikTok: https://www.tiktok.com/@edsheeran\nFacebook: http://www.facebook.com/EdSheeranMusic\nTwitter: http://twitter.com/edsheeran\nDiscord: http://discord.gg/edsheeran\nOfficial Website: http://edsheeran.com \n\nAbout Ed Sheeran: \nEd Sheeran may be the quintessential pop star of the 2010s: an internationally acclaimed, multi-award winning singer/songwriter who seems to acknowledge no boundaries between styles or eras with elements of folk, hip-hop, pop, dance, soul, and rock woven throughout his music. \n\nHis incredible catalogue includes the studio albums ‘+’ (plus), ‘x’ (multiply) and ‘÷’ (divide) which spawned hit singles such as ‘The A team’ , ’Lego House’, ‘Sing', ‘Thinking Out Loud’, ‘Photograph’, ‘Shape Of You’, ‘Castle on The Hill’ and ‘Perfect’. \n \nIn 2019, Ed Sheeran released the genre-spanning ‘No.6 Collaborations Project’ which featured a wide-range of artists including ‘Justin Bieber’, ‘Camilla’ Cabello’, ‘Travis Scott’, ‘Eminem’, ‘Cardi B, ‘Paulo Londra’, ‘Bruno Mars’ and ‘Stormzy’ amongst many others, producing hits such as ‘I Don’t Care’, ‘Beautiful People’, ‘South of The Border’ and ‘Take Me Back To London’. \n \n#EdSheeran #Khalid #BeautifulPeople","thumbnails":{"…
Official API response
{"kind":"youtube#searchListResponse","nextPageToken":"CDIQAA","pageInfo":{"totalResults":108,"resultsPerPage":50},"items":[{"kind":"youtube#searchResult","id":{"kind":"youtube#video","videoId":"mj0XInqZMHY"},"snippet":{"publishedAt":"2019-06-27T14:44:32Z","channelId":"UC0C-w0YjGpqDXGB8IHb662A","title":"Ed Sheeran - Beautiful People (feat. Khalid) [Official Music Video]","description":"The official music video for Ed Sheeran - Beautiful People (feat. @khalid)\nSubtract, the new album, out 05.05.2023. Pre-order: https://es.lnk.to/subtract\n \nTaken from No.6 Collaborations Project released in 2019, which featured the hit singles 'I Don't Care', 'Cross Me', 'Beautiful People', 'Blow', 'Best Part of Me', 'Antisocial', 'South of the Border' &'Take Me Back To London'. \n \nSubscribe to the Ed Sheeran channel for all the best and latest official music videos, behind the scenes and live performances. \nhttp://bit.ly/SubscribeToEdSheeran \n \nSee more official videos from Ed Sheeran here: \nhttps://www.youtube.com/watch?v=ryJgDL9jzKk&list=PLjp0AEEJ0-fGKG_3skl0e1FQlJfnx-TJz \n\nListen to more from the No. 6 Collaborations Project here : \nhttps://www.youtube.com/playlist?list=PLjp0AEEJ0-fHZDWhxhKo0wG08bMUcRy3l\n \nFollow Ed Sheeran on: \nInstagram: http://instagram.com/teddysphotos\nTikTok: https://www.tiktok.com/@edsheeran\nFacebook: http://www.facebook.com/EdSheeranMusic\nTwitter: http://twitter.com/edsheeran\nDiscord: http://discord.gg/edsheeran\nOfficial Website: http://edsheeran.com \n\nAbout Ed Sheeran: \nEd Sheeran may be the quintessential pop star of the 2010s: an internationally acclaimed, multi-award winning singer/songwriter who seems to acknowledge no boundaries between styles or eras with elements of folk, hip-hop, pop, dance, soul, and rock woven throughout his music. \n\nHis incredible catalogue includes the studio albums ‘+’ (plus), ‘x’ (multiply) and ‘÷’ (divide) which spawned hit singles such as ‘The A team’ , ’Lego House’, ‘Sing', ‘Thinking Out Loud’, ‘Photograph’, ‘Shape Of You’, ‘Castle on The Hill’ and ‘Perfect’. \n \nIn 2019, Ed Sheeran released the genre-spanning ‘No.6 Collaborations Project’ which featured a wide-range of artists including ‘Justin Bieber’, ‘Camilla’ Cabello’, ‘Travis Scott’, ‘Eminem’, ‘Cardi B, ‘Paulo Londra’, ‘Bruno Mars’ and ‘Stormzy’ amongst many others, producing hits such as ‘I Don’t Care’, ‘Beautiful People’, ‘South of The Border’ and ‘Take Me Back To London’. \n \n#EdSheeran #Khalid #BeautifulPeople","thumbnails":{"…