You need to ship a media feature this week: given a YouTube video ID, fetch similar videos for recommendations, load the latest comments for moderation or community widgets, and pull rich video details for your UI. By the end of this guide you will use the Youtube Data API on Zyla API Hub to do exactly that with copy-pasteable requests you can drop into your backend or script today.
What this API gives you
The Youtube Data API on Zyla API Hub provides three focused endpoints for media applications:
- Similar Videos: fetch a list of videos related to a given video ID for recommendations.
- Video Comments: retrieve the latest comment threads (author, text, likes, timestamps) for a specific video.
- Video Details: get core metadata for a video, including title, description, publish date and more.
These endpoints are ready-to-use via Zyla’s unified gateway and work well for recommendation rails, comment moderation queues, editorial curation, and analytics dashboards.
Getting started on Zyla API Hub
Open the Youtube Data API page on Zyla and click Subscribe or Start Free Trial when available. You will receive a single API key you can use across all calls. Authentication is via the HTTP header Authorization: Bearer YOUR_API_KEY. Zyla runs on a subscription + quota model; check the API page for current access options and pricing.
You can browse more than 10,000 public APIs on zylalabs.com, add multiple media and entertainment APIs to one account, and call them with one API key. The Youtube Data API offers a 7-day trial from the marketplace listing.
Endpoints you will use
1) Similar Videos
Receive a list of videos most similar to a given one.
- Method: GET
- URL: https://zylalabs.com/api/14/youtube-data-api/56/similar-videos
- Required query parameters:
- relatedToVideoId (string): 7ghhRHRP6t4
- part (string): id,snippet
- type (string): video
- Optional query parameters:
- 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 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 will use from this payload:
- items[].id.videoId: the target video’s ID for linking or playback.
- items[].snippet.title: the clickable headline for your UI.
- items[].snippet.publishedAt: ISO 8601 timestamp you can display or sort by.
- nextPageToken: use it to paginate if you need more than resultsPerPage.
- pageInfo.totalResults and pageInfo.resultsPerPage: to size pagination and UI.
2) Video Comments
Get the latest comment threads for a given video. Useful for moderation tools, social proof sections, and engagement analytics.
- Method: GET
- URL: https://zylalabs.com/api/14/youtube-data-api/61/video-comments
- Required query parameters:
- part (string): snippet
- videoId (string): 7ghhRHRP6t4
- maxResults (string): 100
Official curl example:
Sample 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":{"…
Fields you will typically read:
- items[].snippet.topLevelComment.snippet.textOriginal and textDisplay: the comment string.
- items[].snippet.topLevelComment.snippet.authorDisplayName and authorProfileImageUrl: author info.
- items[].snippet.topLevelComment.snippet.likeCount: engagement metric.
- items[].snippet.topLevelComment.snippet.publishedAt: ISO timestamp for ordering.
- nextPageToken and pageInfo for pagination.
3) Video Details
Retrieve metadata for a specific video. Ideal for detail pages, embeds, and editorial panels.
- Method: GET
- URL: https://zylalabs.com/api/14/youtube-data-api/62/video-details
- Required query parameters:
- id (string): 7ghhRHRP6t4
Official curl example:
Sample response:
{"kind":"youtube#videoListResponse","items":[{"kind":"youtube#video","id":"7ghhRHRP6t4","snippet":{"publishedAt":"2020-07-24T04:00:10Z","channelId":"UCN1hnUccO4FD5WfM7ithXaw","title":"Maroon 5 - Nobody's Love (Official Music Video)","description":"“Nobody’s Love” is out now: https://smarturl.it/NobodysLove \n\nFor more, visit: \nInstagram: https://www.instagram.com/maroon5 \nFacebook: https://www.facebook.com/maroon5 \nTwitter: https://twitter.com/maroon5 \nSign up for updates: http://smarturl.it/Maroon5.News \n\n// \n\nLYRICS \n\nYou could make a grown man cry\nIf you ever said goodbye\nNever let you go oh-woah oh-I\nNever let you go oh-woah oh-I\nYou could make a grown man cry\nIf you ever left my side\nNever let you go oh-woah oh-I\nNever let you go oh-woah oh-I\n\nYou’re the only hand in my back pocket\nIf you ever left I’d go psychotic\nHeaven hear me cryin cryin oh oh\nBaby you’re the key to my heart locket\nIf you ever left never unlock it\nLonely like an island, island oh oh\n\nIf my love ain’t your love it’s never gonna be nobody’s love \nNever gonna need nobody’s love, but yours, but yours\nIf my love ain’t your love it’s never gonna be nobody’s love\nNever gonna need nob…
From this response, you will usually render:
- items[0].snippet.title and description: the main metadata for the page.
- items[0].snippet.publishedAt: display in local time after converting from UTC ISO 8601.
- items[0].id: the canonical video ID to pass to other endpoints.
End-to-end example: build a “Related Videos” rail
The following Python snippet calls the Similar Videos endpoint, lists each related video’s ID, title, and publish timestamp, and shows how to handle pagination via nextPageToken if present. Replace YOUR_API_KEY with your value from Zyla.
import os
import requests
API_KEY = os.getenv("ZYLALABS_API_KEY", "YOUR_API_KEY")
BASE_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}",
}
def fetch_similar_videos():
r = requests.get(BASE_URL, params=params, headers=headers, timeout=20)
r.raise_for_status()
data = r.json()
for item in data.get("items", []):
vid = item.get("id", {}).get("videoId")
snip = item.get("snippet", {})
title = snip.get("title")
published = snip.get("publishedAt")
print(f"{vid}\t{published}\t{title}")
# If you need additional pages, check nextPageToken in data
if "nextPageToken" in data:
print("Next page token:", data["nextPageToken"])
if __name__ == "__main__":
fetch_similar_videos()
Notes that save time:
- Timestamps like publishedAt and comment publishedAt are ISO 8601 in UTC. Convert client-side for local displays.
- Use nextPageToken to paginate. Cache responses per video ID to avoid repeated hits when users scroll or revisit.
- The Authorization header must be present on every request to Zyla endpoints.
Practical media use cases you can ship
- Watch page recommendations: call Similar Videos with the current video’s ID and render a horizontal carousel from items[].
- Comment moderation: fetch Video Comments; display textOriginal, authorDisplayName, likeCount, and publishedAt in your review UI.
- Editorial curation: hydrate cards with Video Details (title, publishedAt) and use Similar Videos to fill “More like this.”
- Newsletter or blog embeds: prefetch details and a few similar picks to reduce layout shifts and calls at send time.
- Analytics enrichment: store nextPageToken and pageInfo to understand coverage vs. totalResults for sampling strategies.
Call the API from AI agents via MCP
You can invoke these same Zyla endpoints from MCP-compatible developer tools (Claude Code, Cursor, Windsurf, and others). Point your agent or client to the MCP gateway and pass your Zyla API key.
- MCP endpoint: https://mcp.zylalabs.com/mcp
- Authentication: include your API key; consult your MCP client on how to set headers or query params.
- Typical flow: define a tool that issues a GET to the Similar Videos, Video Comments, or Video Details URLs shown above, with the same query params and Authorization header.
Read more about the Model Context Protocol here: MCP.
Operational guidance
- Authentication: always send Authorization: Bearer YOUR_API_KEY. One account and one key work across your subscribed APIs on Zyla.
- HTTP method: all endpoints covered here are GET. Do not send a body; use the query parameters exactly as specified.
- Pagination: check nextPageToken when present; pageInfo.resultsPerPage indicates how many items you received.
- Caching: cache per videoId for details and comments, and per relatedToVideoId for similar results. Invalidate as your product requires.
- Error handling: treat non-2xx as retriable or user-facing errors per your SLA. Preserve request params in logs for quick repro.
- Data types: dates are ISO 8601 strings; IDs are strings; counts like likeCount are numeric in the response.
Where to get your key and next steps
Create your account on Zyla API Hub, open the Youtube Data API listing, and start the trial to get your key. Calls are billed on a subscription + quota model; check the listing for your current limits. Use the curl and Python snippets above as your first requests.
Start 7-day trial on Youtube Data API
FAQ
How do I authenticate?
Include the header Authorization: Bearer YOUR_API_KEY on every request to the Zyla endpoints shown above.
Can I paginate results from Similar Videos and Video Comments?
Yes. When nextPageToken is present in the response, pass it according to the endpoint’s pagination scheme. Use pageInfo.totalResults and resultsPerPage to shape your UI.
What timestamps should I expect?
Fields like publishedAt and updatedAt are ISO 8601 UTC strings. Convert to your users’ local time zones on the client.
Is there a free plan?
Check the API page for current access options and pricing. The listing offers a 7-day trial you can start from the marketplace item page.
Do these endpoints accept request bodies?
No. The documented endpoints here are GET-only and use query parameters exactly as shown in the examples.
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":{"…