Skip to content

Call an API endpoint

agent-data call requests data from an operation in a catalog API. Read the API’s current contract for its route and required inputs.

Terminal window
agent-data call <api-reference> <route-slug> --<parameter> <value>

<api-reference> means an API handle or listing ID. The handle youtube-com and listing ID e5182587-a7c9-4668-a8a6-314458afef40 identify the same API. This argument is not a documentation URL.

<route-slug> names an operation inside that API. For example, search-videos selects YouTube search at HTTP path /v1/search-videos.

--query "python programming" supplies the operation’s required query parameter. --dry-run and --input-json control the CLI itself.

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

The CLI prints the response body to standard output. See usage for call costs.

--dry-run resolves the request without a data call. It may read the current contract.

This CLI 0.13.0 preview comes from November 17, 2026. The excerpt omits all headers, including the masked credential.

{
"dry_run": true,
"method": "GET",
"url": "https://api.agent-data.dev/youtube-com/v1/search-videos?query=python+programming",
"body": null
}

Use --input-json for explicit input locations and JSON types.

Terminal window
agent-data call youtube-com search-videos \
--input-json '{"query":{"query":"python programming"}}' \
--dry-run

The outer query selects the query-string location. The inner query names this operation’s input. This preview resolved the same request shown above.

The typed input object accepts path, query, header, and body. The request-input reference shows real path and typed-query previews and explains body syntax.

The CLI returned this first item on November 14, 2026. HTTP and MCP returned it on November 17, 2026. The excerpt omits other fields, other items, and the continuation value.

{
"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"
}
]
}

duration_seconds contains numeric seconds. duration and publication_information contain source text. The get data guide explains the fields and links to the complete captured items.

OptionEffect
--method <method>Select the HTTP method. Omit it to use the contract’s method.
--dry-runPrint the request without a data call.
--input-json <json>Supply typed inputs at explicit locations.
--api-key <key>Override the configured credential.
--base-url <url>Select the marketplace service for contract requests.
--verbosePrint diagnostics to standard error. See private fields.
-h, --helpShow command help.

Without --query, the preview exits with status 1. It returns this actual error before a data request.

{
"error": {
"status": 400,
"body": null,
"source": "cli",
"code": "missing_required_param",
"message": "Missing required parameter: query (in: query)",
"param": "query",
"retryable": false
}
}

Add --query "python programming" because the operation requires a search query. The corrected command above returned the captured video data.

source: "cli" identifies local validation. The 400 value does not represent an upstream HTTP response.

What you seeWhat to do
An authentication error.Check the credential with agent-data auth status.
An allowance or spending error.Check account status and usage controls.
A source error.Follow source-error recovery.

Use the get data guide for setup and API discovery. Use typed inputs for path parameters, headers, or JSON bodies.