docs
API Reference
Traces

Traces API

POST /traces

Record a single AI call trace.

Headers:

Authorization: Bearer oiq_your_key_here
Content-Type: application/json

Request Body:

{
  "model": "llama-3.3-70b-versatile",
  "input": "What is the capital of France?",
  "output": "The capital of France is Paris.",
  "prompt_tokens": 15,
  "completion_tokens": 9,
  "latency_ms": 342,
  "cost_usd": 0.000021,
  "status": "success",
  "feature_name": "geography_quiz",
  "user_identifier": "user_123"
}

Response:

{
  "id": "a4d266f6-14b8-4ac1-9660-f22246524b89",
  "team_id": "bd283139-7e31-423a-b2aa-2fc2a94cb7d1",
  "model": "llama-3.3-70b-versatile",
  "input": "What is the capital of France?",
  "output": "The capital of France is Paris.",
  "prompt_tokens": 15,
  "completion_tokens": 9,
  "latency_ms": 342,
  "cost_usd": 0.000021,
  "status": "success",
  "feature_name": "geography_quiz",
  "user_identifier": "user_123",
  "created_at": "2026-06-25T14:32:01.771733Z"
}

Request Fields

FieldTypeRequiredDescription
modelstring✅Model name
inputstring❌User's prompt
outputstring❌AI's response
prompt_tokensinteger❌Input token count
completion_tokensinteger❌Output token count
latency_msinteger❌Response time in ms
cost_usdfloat❌Cost in USD
statusstring❌success or error
error_messagestring❌Error details if failed
feature_namestring❌Feature label for analytics
user_identifierstring❌User ID for per-user analytics

GET /traces

Get your team's recent traces with pagination.

Query Parameters:

ParamDefaultDescription
page1Page number
limit20Traces per page (max 100)

Response:

{
  "traces": [...],
  "total": 1240,
  "page": 1,
  "limit": 20
}

GET /traces/{trace_id}

Get a single trace by ID.

Response: Same as single trace object above.