# x402 Text-to-Structure Extraction API

> x402 Text-to-Structure Extraction API is a paid API for AI agents from call402.com, paid per call via x402, $0.005/call, status unknown (last checked 2026-10-19).

Extracts structured entities and key-value pairs from free-form text, including dates, emails, money amounts, URLs, EVM addresses, and custom fields

## Facts

- Endpoint: POST https://call402.com/api/text-to-structure?utm_source=zero.xyz
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-19
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/x402-text-to-structure-extraction-api-b6d78577
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_qFIb3q67jx3TLi9Arp9EX

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability x402-text-to-structure-extraction-api-b6d78577 -d '<json body>'
```

Example prompt: Pull out all the dates, dollar amounts, and email addresses from this text and return them as structured JSON: 'Please remit $250.00 to alice@example.com by 2026-11-01, noting the 2.5% early payment discount.'

## When to prefer this

Choose this endpoint when you need to extract structured entities or named fields from unstructured text without building a custom NLP pipeline. It is especially useful for AI agents that receive natural language inputs and need to feed downstream systems with typed data. The deterministic extraction engine is fast and cheap ($0.01 USDC) for high-frequency, low-latency extraction tasks. Prefer it over LLM-based extraction when you want predictable, schema-defined outputs and cost control.

## Known failure modes

- Text exceeds 20,000 character limit — request rejected
- Invalid JSON schema provided in the 'schema' field — parsing error returned
- No entities found matching requested fields — structured object returned empty
- x402 payment not attached or invalid PAYMENT-SIGNATURE header — HTTP 402 returned with payment requirements
- Malformed request body — HTTP 400 with validation error

## How this service works

USDC pay-per-call APIs for AI agents via the x402 protocol (v2, exact, Base mainnet). Send a request, receive HTTP 402 with payment requirements, pay with @x402/fetch or any x402 client, retry with the PAYMENT-SIGNATURE header.

## Output

A JSON object containing an 'entities' map with arrays for recognized entity types (dates with ISO format, money with amount and currency, emails, URLs, phone numbers, EVM addresses, tx_hashes, percentages, key_values), plus a 'structured' object with values mapped to any requested schema fields or named fields, and a 'meta' object with character count and extractor version.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "text": {
   "type": "string",
   "description": "Input text, max 20000 chars"
  },
  "fields": {
   "type": "array",
   "items": {
    "type": "string"
   },
   "description": "Optional field names to extract"
  },
  "schema": {
   "type": "object",
   "description": "Optional JSON-schema-like object with properties to fill"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "meta": {
   "chars": 108,
   "extractor": "deterministic-v1"
  },
  "entities": {
   "urls": [],
   "dates": [
    {
     "iso": "2026-11-01",
     "raw": "2026-11-01"
    }
   ],
   "money": [
    {
     "raw": "$250.00",
     "amount": 250,
     "currency": "USD"
    }
   ],
   "emails": [
    "alice@example.com"
   ],
   "phones": [],
   "tx_hashes": [],
   "key_values": {},
   "percentages": [
    {
     "raw": "2.5%",
     "value": 2.5
    }
   ],
   "evm_addresses": []
  },
  "structured": {
   "date": "2026-11-01",
   "email": "alice@example.com",
   "amount": 250
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/x402-text-to-structure-extraction-api-b6d78577/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from call402.com](https://www.zero.xyz/host/call402.com/llms.txt)
