Extract from Document

POST /workspaces/{slug}/schemas/{schemaKey}/documents/{id}/extract

Extract from a previously uploaded document. Mode A: Use schemaKey from URL path to resolve the latest (or specific) version. Mode B: Provide schema in body to auto-version (creates family/version if needed). Returns 202 with a runId. Poll GET /runs/{runId} for results.

Path Parameters

slug string required
schemaKey string required
id string required

Query Parameters

env "production" | "staging" | "development"

Environment slug. Defaults to production.

Body Parameters

versionNumber integer
schema object
schemaName string

Display name for the schema family

description string

Description for the schema family

model string

Optional provider/model override. See ExtractRequest.model.

curl -X POST \
-H "x-api-key: dsk_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"versionNumber": 1,
"schema": {},
"schemaName": "example-schemaName",
"description": "Invoice processing workspace",
"model": "example-model"
}' \
https://api.tracore.io/workspaces/my-workspace/schemas/invoice/documents/doc_abc123/extract?env=production
import { TracoreClient } from '@tracore/sdk';

const client = new TracoreClient({ apiKey: 'dsk_your_api_key' });

// Extract from existing document with auto-polling
const run = await client.extract('my-workspace', 'invoice', {
documentId: 'doc_abc123',
}, { poll: true });

if (run.status === 'completed') {
console.log(run.extractedData);
}
202 Response
{
  "runId": "run_abc123",
  "status": "pending"
}