API Documentation

Extraction endpoints

Standard REST endpoints to convert files to JSON or JSON to Excel using your schema.

Txt-to-JSON

Extract Txt / HTML / XML into JSON

Endpoint

POSThttps://www.claix.dev/api/txt-json

This endpoint receives a content field with already processed plain text, HTML, or XML and returns a single JSON object matching a txt-json schema.

Unlike doc-json, no file is uploaded: the payload is the content itself in a multipart form. Auth, schema checks, usage logs, and optional context window behavior match the other child functions.

Public URLs (Claix domain): extraction at POST https://www.claix.dev/api/txt-json; Agent mode at POST https://www.claix.dev/agent/txt-json. Never expose the raw Supabase URL to end clients.

Designed for server-to-server integrations. Do not call it from an end-user browser: it requires a secret API key.

1. Authentication

Every request must include your API key.

Option A — Dedicated header (recommended):

x-api-key: <YOUR_API_KEY>

Option B — Standard Authorization header:

Authorization: Bearer <YOUR_API_KEY>

If both are sent, x-api-key takes priority.

Before processing content, the system validates the API key and account status. Failures return 401.

2. Request format

HTTP method: POST · Content-Type: multipart/form-data (required)

FieldTypeRequiredDescription
contentTextYesThe text, HTML, or XML to transform. Not a file upload: the payload itself as a form text part.
schema_idText (UUID)YesID of a txt-json schema previously created on your account.

Field names must be exactly content and schema_id.

Schema requirement

schema_id must reference a txt-json schema. Other schema types return 400.

Supported content types in content

TypeExample use casesNotes
Plain textRaw emails, logs, pasted contracts, textual CSV, unrendered MarkdownAnalyzed as-is; Markdown syntax is not interpreted.
HTMLWeb pages, DOM fragments, HTML emails, rendered invoicesThe model reads tags and visible text; JavaScript is not executed.
XMLRSS/Atom feeds, SOAP, e-invoices, legacy API responsesNode structure is used to locate fields.

Content requirements

  • Content cannot be empty (whitespace only).
  • Max 300,000 characters. Larger payloads return 413 before calling the model.
  • As a fallback, content may also be sent as a text File, but a string form field is the usual pattern.

3. Step-by-step request

  1. Obtain your API key.
  2. Create a txt-json schema and copy its schema_id.
  3. POST to https://www.claix.dev/api/txt-json.
  4. Send auth via x-api-key or Authorization: Bearer.
  5. Build multipart/form-data with content and schema_id.
  6. Verify HTTP 200 before treating the call as successful.

4. Request examples

See the right-hand panel for cURL, JavaScript, Node.js, Python, PHP, and n8n examples.

5. Successful response

Status: 200 OK · Content-Type: application/json

{
  "success": true,
  "schema_utilizado": "Facturas HTML",
  "total_registros": 1,
  "data": [
    {
      "numero_factura": "F-2026-00456",
      "importe_total": 1284.50,
      "moneda": "EUR"
    }
  ]
}
FieldTypeDescription
successbooleanAlways true when HTTP status is 200.
schema_utilizadostringName (not id) of the schema that was applied.
total_registrosnumberAlways 1: the full content is treated as a single data source.
dataarray of objectsExactly one object with your schema keys. Missing values are null.
document_idstring (UUID) · optionalPresent only when window_context is enabled on the schema: persisted document id for follow-up queries.

6. Error codes

{
  "error": "Descripción legible del problema.",
  "detalle": "Información técnica adicional (solo presente en algunos casos)."
}

400 — Missing content or schema_id, body is not multipart, empty content, or schema is not type txt-json.

401 — Missing, invalid, or inactive API key, or suspended account.

404 — schema_id does not exist or does not belong to the account.

413 — Content exceeds 300,000 characters.

422 — No data matching the schema could be extracted.

502 — AI service failure. 405 — Method other than POST. 500 — Unexpected server error.

7. Error code summary

CódigoCategoría¿Reintentar?
200Éxito
400Error del cliente (documento o datos mal formados)No, corrige la petición primero
401Error de autenticaciónNo, corrige las credenciales primero
404Recurso no encontradoNo, corrige el schema_id primero
405Método HTTP incorrectoNo, corrige el método primero
413Archivo o texto extraído demasiado grandeNo, reduce el tamaño primero
422Sin datos extraíblesNo, revisa el documento/schema primero
500Error interno del servidorSí, con precaución
502Fallo del servicio de IASí, recomendado con backoff

Request examples

curl -X POST "https://www.claix.dev/api/txt-json" \
  -H "x-api-key: <TU_API_KEY>" \
  -F "content=<html><body><h1>Factura F-2026-00456</h1><p>Total: 1284.50 EUR</p></body></html>" \
  -F "schema_id=b980cfe7-61ef-4a5a-9724-881c8a5541e2"