How to Use an API Key for YouTube Video Data
Get YouTube video details, channel context and a first page of uploads into your agent, then turn the responses into a repeatable metadata table.

Get video details and channel context into your agent. Paste this into your agent:
Set up https://monid.ai/SKILL.md, then use Monid to inspect TikHub's YouTube tools. Get metadata for video aqz-KE-bpKQ, fetch its channel information and one page of uploads, and make a table of duration, views, likes, thumbnail count and caption availability. Keep missing values as null. Stop after three paid calls.
Estimated 1 min setup · 1-2 hrs saved on a first integration.
Developers searching for an api key for youtube often start with one video URL, then discover that their agent needs three different things: the video's details, its channel context and a list of uploads. Copying those from browser tabs leaves you with display strings instead of a consistent table.
A saved title does not tell your script whether captions exist. A channel's displayed video count does not give you the individual video IDs. Treating every piece of YouTube data as the same lookup creates gaps in the final dataset.
We'll use Monid, the OpenRouter for agent tools, to collect those three responses through one key and one balance. This guide builds a metadata table from real calls, explains the fields to keep, and gives you a rule for choosing a different workflow when the job extends beyond metadata.
Here is the finished video row from the November 14, 2026 test:
| Video ID | Duration in seconds | Views | Likes | Comment count text | Thumbnails | Captions |
|---|---|---|---|---|---|---|
| aqz-KE-bpKQ | 635 | 23,540,945 | 110,409 | 5.2K | 1 | null |
How to use an API key for YouTube with Monid
Use a Monid key to discover the appropriate YouTube tool, inspect its inputs, and request one small response. An endpoint is a specific callable tool; video details, channel information and upload listings have separate inputs and outputs.
The data in this walkthrough comes from TikHub, accessed through the YouTube tools on Monid. You are using a Monid credential for these calls. This walkthrough does not issue a credential for another service.
Step 1. Install and add your key
For agents: Get a key at app.monid.ai, then give your agent the setup instruction and key through its credential configuration.
set up https://monid.ai/SKILL.md
For humans: Install the CLI and save your key under a local label; keep the credential out of source files and shared prompts.
npm install -g @monid-ai/cli
monid keys add -k <your-api-key> -l main
Step 2. Find the video details tool
Discover the task first, then inspect the exact tool so the parameter names and price come from the current catalog.
monid discover -q "tikhub youtube get_video_info" -l 3 --include-unavailable
monid inspect -p tikhub -e /api/v1/youtube/web_v2/get_video_info
The video information tool takes video_id in query parameters. Set language_code to en-US for this English workflow; the inspected default is zh-CN.

Step 3. Request one video
Start with one public video ID, because the inspected schema accepts one 11-character ID rather than an array.
monid run -p tikhub -e /api/v1/youtube/web_v2/get_video_info \
--query '{"video_id":"aqz-KE-bpKQ","language_code":"en-US"}' -w -j
The test returned one completed result in 2.338 seconds between its recorded start and completion timestamps. Its output included length_seconds, view_count, like_count, comment_count, thumbnails, captions and playability_status.
Step 4. Add channel context and uploads
Use the returned channel_id for the next two calls; keeping the same identifier joins the responses without matching on a channel name.
monid run -p tikhub -e /api/v1/youtube/web/get_channel_info \
--query '{"channel_id":"UCSMOQeBJ2RAnuFungnQOxLg"}' -w -j
monid run -p tikhub -e /api/v1/youtube/web_v2/get_channel_videos \
--query '{"channel_id":"UCSMOQeBJ2RAnuFungnQOxLg","language_code":"en-US","country_code":"US"}' -w -j
The channel information call returned channel totals in 4.491 seconds. The channel videos call returned 30 uploads and a continuation token in 2.769 seconds; stop at that first page while testing.


