API Reference
Auto-generated
Extract
API reference for extract endpoints.
Auto-generated
This page was generated from the OpenAPI spec. Run
make generate-docs to refresh after spec changes.POST /api/v1/extract
POST
/api/v1/extractExtract structured data from content
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| content | string | Required | Raw content to extract from (HTML, text, markdown, or base64-encoded PDF) |
| content_type | "html" | "text" | "markdown" | Optional | Type of the provided contentDefault: html |
| extraction_schema | object | Optional | extraction_schema |
| extraction_profile | "auto" | "product" | "article" | "job_posting" | "faq" | "recipe" | "event" | Optional | extraction_profile |
| extraction_prompt | string | Optional | extraction_prompt |
| formats | string[] | Optional | Output formats for content transformationDefault: ['json'] |
| source_url | string | Optional | source_url |
| evidence | boolean | Optional | Include field provenance/evidence for extracted fieldsDefault: False |
Request Example
Bash
curl -X POST https://api.alterlab.io/api/v1/extract \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "example_content",
"content_type": "..."
}'Response Example
JSON
{
"extract_id": "example",
"formats": {},
"credits_used": 0,
"model_used": "example",
"extraction_method": "example",
"content_size_chars": 0
}GET /api/v1/extract/estimate
GET
/api/v1/extract/estimateEstimate extraction cost
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| content_length | integer | Required | content_length |
| has_extraction_prompt | boolean | Optional | has_extraction_promptDefault: False |
Request Example
Bash
curl -X GET 'https://api.alterlab.io/api/v1/extract/estimate?content_length=<content_length>' \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"estimated_cost_microcents": 0,
"estimated_cost_usd": "example",
"breakdown": "example"
}GET /api/v1/extract/templates
GET
/api/v1/extract/templatesList extraction templates
Request Example
Bash
curl -X GET https://api.alterlab.io/api/v1/extract/templates \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"templates": [],
"total": 0
}POST /api/v1/extract/templates
POST
/api/v1/extract/templatesSave a custom extraction template
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | Required | Display name for the template |
| schema | object | Required | JSON Schema defining the extraction output structure |
| tags | string[] | Optional | Tags |
Request Example
Bash
curl -X POST https://api.alterlab.io/api/v1/extract/templates \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "example_name",
"schema": "..."
}'Response Example
JSON
{
"status": "ok"
}GET /api/v1/extract/templates/{template_id}
GET
/api/v1/extract/templates/{template_id}Get a user template by ID
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| template_id | string | Required | template_id |
Request Example
Bash
curl -X GET https://api.alterlab.io/api/v1/extract/templates/<template_id> \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"id": "example",
"name": "example",
"description": "example",
"schema": "example",
"builtin": true,
"tags": []
}PUT /api/v1/extract/templates/{template_id}
PUT
/api/v1/extract/templates/{template_id}Update a user template
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| template_id | string | Required | template_id |
| name | string | Optional | name |
| schema | object | Optional | schema |
| tags | string[] | Optional | tags |
Request Example
Bash
curl -X PUT https://api.alterlab.io/api/v1/extract/templates/<template_id> \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"id": "example",
"name": "example",
"description": "example",
"schema": "example",
"builtin": true,
"tags": []
}DELETE /api/v1/extract/templates/{template_id}
DELETE
/api/v1/extract/templates/{template_id}Delete a user template
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| template_id | string | Required | template_id |
Request Example
Bash
curl -X DELETE https://api.alterlab.io/api/v1/extract/templates/<template_id> \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"status": "ok"
}GET /api/v1/extract/templates/{template_id}/versions
GET
/api/v1/extract/templates/{template_id}/versionsList template versions
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| template_id | string | Required | template_id |
Request Example
Bash
curl -X GET https://api.alterlab.io/api/v1/extract/templates/<template_id>/versions \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"versions": [],
"total": 0
}GET /api/v1/extract/templates/{template_id}/versions/{version}
GET
/api/v1/extract/templates/{template_id}/versions/{version}Get one template version
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| template_id | string | Required | template_id |
| version | integer | Required | version |
Request Example
Bash
curl -X GET https://api.alterlab.io/api/v1/extract/templates/<template_id>/versions/<version> \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"version": 0,
"schema": {},
"created_at": "example"
}GET /api/v1/extract/usage
GET
/api/v1/extract/usageList extraction usage history
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| page | integer | Optional | pageDefault: 1 |
| page_size | integer | Optional | page_sizeDefault: 50 |
| date_from | string | Optional | date_from |
| date_to | string | Optional | date_to |
Request Example
Bash
curl -X GET https://api.alterlab.io/api/v1/extract/usage \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"items": [],
"total": 0,
"page": 0,
"page_size": 0,
"has_more": true
}GET /api/v1/extract/usage/summary
GET
/api/v1/extract/usage/summaryAggregate extraction usage totals
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| hours | integer | Optional | hours |
| days | integer | Optional | days |
Request Example
Bash
curl -X GET https://api.alterlab.io/api/v1/extract/usage/summary \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"total_requests": 0,
"total_cost_microcents": 0,
"cost_usd": "example"
}