Event schema

Authoritative field reference for every event type accepted by /ingest/batch and /ingest/event.

Batch envelope

Send up to 1,000 events per request. The body must be a JSON object with an events array. Each element is an object with a type string and a data object:

json
POST https://api.obsivara.com/ingest/batch
Authorization: Bearer obs_live_YOUR_KEY
Content-Type: application/json

{
  "events": [
    {
      "type": "run_start",
      "data": {
        "name": "Support reply",
        "assetId": "support-agent",
        "input": "where is my order?"
      }
    },
    {
      "type": "llm_call",
      "data": {
        "runId": "550e8400-e29b-41d4-a716-446655440000",
        "provider": "openai",
        "model": "gpt-4o",
        "promptTokens": 312,
        "completionTokens": 87,
        "totalTokens": 399,
        "costUsd": 0.0048,
        "latencyMs": 1240
      }
    },
    {
      "type": "run_end",
      "data": {
        "runId": "550e8400-e29b-41d4-a716-446655440000",
        "status": "success",
        "durationMs": 3500
      }
    }
  ]
}

Success returns HTTP 202:

json
HTTP/1.1 202 Accepted
{
  "accepted": 3,
  "rejected": 0,
  "errors": []
}

If some events are invalid, the batch still returns 202 but rejected will be greater than zero and errors will list the per-index failures:

json
HTTP/1.1 202 Accepted
{
  "accepted": 2,
  "rejected": 1,
  "errors": [
    { "index": 1, "error": "runId must be a valid UUID" }
  ]
}
The maximum batch size is 1,000 events. Batches larger than this are rejected with HTTP 413. Split large payloads into multiple requests.

run_start

Marks the beginning of a run. Generates a runId UUID if one is not provided.

FieldTypeRequired?Notes
namestringRequiredHuman-readable run name
assetIdstringRequiredThe asset being monitored
runIdUUIDOptionalAuto-generated if omitted; use this ID in subsequent events
inputanyOptionalThe input data for this run
userIdstringOptionalEnd-user identifier
traceIdstringOptionalDistributed trace ID for correlation
metadataobjectOptionalArbitrary key-value metadata
startedAtISO 8601OptionalDefaults to server receive time

run_end

Marks the end of a run. Must reference an existing runId UUID.

FieldTypeRequired?Notes
runIdUUIDRequiredMust be a valid UUID from a preceding run_start
statusstringRequiredOne of success, error, timeout
durationMsnumberRequiredTotal run duration in milliseconds
totalTokensnumberOptionalAggregate token count for the run
totalCostnumberOptionalAggregate cost in USD
outputanyOptionalThe final output of the run
errorMessagestringOptionalError description if status is error

llm_call

Records a single LLM invocation within a run. All numeric fields are required.

FieldTypeRequired?Notes
runIdUUIDRequiredMust be a valid UUID from a preceding run_start
providerstringRequiredModel provider (e.g. openai, anthropic)
modelstringRequiredModel name (e.g. gpt-4o, claude-3-5-sonnet)
promptTokensnumberRequiredInput token count
completionTokensnumberRequiredOutput token count
totalTokensnumberRequiredSum of prompt + completion tokens
costUsdnumberRequiredCost of this call in USD
latencyMsnumberRequiredTime-to-first-token or total latency in ms
promptstringOptionalThe full prompt text
completionstringOptionalThe full completion text
temperaturenumberOptionalSampling temperature used
promptVersionstringOptionalPrompt version identifier
metadataobjectOptionalArbitrary key-value metadata

tool_call

Records a tool or function call within a run.

FieldTypeRequired?Notes
runIdUUIDRequiredMust be a valid UUID from a preceding run_start
toolNamestringRequiredName of the tool or function called
statusstringRequiredOne of success, error
durationMsnumberRequiredTool execution duration in milliseconds
inputanyOptionalArguments passed to the tool
outputanyOptionalReturn value from the tool
errorMessagestringOptionalError description if status is error

span

Records a generic span within a trace, compatible with OpenTelemetry concepts.

FieldTypeRequired?Notes
traceIdstringRequiredDistributed trace identifier
namestringRequiredSpan name
durationMsnumberRequiredSpan duration in milliseconds
spanIdstringOptionalAuto-generated if omitted
runIdUUIDOptionalLinks this span to a run
kindstringOptionalOne of llm, tool, retrieval, agent, function. Default: function
inputanyOptionalSpan input data
outputanyOptionalSpan output data
statusstringOptionalOne of ok, error. Default: ok
metadataobjectOptionalArbitrary key-value metadata
startedAtISO 8601OptionalDefaults to server receive time

error

Records an error event, optionally linked to a run or asset.

FieldTypeRequired?Notes
messagestringRequiredHuman-readable error description
runIdUUIDOptionalLinks this error to a run
assetIdstringOptionalLinks this error to an asset
typestringOptionalError type/class (e.g. ValidationError)
severitystringOptionalError severity level
stackTracestringOptionalFull stack trace
metadataobjectOptionalArbitrary key-value metadata

Field naming convention

The /ingest/batch endpoint uses camelCase field names (e.g. assetId, promptTokens, durationMs). The generic webhook (/ingest/webhook/generic) uses snake_case (e.g. asset_id, prompt_tokens, duration_ms). Use the correct convention for the endpoint you are calling.