---
title: "Extract schema-valid JSON from a document image with x402 V2."
method: POST
path: "/v2/extract-image"
tags: ["Image extraction · x402 V2"]
---

# Extract schema-valid JSON from a document image with x402 V2.

`POST /v2/extract-image`

Always paid from the first call, with no V1 or free image route. Send base64-encoded PNG, JPEG, or WebP bytes plus a JSON Schema. 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 schema-valid JSON. Image bytes are processed transiently and are not persisted by SchemaSure.

## Request body

- ImageExtractRequest
  - `image` object, required
    - `data` string, byte, required — Base64-encoded image bytes without a data-URL prefix.
    - `mimeType` 'image/png' | 'image/jpeg' | 'image/webp', required — Declared image media type; it must match the decoded file signature.
  - `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.

## 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)
