71trust / 100

Document Extract

by x402.hydratrader.ai in Documents & files

x402 APIPassing, checked 2 h ago

Extract JSON from a PDF or long document into your schema, with a verified source quote and page number for every field. Public PDF/HTML URL or pasted text, up to 40 pages. $0.30 USDC on Base via x402. No API key. Text PDFs only (no OCR); no login/paywall sources.

POST
https://x402.hydratrader.ai/v1/document-extract
Price
$0.3
per call in USDC
Uptime
100%
last 30 days
Response time
821 ms
1.0 s slowest 5%
Last check
Passed
2 h ago, next any minute now

Run a free test callHow to call it

Reliability

All checks passedSome failedAll failedNot checked

Status and outage history · Atom feed

How to call it

POST https://x402.hydratrader.ai/v1/document-extract

Each call costs $0.3 in USDC on Base, paid with the request over x402.

Run a free test callOne unpaid request, the way an agent sends it. You see the payment challenge it gets back. Nothing is charged.

Example request

From the listing.

POST https://x402.hydratrader.ai/v1/document-extract
content-type: application/json

{
  "client_ref": "demo-1",
  "schema": {
    "properties": {
      "author": {
        "type": "string"
      },
      "category": {
        "type": "string"
      },
      "published": {
        "type": "string"
      },
      "rfc_number": {
        "type": "integer"
      },
      "title": {
        "type": "string"
      }
    },
    "required": [
      "rfc_number",
      "title"
    ],
    "type": "object"
  },
  "source": {
    "type": "public_url",
    "url": "https://www.rfc-editor.org/rfc/pdfrfc/rfc2119.txt.pdf"
  }
}

Parameters

ParameterTypeRequiredDescription
client_refstringNo
instructionsstringNoOptional formatting hints (e.g. 'amounts in USD')
pagesstringNoOptional PDF page selection like '1-20,25' (≤40 pages; required when the PDF has >40 pages)
schemaobjectYesJSON Schema (type=object) for the record you want; 1–40 top-level properties; nested objects/arrays allowed
sourceobjectYes

Example response

The provider's example. We can't check it without paying.

Example response, 75 lines
{
  "client_ref": "demo-1",
  "confidence": 0.95,
  "coverage": 1,
  "data": {
    "author": "S. Bradner",
    "category": "Best Current Practice",
    "published": "March 1997",
    "rfc_number": 2119,
    "title": "Key words for use in RFCs to Indicate Requirement Levels"
  },
  "endpoint": "document-extract",
  "evidence": {
    "author": {
      "confidence": 0.95,
      "page": 1,
      "quote": "S. Bradner"
    },
    "category": {
      "confidence": 0.95,
      "page": 1,
      "quote": "Category: Best Current Practice"
    },
    "published": {
      "confidence": 0.95,
      "page": 1,
      "quote": "March 1997"
    },
    "rfc_number": {
      "confidence": 0.95,
      "page": 1,
      "quote": "Request for Comments: 2119"
    },
    "title": {
      "confidence": 0.95,
      "page": 1,
      "quote": "Key words for use in RFCs to Indicate Requirement Levels"
    }
  },
  "missing": [],
  "next_tasks": [
    {
      "endpoint": "https://x402.hydratrader.ai/v1/summarize",
      "example_body": {
        "client_ref": "demo-1",
        "input": "{\"rfc_number\":2119,…}"
      },
      "method": "POST",
      "price_usd": "0.01",
      "task": "summarize",
      "why": "Short plain-language reading of the extracted record"
    }
  ],
  "ok": true,
  "schema_valid": true,
  "source_meta": {
    "chars": 9000,
    "pages_read": 3,
    "pages_total": 3,
    "sha256": "…",
    "truncated": false,
    "type": "pdf",
    "url": "https://www.rfc-editor.org/rfc/pdfrfc/rfc2119.txt.pdf"
  },
  "usage": {
    "input_tokens": 3600,
    "latency_ms": 6000,
    "llm_calls": 1,
    "model": "grok-4.20-0309-non-reasoning",
    "model_cost_est_usdc": "0.0051",
    "output_tokens": 250,
    "price_usdc": "0.30"
  },
  "warnings": []
}

Call it from code

The curl command shows the payment challenge. The JavaScript and Python versions pay and call, and never pay more than $0.3.

