API Reference
Everything Arkna exposes: the recording proxy, the ingestion API for SDK-level instrumentation, and the monitoring API for replaying and investigating runs.
Proxy API
The proxy is the simplest way to use Arkna. Your agent sends requests to Arkna's proxy URL instead of the AI provider's URL. Arkna records the request and response, then forwards everything transparently.
Forward a request
Forwards any request to the specified AI provider. Replace [provider] with one of: openai, anthropic, google, openrouter.
The proxy accepts your Arkna credentials two ways. Both record the run; the first needs no Arkna-specific headers and works with every provider.
Recommended: key in the URL path
Put your Arkna API key and agent name directly in the proxy URL: /proxy/[arkna-key]/[agent-name]/[provider]/*. Your agent keeps sending its own provider key exactly as before; Arkna reads its key from the path and never touches your provider headers. This is the only form that works cleanly with Anthropic (whose own x-api-key header would otherwise collide with Arkna's).
curl -X POST https://api.arkna.com.au/proxy/ark_live_…/my-agent/openai/v1/chat/completions \
-H "Authorization: Bearer sk-your-openai-key" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Hello!"}]
}'
The Arkna key is stripped from the path before the request is forwarded; the provider never sees it. The response is identical to what the provider would return.
Alternative: Arkna key in a header
If you prefer to keep the provider-style base URL (/proxy/[provider]/*), pass your Arkna key in the X-Api-Key header instead. Use this only for providers that authenticate via Authorization (OpenAI, OpenRouter). Do not use it for Anthropic: its provider key also lives in x-api-key, so the two collide. For Anthropic, use the key-in-path form above.
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Your AI provider's API key (e.g., Bearer sk-...). Passed through to the provider. |
X-Api-Key | No | Your Arkna API key (ark_live_…). If provided, Arkna records the request. If omitted, Arkna still forwards the request but doesn't record it. |
X-Agent-Name | No | A name for your agent (e.g., sales-bot). Used to identify the agent in the dashboard. Defaults to llm-proxy if not set. |
curl -X POST https://api.arkna.com.au/proxy/openai/v1/chat/completions \
-H "Authorization: Bearer sk-your-openai-key" \
-H "X-Api-Key: ark_live_…" \
-H "X-Agent-Name: my-agent" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Hello!"}]
}'
Provider URLs
Base paths per provider. Prefix with /proxy/[arkna-key]/[agent-name] for the recommended form, or /proxy for the header form.
| Provider | Arkna Proxy Path | Equivalent Direct URL |
|---|---|---|
| OpenAI | /[provider]/openai/v1 | https://api.openai.com/v1 |
| Anthropic | /[provider]/anthropic/v1 | https://api.anthropic.com/v1 |
/[provider]/google | https://generativelanguage.googleapis.com | |
| OpenRouter | /[provider]/openrouter/api | https://openrouter.ai/api |
Test proxy connection
Verifies that a proxy connection is working. Sends a simple test request to the specified provider and confirms that the API key is valid.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
provider | string | Yes | openai, anthropic, google, or openrouter |
apiKey | string | Yes | The AI provider's API key to test |
curl -X POST https://api.arkna.com.au/proxy/test \
-H "Content-Type: application/json" \
-d '{"provider": "openai", "apiKey": "sk-your-key"}'
Response (200):
{
"success": true,
"provider": "openai",
"message": "Connection verified"
}
Authentication
The ingestion and monitoring APIs use API keys to identify your account. API keys start with ark_live_ and are created in the Arkna dashboard under Settings → API Keys.
How to authenticate
Include your API key in the X-Api-Key header on every request:
X-Api-Key: ark_live_your_key_here
For ingestion endpoints, also include the agent name so Arkna knows which agent is sending data:
X-Api-Key: ark_live_your_key_here
X-Agent-Name: my-agent
If the agent name doesn't exist yet, Arkna will automatically create it for you.
Base URL
https://api.arkna.com.au/api/v1
Ingestion API
The Ingestion API is how the SDKs report detailed agent activity to Arkna. If you're using the proxy, most of this happens automatically. If you want deeper instrumentation (recording individual steps, tool calls, and context), use these endpoints directly or through the SDK.
All endpoints accept and return JSON.
Create Session
Create a session to group related runs together (e.g., a multi-turn conversation).
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
metadata | object | No | Any extra data you want to attach to the session |
curl -X POST https://api.arkna.com.au/api/v1/sessions \
-H "X-Api-Key: ark_live_..." \
-H "X-Agent-Name: my-agent" \
-H "Content-Type: application/json" \
-d '{"metadata": {"user_id": "u_123"}}'
Response (201):
{
"session_id": "sess_a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
Start Run
Start recording a new agent run. Returns a run_id you'll use for all subsequent calls in this run.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
trigger_type | string | Yes | What triggered this run: api, schedule, webhook, manual, or auto |
input | string | No | The input or prompt that started this run |
session_id | string | No | Session to associate this run with |
metadata | object | No | Any extra data to attach |
curl -X POST https://api.arkna.com.au/api/v1/runs \
-H "X-Api-Key: ark_live_..." \
-H "X-Agent-Name: my-agent" \
-H "Content-Type: application/json" \
-d '{
"trigger_type": "api",
"input": "Summarize the Q4 sales report"
}'
Response (201):
{
"run_id": "run_a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"status": "running",
"started_at": "2026-03-18T12:00:00.000Z"
}
Record Step
Record a step within a run. Steps are automatically hash-chained for tamper-proof integrity (see Hash Chain).
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
step_type | string | Yes | reasoning, tool_call, retrieval, action, error, or completion |
input | string | No | Input to this step |
output | string | No | Output from this step |
reasoning | string | No | The agent's thinking or reasoning |
duration_ms | number | No | How long this step took (milliseconds) |
tokens_used | number | No | Number of tokens (units of AI processing) used |
error_type | string | No | Error classification (for error steps) |
error_message | string | No | Error details (for error steps) |
metadata | object | No | Any extra data to attach |
Response (201):
{
"step_id": "step_a1b2c3d4-...",
"sequence": 1,
"step_hash": "a3f2e1d0c9b8a7f6e5d4c3b2a1f0e9d8c7b6a5f4e3d2c1b0"
}
Record Tool Call
Record an external tool call (database query, API call, file read, etc.). If no step_id is provided, Arkna attaches it to the latest step or auto-creates one.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
tool_name | string | Yes | Name of the tool (e.g., query_database) |
status | string | Yes | success, error, or timeout |
arguments | object | No | Arguments passed to the tool |
result | any | No | What the tool returned |
error_message | string | No | Error details (when status is error) |
duration_ms | number | No | How long the tool call took (milliseconds) |
target_system | string | No | What external system was called (e.g., postgresql, stripe) |
Response (201):
{
"tool_call_id": "tc_a1b2c3d4-..."
}
Capture Context
Capture a snapshot of what the agent knew at a specific point. This powers the "context at this step" feature when you replay a run.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
step_id | string | No | Which step this context belongs to |
system_prompt | string | No | The agent's system prompt at this point |
active_instructions | string[] | No | Active instructions or rules the agent is following |
retrieved_documents | array | No | Documents the agent has retrieved |
total_tokens | number | No | Total tokens in the agent's context at this point |
Response (201):
{
"context_packet_id": "ctx_a1b2c3d4-..."
}
Complete Run
Mark a run as completed, failed, or timed out. This triggers hash chain computation and anomaly detection.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
status | string | Yes | completed, failed, or timeout |
output | string | No | The agent's final output |
total_tokens | number | No | Total tokens used in the run |
total_cost_cents | number | No | Total cost in cents |
error_type | string | No | Error classification (for failed runs) |
error_message | string | No | Error details (for failed runs) |
Response (200):
{
"run_id": "run_a1b2c3d4-...",
"status": "completed",
"duration_ms": 4230,
"chain_hash": "e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8"
}
Monitoring API
The Monitoring API lets you retrieve and replay recorded runs. These endpoints require dashboard authentication (you must be logged in to Arkna).
List Runs
List all recorded runs, with optional filtering by agent, status, or time range.
Returns a paginated list of runs with their status, duration, and cost.
Get Run Detail
Get detailed information about a specific run, including its steps, tool calls, context snapshots, and integrity check results.
Replay Run
Get an enhanced replay of a run with human-readable narratives, anomaly badges, and a summary of what happened. This is what powers the replay view in the dashboard.
Get Timeline
Get a simplified event timeline for a run: just the key events in order, without the full replay detail.
Context at Step
Get what the agent knew at a specific step: its system prompt, active instructions, and any documents it had retrieved.
API Keys
Manage your Arkna API keys programmatically. API keys (which start with ark_live_) are used to authenticate your agent's requests to the proxy and ingestion APIs.
List API Keys
List all API keys for your account. Requires dashboard authentication.
Create API Key
Create a new API key. The full key is only shown once in the response. Save it somewhere secure.
Error Codes
| HTTP Status | Meaning | Common Causes |
|---|---|---|
200 | Success | Request processed successfully |
201 | Created | Session, run, step, tool call, or context created |
400 | Bad Request | Missing required fields (e.g., no trigger_type on a run, or invalid step_type) |
401 | Unauthorized | Missing or invalid API key |
404 | Not Found | Run or session doesn't exist, or belongs to a different account |
409 | Conflict | Run already completed, or duplicate request |
429 | Rate Limited | Too many requests. Wait a moment and try again. |