Create Document

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

Create a document

Path Parameters

slug string required
schemaKey string required

Query Parameters

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

Environment slug. Defaults to production.

Body Parameters

name string required
content string
curl -X POST \
-H "x-api-key: dsk_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"name": "My Workspace",
"content": "Invoice #1234..."
}' \
https://api.tracore.io/workspaces/my-workspace/schemas/invoice/documents?env=production
import { TracoreClient } from '@tracore/sdk';

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

const doc = await client.documents.create('my-workspace', 'invoice', {
name: 'Invoice 2024-001',
content: 'Invoice #1234 Total: $500.00',
});
console.log(doc.id);
201 Response
{
  "id": "ws_abc123",
  "name": "My Workspace",
  "content": "Invoice #1234...",
  "mimeType": "application/pdf",
  "fileSize": 102400,
  "originalFilename": "invoice-2024.pdf",
  "status": "received",
  "extractedData": {
    "key": "value"
  },
  "createdAt": "2024-03-15T10:30:00Z",
  "updatedAt": "2024-03-15T10:30:00Z"
}