Skip to main content
POST
/
v1
/
agents
curl -X POST https://api.okrapdf.com/v1/agents \
  -H "Authorization: Bearer okra_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "invoice-extractor",
    "system": "Extract vendor, amount, and date from each invoice. Insert one row per document.",
    "table_id": "tbl_abc123"
  }'

Overview

An agent defines how sessions behave — which model to use, what system instructions to follow, and optionally which table to write extracted data into.
name
string
required
Human-readable name for the agent.
model
string
Model to use for completions. Defaults to "default".
system
string
System instructions for the agent. Guides how the agent processes documents and uses tools.
table_id
string
Bind a typed table to this agent. Sessions created with this agent will have doc_sql and table_sql tools available for reading documents and writing to the table.
output_schema
object
JSON Schema for structured output. When set, completions will conform to this schema.
curl -X POST https://api.okrapdf.com/v1/agents \
  -H "Authorization: Bearer okra_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "invoice-extractor",
    "system": "Extract vendor, amount, and date from each invoice. Insert one row per document.",
    "table_id": "tbl_abc123"
  }'

Response (201)

{
  "id": "agent_cf3de29f5a384695",
  "name": "invoice-extractor",
  "model": "default",
  "system": "Extract vendor, amount, and date from each invoice. Insert one row per document.",
  "table_id": "tbl_abc123",
  "output_schema": null,
  "version": 1,
  "created_at": "2026-04-14T05:30:00Z",
  "updated_at": "2026-04-14T05:30:00Z"
}