# Structured Data Extraction API

$0.02 per call, pay only for 200 responses  
Structured data extraction API: send a public URL and a JSON Schema, get back JSON that validates against it. An answer that does not match the schema is never charged.

/extract40 credits / requestWeb

## x402 pay per call

**$0.02 per successful call**, paid in USDC on Base. No account or API key required. The live PAYMENT-REQUIRED header quotes the authoritative price.

### curl request

```
curl -i -X POST 'https://api.fastaf.co/x402/v1/extract' \
  -H 'Content-Type: application/json' \
  -d '{"url":"https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html","schema":{"type":"object","required":["title","price","in_stock"],"properties":{"title":{"type":"string"},"price":{"type":"object","required":["amount","currency"],"properties":{"amount":{"type":"number"},"currency":{"type":"string"}}},"in_stock":{"type":"boolean"}}}}'
```

### Example 402 payment challenge

Illustrative recipient address, not a payment destination. Request a fresh challenge, sign it with an x402 v2 client and retry the same URL with PAYMENT-SIGNATURE. The header is base64 JSON v2; the compatibility body uses v1 aliases on Base. Only successful results settle.

```
HTTP/1.1 402 Payment Required
Content-Type: application/json
PAYMENT-REQUIRED: eyJ4NDAyVmVyc2lvbiI6MiwicmVzb3VyY2UiOnsidXJsIjoiaHR0cHM6Ly9hcGkuZmFzdGFmLmNvL3g0MDIvdjEvZXh0cmFjdCIsImRlc2NyaXB0aW9uIjoiU3RydWN0dXJlZCBkYXRhIGV4dHJhY3Rpb24gKEpTT04gU2NoZW1hKSIsIm1pbWVUeXBlIjoiYXBwbGljYXRpb24vanNvbiJ9LCJhY2NlcHRzIjpbeyJzY2hlbWUiOiJleGFjdCIsIm5ldHdvcmsiOiJlaXAxNTU6ODQ1MyIsImFtb3VudCI6IjIwMDAwIiwiYXNzZXQiOiIweDgzMzU4OWZDRDZlRGI2RTA4ZjRjN0MzMkQ0ZjcxYjU0YmRBMDI5MTMiLCJwYXlUbyI6IjB4MTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMSIsIm1heFRpbWVvdXRTZWNvbmRzIjozMDAsImV4dHJhIjp7Im5hbWUiOiJVU0QgQ29pbiIsInZlcnNpb24iOiIyIn19XX0=

{
  "error": "payment_required",
  "x402Version": 2,
  "resource": {
    "url": "https://api.fastaf.co/x402/v1/extract",
    "description": "Structured data extraction (JSON Schema)",
    "mimeType": "application/json"
  },
  "accepts": [
    {
      "scheme": "exact",
      "network": "eip155:8453",
      "amount": "20000",
      "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "payTo": "0x1111111111111111111111111111111111111111",
      "maxTimeoutSeconds": 300,
      "extra": {
        "name": "USD Coin",
        "version": "2"
      }
    }
  ]
}
```

### Decoded PAYMENT-REQUIRED header

```
{
  "x402Version": 2,
  "resource": {
    "url": "https://api.fastaf.co/x402/v1/extract",
    "description": "Structured data extraction (JSON Schema)",
    "mimeType": "application/json"
  },
  "accepts": [
    {
      "scheme": "exact",
      "network": "eip155:8453",
      "amount": "20000",
      "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "payTo": "0x1111111111111111111111111111111111111111",
      "maxTimeoutSeconds": 300,
      "extra": {
        "name": "USD Coin",
        "version": "2"
      }
    }
  ]
}
```

### JSON discovery response example

JSON that validates against the request schema, minified. Optional schema fields may be missing or null; only fields listed in required are guaranteed to be present in a successful response. Optional nulls are omitted before validation. Answers that are not JSON, do not match the schema or exceed 64 KB return 422 extraction\_failed with validation\_errors and are never charged or settled. This example is illustrative.

```
{
  "title": "A Light in the Attic",
  "price": {
    "amount": 51.77,
    "currency": "GBP"
  },
  "in_stock": true
}
```

### Response with an API key

The same data over REST with a prepaid key. The JSON body is the example above; failed requests are not charged.

```
curl -X POST 'https://api.fastaf.co/v1/extract' \
  -H "Authorization: Bearer $FASTAF_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"url":"https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html","schema":{"type":"object","required":["title","price","in_stock"],"properties":{"title":{"type":"string"},"price":{"type":"object","required":["amount","currency"],"properties":{"amount":{"type":"number"},"currency":{"type":"string"}}},"in_stock":{"type":"boolean"}}}}'
```

