---
title: "Primary production API: extract schema-valid JSON with x402 V2."
method: POST
path: "/v2/extract"
tags: ["Primary x402 V2 API"]
---

# Primary production API: extract schema-valid JSON with x402 V2.

`POST /v2/extract`

Always paid from the first call. Send the JSON body, decode the PAYMENT-REQUIRED response header, sign the live terms, and retry the identical request with PAYMENT-SIGNATURE. The server verifies first and settles only after producing a successful schema-valid response. Trust the live challenge for the price, asset, payee, and resource rather than hardcoding payment terms.

## Request body

- ExtractRequest
  - `input` string, required — Raw unstructured content to extract from (plain text or HTML).
  - `inputType` 'text' | 'html' | 'auto' — How to interpret `input`: plain text, HTML, or auto-detect (default).
  - `schema` object, required — JSON Schema (draft 2020-12) that the returned `data` is guaranteed to satisfy.
  - `options` object
    - `maxRepairs` integer — Max validate->re-prompt repair iterations.
    - `strict` boolean — Drop fields not present in the schema.
    - `deterministic` boolean — Enable deterministic pre-extraction hints.

## Response `200`

Schema-valid extraction. Paid responses include PAYMENT-RESPONSE.

- ExtractSuccess
  - `data` unknown, required
  - `meta` object, required
    - `repairs` integer, required
    - `latencyMs` integer, required
    - `validated` unknown, required
    - `deterministicFields` string[]

## Other responses

- `400` — Bad request, unsupported input, invalid JSON Schema, or decoded input too large; fix before retrying. Not settled.
- `402` — Payment required or invalid. Decode PAYMENT-REQUIRED, sign, and retry with PAYMENT-SIGNATURE.
- `413` — Encoded HTTP request body is too large; reduce it before retrying. Not settled.
- `422` — Could not produce schema-valid output; change the input/schema or use a fallback. Not settled.
- `429` — Rate limited. Wait for Retry-After before retrying. Not settled.
- `500` — Unexpected server error. Retry once with backoff, then report X-Request-ID. Not settled.
- `502` — Inference or payment upstream unavailable. Retry with bounded exponential backoff. Not settled.
- `504` — Extraction timed out. Retry with bounded exponential backoff. Not settled.

---

[API](https://skmtc.dev/schemasure/apis/schemasure-structured-extraction.md) · [All operations](https://skmtc.dev/schemasure/apis/schemasure-structured-extraction/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/schemasure/schemasure-structured-extraction/revisions/86c44d5ada4d/schema)