The 3 ways to collect YouTube metadata
Choose the route by the output you need and the integration you already maintain. A one-time visual check, a recurring script and an agent that chooses tools have different maintenance needs.
Read the public page manually
Use the page when you need to inspect one video visually and do not need a reusable dataset. Write down which values are rounded, and retain the URL alongside your notes. This route stops being convenient once the same fields must be copied repeatedly.
Keep your existing provider integration
Keep a dedicated TikHub integration if it already supplies the calls your application uses. A working authentication and storage path is valuable infrastructure. Adding another access layer only earns its place when it solves an actual integration need.
Give the agent catalog access
Use Monid when discovery and tool selection belong inside the agent's workflow. Inspect before calling, and keep the agent's budget explicit. One key handles the access layer, while your code still decides which outputs belong in the final table.
| Route | Billing shape | Best fit | Limitation |
|---|---|---|---|
| Monid through TikHub | Per call for these three tools | Agent or script collecting metadata | Your application manages storage and pagination |
| Existing TikHub integration | Governed by your existing arrangement | Application already using that provider | You maintain that integration |
| Manual page inspection | No API call in this workflow | One visual check | No automatic repeatable export |
The important decision is whether you need structured results repeatedly. Do not build a recurring data pipeline for a task that ends after reading one page.
How do you read the YouTube data correctly?
Keep exact counts, formatted text and absent values distinct. The three successful responses exposed different representations of similar concepts, so a single numeric conversion rule is insufficient.
Preserve exact counts as numbers
The video response returned view_count as the string 23540945 and like_count as 110409. Convert digit-only strings into numeric columns for sorting, while retaining the original response for auditing. The same response's comment_count was 5.2K, which belongs in a text column rather than an exact integer column.
The result means you can rank this video using exact returned views and likes. It does not justify an exact comment-to-view ratio from the rounded comment count.
Keep channel totals separate from page size
The channel information response returned subscriber_count as 1.26M subscribers, video_count as 1.5K videos, and view_count as 135,320,579 views. These are channel-level observations. The upload listing returned 30 video objects, which is a page size, not the channel's total inventory.
| Measurement | Returned value | How to use it |
|---|---|---|
| Channel subscriber display | 1.26M subscribers | Preserve as display text |
| Channel video display | 1.5K videos | Describe channel scale |
| Channel view display | 135,320,579 views | Keep separate from video views |
| Upload objects on first page | 30 | Count rows collected |
| Continuation token | Present | More pages available to request |
| Channel country | null | Leave country empty |
For a complete upload inventory, continue with the channel-to-CSV workflow. A first page is a useful test artifact, but it is not a complete channel export.
Treat null as a useful result
The tested video returned captions: null and chapters: null, while playability_status was OK. Successful metadata retrieval therefore did not supply captions or chapters. Preserve that distinction instead of converting a successful request into a promise that every field is filled.
For spoken content, use the separate YouTube transcript guide. A description is metadata about a video, not a transcript of its speech.
How much does a YouTube metadata lookup cost?
These three TikHub tools each bill per call, rather than per video object inside the response. Video information costs $0.001, channel information costs $0.001, and channel videos costs $0.001 per call. Verified 2026-11-14.
Separate listing work from enrichment work
One listing call returned 30 videos and incurred one billed unit. Getting full details for every listed video is additional work, so build the listing first and select the IDs that need enrichment. Do not request full details simply because an ID exists in the first response.
The three-call test incurred a total of $0.003, with one billed unit on each completed run. Verified 2026-11-14. All three succeeded; no failed-request or empty-result billing outcome was measured in this test.
Discovery and inspection are free. Only execution spends the wallet balance, which makes those first two steps the right place to inspect an unfamiliar tool before giving an agent permission to call it.
How to turn YouTube responses into a repeatable table
Store each response with its video or channel identifier, then build a small projection for the reader-facing table. The projection should preserve the difference between data returned by the provider and decisions made by your application.
Save the evidence before transforming it
Retrieve the completed video run without making another paid lookup:
monid runs get -r 01M7DD88J4FHJQ55R4WG8WDNY1 -j
Keep the run ID and completion timestamp beside your stored metadata. When a value changes on a later collection, those fields tell you which observation the row represents. A current view count is a snapshot, so overwriting yesterday's value also discards yesterday's evidence.
Define columns before exporting
Use video_id, duration_seconds, views, likes, comment_count_text, thumbnail_count and captions_present for the compact table. Add channel-level values to a separate channel table joined by channel_id; repeating channel totals on every video makes later aggregation error-prone.
The returned thumbnail entry had width 1280 and height 720. Store its URL if your job is metadata collection; downloading and validating the image is a separate action covered in the thumbnail download walkthrough.
Stop pagination deliberately
Set a page budget and a unique-video budget before following continuation tokens. Deduplicate by video_id, persist the token after each successful page, and stop when the response has no next token or your budget is reached. Do not use a rounded channel video count as the loop's stopping condition.
For monitoring, keep a collection timestamp and compare IDs against your existing inventory. Fetch detailed metadata only for new or selected videos. This is an application design recommendation, separate from the three calls measured here.
When should you use something else?
Use TikHub directly when you already operate that integration, and use a separate content workflow when your end product is speech, a media file or a complete archive. You are reading the Monid blog; Monid supplies access to these TikHub calls, while TikHub supplies the underlying responses.
The tested workflow covers public video metadata, channel context and one page of uploads. It does not deliver a transcript, download a video, schedule collection or create a CSV file. Your agent or application performs storage, transformation and scheduling.
The single-video input is another practical boundary: one request accepts one video ID. A list of selected videos therefore needs repeated detail requests, with explicit limits and retry handling. Keep a working dedicated connection when it already meets your task, and add catalog access when your agent needs it.
Which tool should you use for each YouTube task?
Choose the narrowest tested TikHub tool that supplies the missing part of your table. All three rows below were executed successfully on November 14, 2026; the table separates their jobs rather than treating them as interchangeable lookups.
| Use case | Best endpoint | Why? |
|---|---|---|
| Enrich one video ID | Video information, get_video_info | Returned exact views, likes and duration; PER_CALL, Verified 2026-11-14, $0.001 |
| Add channel context | Channel information, get_channel_info | Returned subscriber and video display totals; PER_CALL, Verified 2026-11-14, $0.001 |
| Collect upload IDs | Channel videos, get_channel_videos | Returned 30 video objects and a next-page token; PER_CALL, Verified 2026-11-14, $0.001 |
Conclusion
You now have a tested video row, channel context and a first page of upload IDs, with a clear rule for repeating collection: preserve identifiers, distinguish exact numbers from display text, and enrich only the videos your task needs. Monid handles discovery and paid access; your application keeps the dataset consistent. The opening's estimated 1 min setup assumes an existing account and installed agent, and its 1-2 hrs saved assumes avoiding that much first-integration work on authentication, request mapping and field exploration; neither is a measured benchmark. Choose the route that leaves you with a table you can refresh and explain.
FAQ
Is an API key for YouTube free to use here?
Discovery and inspection are free; executing the tested tools is paid. A Monid key gives access to these catalog calls, and it is not a credential issued by YouTube. Read the current tool prices before expanding a collection.
What do I need to install?
Install the Monid CLI for the terminal workflow, or give your agent the setup instruction. Save the key in credential configuration, and keep it out of committed scripts and exported tables.
Can I get YouTube data without writing code?
Yes, an agent can execute the discover, inspect and call sequence from the opening prompt. Ask it to preserve null values, cap paid calls and show the final table before attempting a larger collection.
How many videos can I process at once?
The tested detail tool takes one video ID per request. The channel listing returned 30 video objects in its first response and supplied a continuation token; that observation is not a guaranteed page size for every channel.
Does a failed lookup cost money?
This test establishes billing for three successful calls only. Inspect the run's status, cost and billed units after any unsuccessful request, and keep retries bounded so the script does not repeatedly submit the same work.
Can I schedule the collection?
Yes, schedule your own script or agent workflow outside the lookup tools. Save the last successful checkpoint, deduplicate video IDs and enforce a call budget on each scheduled collection.
Can I use the collected YouTube data for any purpose?
Rules differ by location and use; check the requirements that apply to your project. Access to metadata does not itself grant rights to reuse the underlying video, audio or thumbnail.
Published November 2026.


