Skip to content

Extend an API

An extension adds operations to an existing agent-data API.

This guide uses the Hacker News Read API. Inspect its existing operations before you request a missing operation with the prompt format.

You need an authenticated CLI, an HTTP API key, or a connected MCP client. See setup if you need the CLI. Usage explains build and call allowances.

Contract, target, and feed examples use real reads from November 17, 2026. Submission and publication steps use your own saved request. See example coverage.

  1. Read the API contract.
  2. Prepare a request for a missing operation.
  3. Submit the saved request.
  4. Follow its publication.
  5. Check existing and added operations.

The handle news-ycombinator-com identifies the Hacker News Read API. Read its contract.

Terminal window
agent-data docs news-ycombinator-com

The captured contract includes these operations.

Route slugHTTP method and path
feedsGET /v1/feeds
feeds-by-feedGET /v1/feeds/{feed}
items-by-item-idGET /v1/items/{item_id}
searchGET /v1/search

A route slug names an operation inside the API. feeds-by-feed requires the path parameter feed. The value news selects the front page.

Use an existing operation if it meets your task. An extension is appropriate for a missing operation.

These steps use Hacker News as the target. For another API, change the target handle and source URL together.

The preparation uses these files in your working directory.

./
├── improvement.txt # Your required improvement
├── extension-target.json # Current target response
└── extension.json # Generated request for submission and retries
  1. Write your missing operation, useful inputs, and required outputs in improvement.txt.
  2. Save the current target response.
Terminal window
agent-data parse extension target news-ycombinator-com > extension-target.json
  1. Check canStart and the existing operations in that response.
  2. Create the saved request with Node.js.
Terminal window
node --input-type=module -e '
import { readFileSync, writeFileSync } from "node:fs";
import { randomUUID } from "node:crypto";
const target = JSON.parse(readFileSync("extension-target.json", "utf8"));
const prompt = readFileSync("improvement.txt", "utf8").trim();
if (!prompt) throw new Error("Describe the missing operation in improvement.txt");
const request = {
requestId: randomUUID(),
listingId: target.listingId,
contractVersion: target.contractVersion,
url: "https://news.ycombinator.com/",
prompt
};
writeFileSync("extension.json", JSON.stringify(request, null, 2) + "\n", { flag: "wx" });
console.log(JSON.stringify(request, null, 2));
'

The command uses the real target response and your text. It creates extension.json locally and refuses to overwrite an existing request. It does not submit work.

requestId is the saved request’s UUID. Keep the complete file for submission and retries.

The submission requires listingId and contractVersion from target inspection. The command copies both values automatically after you select the API by handle.

Check the saved request without submitting work.

Terminal window
agent-data parse extension submit extension.json --dry-run

Submit the file when you intend to create the extension work.

Terminal window
agent-data parse extension submit extension.json

Read the returned state. Use your saved requestId for status reads. If the response contains buildId, use it for build progress.

After a timeout, use the saved-request retry procedure.

4. Follow the saved request to publication

Section titled “4. Follow the saved request to publication”

Read the request ID from the saved file. Use the same account that submitted the extension.

Terminal window
request_id=$(node -p 'require("./extension.json").requestId')
agent-data parse extension status "$request_id"

state: "published" means the extension completed publication. buildId identifies the build for your extension. A building response does not establish that the operation is ready.

After publication, read the API contract again. Call your added operation with the inputs from improvement.txt. Check that the result contains the fields you requested.

Also check an existing operation. This request reads the Hacker News front page through feeds-by-feed.

Terminal window
agent-data call news-ycombinator-com feeds-by-feed --feed news

CLI, HTTP, and MCP each returned 30 stories on November 17, 2026. This CLI excerpt retains selected fields from the first story. It omits 29 stories, other fields, the continuation value, and source metadata.

{
"feed": "news",
"items": [
{
"id": "50535230",
"title": "GPT‑6.2 Astra and Sol",
"url": "https://openai.com/index/introducing-gpt-6-2-astra-sol/",
"score": 700,
"comment_count": null,
"rank": 1
}
],
"returned_count": 30
}
FieldMeaning
feed: "news"The Hacker News front-page feed.
idThe story’s identifier, separate from the API handle.
rank: 1The story’s position in the captured feed.
comment_count: nullNo comment count in this feed record, not a count of zero.
returned_count: 30The number of records in the complete response.

Use a returned next_cursor unchanged with the same feed for another page. Story positions and scores can change. Download the captured feed response for all returned records and source metadata.

The saved request identifies the improvement separately from the API and build. Publication makes the added operation available. A successful call to an existing operation does not establish that the added operation works.

The extension’s buildId identifies the build that performs the requested change. Use that identifier with agent-data parse status <job-id>.

<job-id> is the returned build identifier. Use build status and events for CLI, HTTP, or MCP progress reads.

An extension is ready when its saved request reports published. Check the changed operation with a data call after publication.

Read saved-request status before another submission. A transport timeout does not establish that the service rejected your request.

What you seeWhat to do
A submission times out.Follow the unchanged-request retry procedure.
contract_changedRead the target again. Prepare a new request against its current contract.
request.prompt: unknown fieldFollow the CLI error fix.
extension_request_not_foundCheck the submitting account and saved request UUID.
A blocked build offers continuation.Resume the build identified by buildId.
Unfinished work you intend to stop.Cancel the build identified by buildId.

Cancellation does not undo an operation that already published. Read the final build state after cancellation. Read saved-request status after resumed work to check publication.

Use Build an API for a website without a catalog API. Use extension errors to recover an existing request.