Build an API from a website
An agent-data build turns a source website into a catalog API. This guide uses the StockX build and its categories operation.
The captured build request, status responses, and CLI data call come from November 14, 2026. StockX has a published API. A repeat submission may match it instead of creating a build.
Use your own missing source when you intend to create an API. You can use StockX for the final data call.
What you need
Section titled “What you need”You need an authenticated CLI, an HTTP API key, or a connected MCP client. See CLI setup if you need to install it. Usage explains build and call allowances.
The captured build and data result use the CLI. The HTTP and MCP variants describe the corresponding interfaces, without separate captured submissions or data calls.
- Submit the source website.
- Follow the build to publication.
- Call a published operation.
1. Submit a source and recognize acceptance
Section titled “1. Submit a source and recognize acceptance”The StockX request supplies https://stockx.com/. Omit --task when the website URL is sufficient. Add a task when you need to describe particular records or inputs.
agent-data parse https://stockx.com/For your source, add --dry-run to preview the request. Remove it when you intend to submit the build.
Save one request UUID with Node.js before submission. The command reports an error if the file already exists.
./└── build-request-id.txt # Saved request UUIDnode -e 'require("node:fs").writeFileSync("build-request-id.txt", require("node:crypto").randomUUID()+"\n", {flag:"wx"})'curl --fail-with-body 'https://agent-data.motie.dev/api/v1/parse' \ -H "Authorization: Bearer $AGENT_DATA_API_KEY" \ -H "Idempotency-Key: $(cat build-request-id.txt)" \ -H 'Content-Type: application/json' \ --data '{"url":"https://stockx.com/"}'Keep the key and body unchanged after a transport failure. See build submission for the required fields.
Call parse with a saved UUID requestId and url: "https://stockx.com/". Omit task when the URL is sufficient.
Save the exact object before submission. Reuse it after a transport failure.
The CLI returned these selected fields at 14:15 UTC.
{ "matched": false, "parse_job_id": "pj_1da416ddc9adccdf2a0856d7", "status": "queued", "phase": "building", "status_url": "/api/v1/parse/pj_1da416ddc9adccdf2a0856d7", "serving_changed": false}parse_job_id identifies the accepted build. Save it for status reads. matched: false means the request started new work.
serving_changed: false means acceptance did not change the serving API. If your response has matched: true, read the returned API contract instead. See source matching.
2. Follow the build to publication
Section titled “2. Follow the build to publication”Use the returned build ID with the submitting account. Substitute your own ID for account-specific reads.
agent-data parse status pj_1da416ddc9adccdf2a0856d7agent-data parse events pj_1da416ddc9adccdf2a0856d7 --followcurl --fail-with-body \ 'https://agent-data.motie.dev/api/v1/parse/pj_1da416ddc9adccdf2a0856d7' \ -H "Authorization: Bearer $AGENT_DATA_API_KEY"Call parse_status.
{"parse_job_id":"pj_1da416ddc9adccdf2a0856d7"}The StockX status reads contain these states.
| Capture time, November 14, 2026 | State | Available result |
|---|---|---|
| 14:16 UTC | building, presentation starting | A saved request without a listing or API URL. |
| 14:38 UTC | building, presentation working | Active work without a usable API URL. |
| 15:04 UTC | live, presentation ready | A published listing and call example. |
The final status contains these selected fields.
{ "parse_job_id": "pj_1da416ddc9adccdf2a0856d7", "phase": "live", "listing_id": "42338ad3-fa01-4b3a-901f-a9aecf2a027a", "last_verified_at": "2026-11-14T14:58:49.107Z", "error": null}listing_id identifies the published StockX Public Product API. Its route slug categories names an operation inside that API.
The recorded verification time is 14:58 UTC. This example does not establish a duration for other builds. Use build recovery if your status reports a failure or required action.
Recover the build identifier
Section titled “Recover the build identifier”List recent builds if you did not save the acceptance response.
agent-data parse list --limit 20 --offset 0Match the website URL and creation time. Copy the returned parse_job_id, which identifies your build.
HTTP provides GET /api/v1/parse?limit=20&offset=0 at https://agent-data.motie.dev. Use your bearer credential. MCP has no build-list tool.
Read progress after a disconnect
Section titled “Read progress after a disconnect”A closed terminal or disconnected event stream does not cancel the build. Read status after you reconnect.
Read presentation.summary, phase, error, and the available actions together. CLI --follow streams recorded events. See event options for saved cursors and starting sequences.
MCP has no event-stream tool. Repeat parse_status to read progress.
3. Inspect and call the published operation
Section titled “3. Inspect and call the published operation”Use the API’s handle to read its contract. The StockX catalog entry uses stockx-com.
- Read the contract.
- Call
categories.
agent-data docs stockx-comagent-data call stockx-com categories- Read the contract.
curl --fail-with-body \ 'https://agent-data.motie.dev/api/v1/marketplace/listings/stockx-com/docs' \ -H "Authorization: Bearer $AGENT_DATA_API_KEY"- Call the categories path at the returned
api.base_url.
The captured contract supplies this address.
curl --fail-with-body \ 'https://api.agent-data.dev/stockx-com/v1/categories' \ -H "Authorization: Bearer $AGENT_DATA_API_KEY"The branded categories request returned eight categories on November 17, 2026.
- Call
docs.
{"listing_id":"stockx-com"}- Call
callwith the returned route slug.
{"listing_id":"stockx-com","route":"categories"}The contract defines categories as GET /v1/categories with no inputs. The CLI call returned eight categories at 16:18 UTC. This excerpt contains the first record.
{ "categories": [ { "name": "Sneakers", "slug": "sneakers", "type": "CONFIGURED", "textColor": "", "url": "https://stockx.com/category/sneakers", "urlType": "BROWSE" } ], "returned_count": 8, "source_url": "https://stockx.com/"}returned_count: 8 describes the complete result. The remaining names are Shoes, Apparel, Accessories, Collectibles, Trading Cards, Mystery Boxes, and More. Names and availability can change.
sneakers is a category value. categories is the route slug. The contract accepts the category’s slug as the products operation’s category input.
What you built
Section titled “What you built”The request produced a published API with category and product operations. The captured call establishes a successful categories request.
See example coverage for capture dates and operations without recorded executions.
Recover or stop a build
Section titled “Recover or stop a build”Status reads do not change the work. Resume and cancellation requests do.
Read agent-data parse status <job-id> for a build. Read agent-data parse extension status <request-id> for an extension.
<job-id> is your returned pj_… build identifier. <request-id> is the UUID saved with your extension request. List recent builds if you lost a build ID.
Check phase, presentation.summary, available actions, and error. A transport timeout means the client lacks a complete response. It does not establish server rejection.
For an extension timeout, use the saved-request retry procedure.
Choose the action reported by status
Section titled “Choose the action reported by status”| What you see | What to do |
|---|---|
| Work remains active without a requested action. | Follow the existing build. |
contract_changed | Read the target again. Prepare a new request against its contract. |
| A source or build conflict. | Find the existing API or build. Read its contract or status. |
| A blocked build offers continuation. | Resume that build. |
| Publication or verification fails. | Follow the reported next action, or contact support with the error and identifiers. |
| Unfinished work you intend to stop. | Request cancellation. |
Resume an eligible build
Section titled “Resume an eligible build”Use resume only when status offers continuation. A blocked or failed state alone does not establish that the action is available.
agent-data parse resume <job-id>agent-data parse status <job-id>Substitute your blocked build ID for <job-id>. CLI 0.13.0 resume accepts no prompt or task argument.
- Send
POST /api/v1/parse/{job-id}/resumeathttps://agent-data.motie.dev. - Read the same build’s status with
GET /api/v1/parse/{job-id}.
Use bearer authentication, Content-Type: application/json, and body {} for the POST request. Substitute your build ID for {job-id}.
MCP has no resume tool. Use CLI or HTTP, then read parse_status with your parse_job_id.
Cancel unfinished work
Section titled “Cancel unfinished work”agent-data parse cancel <job-id> --reason "No longer needed"agent-data parse status <job-id>Substitute your build ID for <job-id>. Omit --reason if you need no recorded reason.
- Send
POST /api/v1/parse/{job-id}/cancelathttps://agent-data.motie.dev. - Read status with
GET /api/v1/parse/{job-id}.
Use bearer authentication and Content-Type: application/json. Supply {} or a reason string in the JSON body.
MCP has no cancellation tool. Use CLI or HTTP, then read parse_status with your parse_job_id.
Cancellation does not undo completed publication or other effects. Check the final state instead of treating action acceptance as a stopped build.
Check the recovery outcome
Section titled “Check the recovery outcome”| Action | Success check |
|---|---|
| Resume | New progress followed by publication. |
| Cancel | A final cancelled or stopped outcome. |
| Complete an extension | Saved-request published plus a successful call to the changed operation. |
For a completed build, use its catalog handle to read the contract. Call the intended operation with current inputs. The published-operation step shows this final check.
Recovery errors
Section titled “Recovery errors”| What you see | What to do |
|---|---|
request.prompt: unknown field | Follow the CLI error fix. |
extension_request_not_found | Check the submitting account and exact saved UUID. |
Existing execution requires its original Git branch and repository | Contact support with the build ID because public resume cannot correct the recorded execution identity. |
The last error occurred after an accepted resume request. Acceptance alone does not establish renewed progress.
Use the support checklist if the reported action does not resolve the failure.
When to extend instead
Section titled “When to extend instead”Use Extend an API when the website already has an API but lacks an operation you need.