v1.0

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

POST /proxy/[provider]/*

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.

HeaderRequiredDescription
AuthorizationYesYour AI provider's API key (e.g., Bearer sk-...). Passed through to the provider.
X-Api-KeyNoYour 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-NameNoA 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.

ProviderArkna Proxy PathEquivalent Direct URL
OpenAI/[provider]/openai/v1https://api.openai.com/v1
Anthropic/[provider]/anthropic/v1https://api.anthropic.com/v1
Google/[provider]/googlehttps://generativelanguage.googleapis.com
OpenRouter/[provider]/openrouter/apihttps://openrouter.ai/api
Streaming is fully supported. If your agent uses streaming responses (SSE), Arkna streams chunks to your agent in real-time and records the complete response when the stream finishes.

Test proxy connection

POST /proxy/test

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

FieldTypeRequiredDescription
providerstringYesopenai, anthropic, google, or openrouter
apiKeystringYesThe 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

POST /api/v1/sessions

Create a session to group related runs together (e.g., a multi-turn conversation).

Request Body

FieldTypeRequiredDescription
metadataobjectNoAny 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

POST /api/v1/runs

Start recording a new agent run. Returns a run_id you'll use for all subsequent calls in this run.

Request Body

FieldTypeRequiredDescription
trigger_typestringYesWhat triggered this run: api, schedule, webhook, manual, or auto
inputstringNoThe input or prompt that started this run
session_idstringNoSession to associate this run with
metadataobjectNoAny 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

POST /api/v1/runs/:runId/steps

Record a step within a run. Steps are automatically hash-chained for tamper-proof integrity (see Hash Chain).

Request Body

FieldTypeRequiredDescription
step_typestringYesreasoning, tool_call, retrieval, action, error, or completion
inputstringNoInput to this step
outputstringNoOutput from this step
reasoningstringNoThe agent's thinking or reasoning
duration_msnumberNoHow long this step took (milliseconds)
tokens_usednumberNoNumber of tokens (units of AI processing) used
error_typestringNoError classification (for error steps)
error_messagestringNoError details (for error steps)
metadataobjectNoAny extra data to attach

Response (201):

{
  "step_id": "step_a1b2c3d4-...",
  "sequence": 1,
  "step_hash": "a3f2e1d0c9b8a7f6e5d4c3b2a1f0e9d8c7b6a5f4e3d2c1b0"
}

Record Tool Call

POST /api/v1/runs/:runId/tools

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

FieldTypeRequiredDescription
tool_namestringYesName of the tool (e.g., query_database)
statusstringYessuccess, error, or timeout
argumentsobjectNoArguments passed to the tool
resultanyNoWhat the tool returned
error_messagestringNoError details (when status is error)
duration_msnumberNoHow long the tool call took (milliseconds)
target_systemstringNoWhat external system was called (e.g., postgresql, stripe)

Response (201):

{
  "tool_call_id": "tc_a1b2c3d4-..."
}

Capture Context

POST /api/v1/runs/:runId/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

FieldTypeRequiredDescription
step_idstringNoWhich step this context belongs to
system_promptstringNoThe agent's system prompt at this point
active_instructionsstring[]NoActive instructions or rules the agent is following
retrieved_documentsarrayNoDocuments the agent has retrieved
total_tokensnumberNoTotal tokens in the agent's context at this point

Response (201):

{
  "context_packet_id": "ctx_a1b2c3d4-..."
}

Complete Run

PATCH /api/v1/runs/:runId

Mark a run as completed, failed, or timed out. This triggers hash chain computation and anomaly detection.

Request Body

FieldTypeRequiredDescription
statusstringYescompleted, failed, or timeout
outputstringNoThe agent's final output
total_tokensnumberNoTotal tokens used in the run
total_cost_centsnumberNoTotal cost in cents
error_typestringNoError classification (for failed runs)
error_messagestringNoError 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

GET /api/monitoring/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 /api/monitoring/runs/:runId

Get detailed information about a specific run, including its steps, tool calls, context snapshots, and integrity check results.

Replay Run

GET /api/monitoring/runs/:runId/replay

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 /api/monitoring/runs/:runId/timeline

Get a simplified event timeline for a run: just the key events in order, without the full replay detail.

Context at Step

GET /api/monitoring/runs/:runId/context?step=:stepId

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

GET /api/api-keys

List all API keys for your account. Requires dashboard authentication.

Create API Key

POST /api/api-keys

Create a new API key. The full key is only shown once in the response. Save it somewhere secure.

Error Codes

HTTP StatusMeaningCommon Causes
200SuccessRequest processed successfully
201CreatedSession, run, step, tool call, or context created
400Bad RequestMissing required fields (e.g., no trigger_type on a run, or invalid step_type)
401UnauthorizedMissing or invalid API key
404Not FoundRun or session doesn't exist, or belongs to a different account
409ConflictRun already completed, or duplicate request
429Rate LimitedToo many requests. Wait a moment and try again.