### MCP tools

extract MCP tool calls require an API key or OAuth; x402 payments apply to HTTP data calls.

[Full endpoint reference for agents](/llms/extract.txt)

## Pricing

**x402:** $0.02 per successful call, USDC on Base, no account. **API key:** 40 credits per request from one-time credit packs, without expiry. Credit packs are shared by every endpoint and never renew.

Pack

Price

Credits

Per call

Per 1,000 calls

Starter

$10

20,000

$0.02

$20.00

Growth

$29

75,000

$0.01547

$15.47

Scale

$99

300,000

$0.0132

$13.20

Pro

$299

1,000,000

$0.01196

$11.96

Business

$799

3,000,000

$0.01065

$10.65

Free: 500 credits every month after email verification, no card. See [pricing](/pricing/). Alternatives: [FastAF vs SerpApi](/compare/serpapi/), [vs toll402](/compare/toll402/), [vs serp402](/compare/serp402/), [vs AgentBIT](/compare/agentbit/), [vs Amazon PA-API](/compare/amazon-pa-api/).

## Parameters

Name

Description

url

Required. Public HTTP or HTTPS page URL, same rules as /scrape; some marketplace and social pages are refused at no cost

schema

Required. JSON Schema object (draft 2020-12 subset): root type object or array, at most 8 KB, 5 levels and 50 properties, local $ref only

render\_js

Optional boolean (alias dynamic). Render JavaScript before extracting, at the same price

premium

Optional boolean. Premium proxies, at the same price

## Response fields

*   application/json
*   your schema’s fields
*   422 extraction\_failed
*   validation\_errors

Passing these fields to an LLM? See [token-aware scraping: only what your LLM needs](/use-cases/token-aware-scraping/).

Asking for fields instead of a whole page is how you [reduce tokens with structured extraction](/docs/token-efficient-web-data/); the docs show it next to Markdown output and result caps.

## Guides

*   [Add FastAF to Claude Code, Codex and Cursor](/how-to/add-fastaf-claude-code-codex-cursor/)
    
    One remote MCP server, three clients: the claude, codex and Cursor mcp.json setup for https://api.fastaf.co/mcp, with the API key auth it really uses.
    

## FAQ

### How do I call it?

POST /v1/extract with an API key, or POST /x402/v1/extract with x402, with a JSON body {url, schema, render\_js?, premium?}. It is POST only.

### What if the answer does not match my schema?

You get 422 extraction\_failed with validation\_errors listing each failing path. Nothing is charged with an API key and no x402 payment is settled. An invalid schema is refused before anything is charged.

### Are optional fields guaranteed?

No. Only the fields listed in required are guaranteed in a successful response. Optional fields may be missing, and optional nulls are left out before validation.

### Does a rendered or premium page cost more?

No. Plain, rendered and premium pages cost the same: 40 credits with an API key, or $0.02 per successful call over x402.

### How much does one Structured Data Extraction API call cost?

With x402 it is $0.02 per successful call in USDC on Base, with no account. With an API key it is 40 credits per request, which is $0.02 on the $10 Starter pack down to $0.01065 on the $799 Business pack. Failed requests are never charged.

### Do I need an account or an API key for Structured Data Extraction API?

Not for x402: send the request, pay the 402 challenge in USDC and retry. For credits, sign up free, confirm your email and use the API key in the Authorization header. Accounts get 500 free credits every month after email verification; they do not apply to x402.

## Other APIs

*   [Web Scraping API](/apis/web-scraping-api/)
    
    Public pages in selectable formats
    
*   [Screenshot API](/apis/screenshot-api/)
    
    Full-page or viewport screenshots
    
*   [Google SERP API](/apis/google-serp-api/)
    
    Structured web search results
    
*   [Google Maps API](/apis/google-maps-api/)
    
    Place search and place details
    

[All APIs →](/apis/) · [Guides and benchmarks on the blog →](/blog/)

### What it is used for

*   Product and price records from any public page
*   Typed tool outputs for AI agents
*   Lead and directory records
*   Clean JSON for RAG pipelines

[Start free](/pricing/)[Docs](/docs/)

## Related

*   [Google SERP API](/apis/google-serp-api/)
*   [Google Maps API](/apis/google-maps-api/)
*   [Amazon API](/apis/amazon-api/)
