Agent quickstart
Use Task402 from REST or MCP.
Discover the contract first, then upload or generate. Capabilities are bearer secrets: keep them in the agent's secret store and never put them in prompts or logs.
Discover
GET https://task402.xyz/v1/pricing GET https://task402.xyz/.well-known/x402 POST https://task402.xyz/mcp
Generate a PDF
POST /v1/pdf
Content-Type: application/json
Idempotency-Key: report-2026-0001
{"title":"Report","markdown":"# Summary\n\nRevenue: 42"}A live request returns 402 with x402 v2 requirements. Sign the exact requirements with the agent's wallet, retry with PAYMENT-SIGNATURE, then poll the returned status URL with its capability.
Work with an existing PDF
POST /v1/documents
Content-Type: application/pdf
Idempotency-Key: source-2026-0001
X-Document-Recovery-Key: <caller-generated-secret>
GET /v1/documents/{id}
Authorization: Bearer <document-capability>
POST /v1/documents/{id}/search
Authorization: Bearer <document-capability>
Content-Type: application/json
{"query":"revenue","limit":5}Use the returned document capability on every read operation. Reuse the same idempotency and recovery keys only to recover the same upload after a lost response. The parser extracts native PDF text and bounded geometry. Scanned pages need OCR outside this service; visual meaning, PDF/A conformance, cryptographic signature validity, and table structure are not inferred.
MCP setup
Connect an MCP Streamable HTTP client to https://task402.xyz/mcp. The server advertises generate_pdf, get_pdf_job, and the document tools when the parser is available. Payment challenges are returned as an MCP tool result and payment is supplied in _meta["x402/payment"]. A browser GET to the MCP URL is expected to return a protocol error; use an MCP client POST.
Limits and reliability
- PDF uploads are bounded to 20 MiB and 100 pages.
- Document parsing uses one isolated Container task at a time; busy callers receive a retryable 503.
- Generated artifacts and uploaded documents expire automatically.
- Results are deterministic native-text operations, so agents can cite page numbers and verify quotes without a language-model call.
For the full contract, security notes, SDK example, and deployment details, use the repository guide packaged with the Registry metadata.