Skip to content

Get data from an API

The YouTube API in the agent-data catalog returns video titles, channels, durations, and URLs. This guide uses one search for python programming through CLI, HTTP, or MCP.

The captured result includes a Python lesson from Indently, lasting 10 minutes and 30 seconds. The CLI is the recommended starting method.

You need an agent-data account with available call allowance or credits. Choose a method below. Your tab selection applies throughout the page.

You need Node.js 22.20.0 or later and npm. The examples use agent-data 0.13.0 on Node.js 22.23.4.

For a coding agent:

  1. Run setup for your agent. This command selects Codex.
Terminal window
npx --yes agent-data@latest init --codex
  1. Complete browser approval.
  2. Restart your coding agent.

For another agent, select its setup flag.

For direct terminal use:

  1. Install the CLI.
  2. Start browser approval.
Terminal window
npm install -g agent-data@latest
agent-data auth login
  1. Complete browser approval.

Check the installed version and credential.

Terminal window
agent-data --version
agent-data auth status

This November 14, 2026 response excerpt omits identity, balances, and credential details.

{
"status": "authenticated",
"account": {
"authenticated": true,
"can_make_calls": true
}
}

authenticated means the service accepted the credential. can_make_calls reports account eligibility at that time. See authentication recovery if this check fails.

Give your coding agent this task. For direct terminal use, follow the three steps below.

Use agent-data to find YouTube videos about "python programming".
  1. Find the API.
  2. Read its operation and inputs.
  3. Call the operation.

Search for the operation you need. This request finds APIs, not video records.

Terminal window
agent-data search "YouTube video search and details" --limit 3

The November 14, 2026 response includes this direct match. The excerpt omits other metadata, related results, and pagination fields.

{
"direct": {
"listings": [
{
"id": "e5182587-a7c9-4668-a8a6-314458afef40",
"name": "YouTube API",
"handle": "youtube-com",
"short_description": "Search YouTube videos and retrieve public video and channel metadata live."
}
]
}
}

The API handle youtube-com is a readable identifier. The listing ID e5182587-a7c9-4668-a8a6-314458afef40 identifies the same catalog entry. CLI commands accept either value.

direct.listings contains matches to the requested API or operation. related.listings contains similar suggestions. See search results for their meanings.

Read the YouTube API contract.

Terminal window
agent-data docs youtube-com

Check that the API has the operation and response fields your task needs. Find search-videos in api.routes. The captured contract contains these values.

Contract valueMeaning
slug: "search-videos"The route slug names the search operation.
method: "GET"The request uses HTTP GET.
path: "/v1/search-videos"Append this path to api.base_url.
name: "query", in: "query", required: true, type: "string"Supply search text in the URL query string.
request_body: nullThe request has no body.

The contract checked on November 17, 2026 returns https://api.agent-data.dev/youtube-com. The current catalog contract supplies the address for your request.

  1. Preview the request.
Terminal window
agent-data call youtube-com search-videos --query "python programming" --dry-run

The preview resolves GET with query=python+programming and no body. It does not request video data.

  1. Execute the data request.
Terminal window
agent-data call youtube-com search-videos --query "python programming"

Without query, the CLI reports missing_required_param: Missing required parameter: query (in: query). Add --query "python programming" to correct the request. The call reference shows the actual error payload and correction.

The CLI returned this first video on November 14, 2026. HTTP and MCP returned it on November 17, 2026.

The excerpt retains seven fields from the first item. It omits other fields, other items, and next_cursor.

{
"items": [
{
"video_id": "fWjsdhR3z3c",
"title": "Learn Python in Less than 10 Minutes for Beginners (Fast & Easy)",
"channel_name": "Indently",
"duration": "10:30",
"duration_seconds": 630,
"publication_information": "5 years ago",
"video_url": "https://www.youtube.com/watch?v=fWjsdhR3z3c"
}
]
}
FieldMeaning
itemsThe returned video records.
video_idThe video’s identifier.
video_urlThe URL for the video.
duration_secondsDuration as a number of seconds.
durationDuration as source text.
publication_informationRelative source text, not an exact publication date.
next_cursorA value for the next page, or null when the source reports no more results.

Use a returned next_cursor unchanged with the same query. The public captures omit this value. See the contract constraints before another request.

The November 14 CLI call returned 14 items. The November 17 HTTP and MCP calls returned 13 and 11 items. Source results and page sizes can vary.

Download the complete captured items: CLI response, HTTP response, and MCP response. Each capture records its date, interface, and omissions.

You used a catalog identifier to read an API contract, then called its search operation. Your application or agent can use the returned video records.

Use agent-data list when you want to explore published APIs without search ranking.

Terminal window
agent-data list --limit 3

The captured browse result includes the StockX API, identified by stockx-com. Read its contract before a data call. The catalog reference includes the real response, HTTP and MCP requests, filters, and pagination.

What you seeWhat to do
Search reports incomplete results.Retain the failure. Retry the affected read.
A result matches the website but lacks your operation.Extend the API.
The catalog has no API for the website.Build an API.
Authentication or input validation fails.Follow troubleshooting.

Check both result groups and candidate contracts before you request a build.

Use request inputs for path parameters or JSON bodies. Build an API for a missing website. Extend an API for a missing operation.

Use email notifications to send a result to your account’s email address.