Schemas
Schemas define the structure of data you want to extract from documents. Create reusable schemas to ensure consistent extraction across multiple documents.
Schema Object
A schema defines the fields and their types for extraction.
{"id": "sch_abc123","name": "invoice","description": "Standard invoice extraction schema","fields": [{"name": "vendor_name","type": "string","description": "Name of the vendor or supplier"},{"name": "invoice_number","type": "string","description": "Invoice reference number"},{"name": "date","type": "date","description": "Invoice date"},{"name": "total","type": "number","description": "Total amount due"},{"name": "line_items","type": "array","description": "List of line items","items": {"type": "object","fields": [{ "name": "description", "type": "string" },{ "name": "quantity", "type": "number" },{ "name": "unit_price", "type": "number" },{ "name": "amount", "type": "number" }]}}],"created_at": "2024-01-15T10:30:00Z","updated_at": "2024-01-15T10:30:00Z"}
Field Types
| Type | Description | Example |
|---|---|---|
| string | Text value | "Acme Corp" |
| number | Numeric value (integer or float) | 1500.00 |
| date | Date in ISO 8601 format | "2024-01-15" |
| boolean | True or false | true |
| array | List of items (requires items definition) | ["item1", "item2"] |
| object | Nested object (requires fields definition) | {"key": "value"} |
POST
/v1/schemas
Create a new extraction schema.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | String | Yes | Unique name for the schema |
| description | String | No | Description of what this schema extracts |
| fields | Array | Yes | Array of field definitions |
Example
curl -X POST https://api-parse.conversiontools.io/v1/schemas \-H "Authorization: Bearer YOUR_API_KEY" \-H "Content-Type: application/json" \-d '{"name": "invoice","description": "Standard invoice schema","fields": [{ "name": "vendor_name", "type": "string", "description": "Vendor name" },{ "name": "total", "type": "number", "description": "Total amount" },{ "name": "date", "type": "date", "description": "Invoice date" }]}'
Response
{"success": true,"schema": {"id": "sch_abc123","name": "invoice","description": "Standard invoice schema","fields": [{ "name": "vendor_name", "type": "string", "description": "Vendor name" },{ "name": "total", "type": "number", "description": "Total amount" },{ "name": "date", "type": "date", "description": "Invoice date" }],"created_at": "2024-01-15T10:30:00Z","updated_at": "2024-01-15T10:30:00Z"}}
GET
/v1/schemas
List all schemas for your account.
Example
curl https://api-parse.conversiontools.io/v1/schemas \-H "Authorization: Bearer YOUR_API_KEY"
Response
{"success": true,"schemas": [{"id": "sch_abc123","name": "invoice","description": "Standard invoice schema","fields": [...],"created_at": "2024-01-15T10:30:00Z","updated_at": "2024-01-15T10:30:00Z"}]}
GET
/v1/schemas/:id
Retrieve a single schema by its ID.
Example
curl https://api-parse.conversiontools.io/v1/schemas/sch_abc123 \-H "Authorization: Bearer YOUR_API_KEY"
PUT
/v1/schemas/:id
Update an existing schema. All fields are replaced.
Example
curl -X PUT https://api-parse.conversiontools.io/v1/schemas/sch_abc123 \-H "Authorization: Bearer YOUR_API_KEY" \-H "Content-Type: application/json" \-d '{"name": "invoice_v2","description": "Updated invoice schema","fields": [{ "name": "vendor_name", "type": "string", "description": "Vendor name" },{ "name": "total", "type": "number", "description": "Total amount" },{ "name": "date", "type": "date", "description": "Invoice date" },{ "name": "currency", "type": "string", "description": "Currency code" }]}'
DELETE
/v1/schemas/:id
Delete a schema. This action cannot be undone.
Example
curl -X DELETE https://api-parse.conversiontools.io/v1/schemas/sch_abc123 \-H "Authorization: Bearer YOUR_API_KEY"
Response
{"success": true,"message": "Schema deleted"}