curl: see the payment challenge
# bash or zsh: see the payment challenge. Nothing is charged.
curl -sS -g -i -X POST 'https://x402.hydratrader.ai/v1/document-extract' \
  -H 'content-type: application/json' \
  --data-raw '{"client_ref":"demo-1","schema":{"properties":{"author":{"type":"string"},"category":{"type":"string"},"published":{"type":"string"},"rfc_number":{"type":"integer"},"title":{"type":"string"}},"required":["rfc_number","title"],"type":"object"},"source":{"type":"public_url","url":"https://www.rfc-editor.org/rfc/pdfrfc/rfc2119.txt.pdf"}}'

# x402 v2 sends the challenge base64-encoded in the PAYMENT-REQUIRED header (v1 sends it in the body).
# To read the header:
curl -sS -g -o /dev/null -D - -X POST 'https://x402.hydratrader.ai/v1/document-extract' \
  -H 'content-type: application/json' \
  --data-raw '{"client_ref":"demo-1","schema":{"properties":{"author":{"type":"string"},"category":{"type":"string"},"published":{"type":"string"},"rfc_number":{"type":"integer"},"title":{"type":"string"}},"required":["rfc_number","title"],"type":"object"},"source":{"type":"public_url","url":"https://www.rfc-editor.org/rfc/pdfrfc/rfc2119.txt.pdf"}}' \
  | grep -i '^payment-required:' | cut -d' ' -f2 | tr -d '\r' | base64 --decode
JavaScript: pay and call
// npm i @x402/fetch @x402/evm viem
import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

// Pays at most $0.3 per call.
const client = new x402Client().setSpendControls({ maxAmountPerPayment: "$0.3" });
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.EVM_PRIVATE_KEY) });
const pay = wrapFetchWithPayment(fetch, client);

// Not sure it's safe to pay? ToolVet checks it first for $0.005. Pay for that from a separate
// client: this one is capped at $0.3 per payment. GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fx402.hydratrader.ai%2Fv1%2Fdocument-extract&method=POST
const res = await pay("https://x402.hydratrader.ai/v1/document-extract", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({
    "client_ref": "demo-1",
    "schema": {
      "properties": {
        "author": {
          "type": "string"
        },
        "category": {
          "type": "string"
        },
        "published": {
          "type": "string"
        },
        "rfc_number": {
          "type": "integer"
        },
        "title": {
          "type": "string"
        }
      },
      "required": [
        "rfc_number",
        "title"
      ],
      "type": "object"
    },
    "source": {
      "type": "public_url",
      "url": "https://www.rfc-editor.org/rfc/pdfrfc/rfc2119.txt.pdf"
    }
  }),
});
console.log(res.status, await res.text());
Python: pay and call
# pip install "x402[requests,evm]"
import os
from eth_account import Account
from x402 import x402ClientSync
from x402.http.clients import x402_requests
from x402.mechanisms.evm import EthAccountSigner
from x402.mechanisms.evm.exact.register import register_exact_evm_client

# Pays at most $0.3 per call.
client = x402ClientSync().set_spend_controls({"max_amount_per_payment": "$0.3"})
register_exact_evm_client(client, EthAccountSigner(Account.from_key(os.environ["EVM_PRIVATE_KEY"])))

with x402_requests(client) as session:
    res = session.post(
        "https://x402.hydratrader.ai/v1/document-extract",
        json={
            "client_ref": "demo-1",
            "schema": {
                "properties": {
                    "author": {
                        "type": "string",
                    },
                    "category": {
                        "type": "string",
                    },
                    "published": {
                        "type": "string",
                    },
                    "rfc_number": {
                        "type": "integer",
                    },
                    "title": {
                        "type": "string",
                    },
                },
                "required": [
                    "rfc_number",
                    "title",
                ],
                "type": "object",
            },
            "source": {
                "type": "public_url",
                "url": "https://www.rfc-editor.org/rfc/pdfrfc/rfc2119.txt.pdf",
            },
        },
    )
    print(res.status_code, res.text)

Security scan

No findings

We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.

Recent checks

WhenResultHTTPTimePrice
2 h agoPassed402965 ms$0.3
6 h agoPassed402703 ms$0.3
10 h agoPassed402898 ms$0.3
14 h agoPassed402756 ms$0.3
18 h agoPassed402717 ms$0.3
Show 10 older checks
22 h agoPassed402681 ms$0.3
26 h agoPassed402972 ms$0.3
30 h agoPassed4021.0 s$0.3
34 h agoPassed402791 ms$0.3
37 h agoPassed402905 ms$0.3
41 h agoPassed402765 ms$0.3
44 h agoPassed402790 ms$0.3
2 days agoPassed402881 ms$0.3
2 days agoPassed402878 ms$0.3
2 days agoPassed402777 ms$0.3