API Reference

Public API

Send LLM execution traces from your agent and get back a permanent, shareable visual timeline. One POST call is all it takes.

endpointPOST https://tracen.nanocorp.app/api/traces
01

Getting Started

1
Create an account
Sign up at tracen.nanocorp.app. A subscription unlocks full API access.
2
Copy your API key
Go to /app/settings and copy your key. It looks like tracen_sk_...
3
Send your first trace
Include your key in the X-Tracen-Key header and POST a trace payload. You'll receive a shareable URL immediately.
02

Making Your First API Call

cURL
bash
curl -X POST https://tracen.nanocorp.app/api/traces \
  -H "Content-Type: application/json" \
  -H "X-Tracen-Key: tracen_sk_YOUR_KEY_HERE" \
  -d '{
    "prompt": "Summarise this text: ...",
    "response": "Here is a summary: ...",
    "provider": "openai",
    "model": "gpt-4o",
    "steps": [
      {
        "name": "llm_call",
        "timestamp": "2024-01-15T10:30:00.000Z",
        "latency_ms": 1240
      }
    ],
    "input_tokens": 120,
    "output_tokens": 45,
    "total_latency_ms": 1240,
    "status": "success",
    "error_message": null
  }'
JavaScript — fetch
javascript
const res = await fetch('https://tracen.nanocorp.app/api/traces', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-Tracen-Key': 'tracen_sk_YOUR_KEY_HERE',
  },
  body: JSON.stringify({
    prompt: 'Summarise this text: ...',
    response: 'Here is a summary: ...',
    provider: 'openai',
    model: 'gpt-4o',
    steps: [
      {
        name: 'llm_call',
        timestamp: new Date().toISOString(),
        latency_ms: 1240,
      },
    ],
    input_tokens: 120,
    output_tokens: 45,
    total_latency_ms: 1240,
    status: 'success',
    error_message: null,
  }),
});

const { trace_id, url } = await res.json();
// url → https://tracen.nanocorp.app/traces/<trace_id>
03

API Response

On success the API returns HTTP 200 with:

json
{
  "trace_id": "550e8400-e29b-41d4-a716-446655440000",
  "url": "https://tracen.nanocorp.app/traces/550e8400-e29b-41d4-a716-446655440000"
}

The url is a permanent public page — no login required to view it. Format: https://tracen.nanocorp.app/traces/{id}

04

Payload Reference

Top-level fields
FieldTypeRequiredDescription
promptstring✓ yesThe input sent to the LLM
responsestring✓ yesThe output returned by the LLM (can be empty string)
providerstring✓ yesLLM provider: openai · anthropic · mistral · gemini · custom
modelstring✓ yesModel identifier, e.g. gpt-4o or claude-3-5-sonnet-20241022
stepsarray✓ yesOrdered list of execution steps (see Step object below)
input_tokensinteger | nulloptionalToken count for the prompt
output_tokensinteger | nulloptionalToken count for the response
total_latency_msinteger | nulloptionalEnd-to-end wall-clock time in milliseconds
statusstring✓ yes"success" or "error"
error_messagestring | nulloptionalError details when status is "error"
Step object (each item in steps)
FieldTypeRequiredDescription
namestring✓ yesHuman-readable step label, e.g. "llm_call" or "tool_use"
timestampstring✓ yesISO-8601 datetime when this step started
latency_msinteger✓ yesDuration of this step in milliseconds
05

Rate Limiting

Limit
100 req / hour
Scope
Per API key
Reset
Rolling window
Response
HTTP 429

When the limit is exceeded the API returns 429 Too Many Requests with a Retry-After header indicating how many seconds to wait before retrying.

Ready to start tracing?
Sign up and get your API key in under a minute.
Get Started