Generic webhook

Send events from any language or tool with a single HTTP POST — no SDK or library required.

Endpoint

text
POST https://api.obsivara.com/ingest/webhook/generic

The n8n alias (/ingest/webhook/n8n) accepts the same payload — use either. Every request must include Authorization: Bearer obs_live_YOUR_KEY andContent-Type: application/json.

Full example

bash
curl -X POST https://api.obsivara.com/ingest/webhook/generic \
  -H "Authorization: Bearer obs_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "event": "run_started",
    "run_id": "my-run-001",
    "asset_id": "my-agent",
    "name": "First run",
    "input": "What is the weather today?"
  }'

Expected 202 response:

json
{ "source": "generic", "accepted": 1, "rejected": 0, "errors": [] }

Event types

The event field (snake_case) must be one of three values. Unknown values are stored as error rows — spell them exactly.

run_started

Marks the beginning of a workflow run.

json
{
  "event": "run_started",
  "run_id": "my-run-001",
  "asset_id": "my-agent",
  "name": "Support reply",
  "input": "Where is my order?"
}
FieldTypeRequiredDescription
eventstringYesExactly "run_started"
run_idstringYesUnique ID for this run. Any string — non-UUID values are auto-hashed to a stable UUID server-side.
asset_idstringYesThe agent, workflow, or prompt you are monitoring.
namestringNoHuman-readable label for the run.
inputstringNoThe input text or prompt that triggered this run.

llm_call

Records a model call within a run.

json
{
  "event": "llm_call",
  "run_id": "my-run-001",
  "provider": "openai",
  "model": "gpt-4o",
  "prompt_tokens": 312,
  "completion_tokens": 87,
  "total_tokens": 399,
  "cost_usd": 0.0048,
  "latency_ms": 1240
}
FieldTypeRequiredDescription
eventstringYesExactly "llm_call"
run_idstringYesMust match the run_id from run_started.
providerstringNoe.g. "openai", "anthropic", "google"
modelstringNoe.g. "gpt-4o", "claude-3-5-sonnet"
prompt_tokensnumberNoInput token count.
completion_tokensnumberNoOutput token count.
total_tokensnumberNoSum of prompt + completion tokens.
cost_usdnumberNoCost of this call in US dollars.
latency_msnumberNoTime-to-first-response or total call duration in milliseconds.

run_finished

Marks the end of a run.

json
{
  "event": "run_finished",
  "run_id": "my-run-001",
  "outcome": "success",
  "duration_ms": 3500,
  "total_cost_usd": 0.0048
}
FieldTypeRequiredDescription
eventstringYesExactly "run_finished"
run_idstringYesMust match the run_id from run_started.
outcomestringNo"success" or "error"
duration_msnumberNoTotal run duration in milliseconds.
total_cost_usdnumberNoTotal cost of all LLM calls in the run.

Asset attribution

Obsivara resolves asset_id in this order (first non-empty wins):

  1. asset_id field in the JSON body
  2. ?asset_id= query parameter
  3. X-Obsivara-Asset-Id request header
  4. "unknown" (fallback)
The run_id can be any string — Obsivara maps non-UUID values to a stable UUID automatically, so you can use your own IDs (order numbers, session IDs, etc.) without generating UUIDs.
Unknown event values are accepted (202) but stored as error rows. Spell event names exactly:run_started, llm_call, run_finished.

n8n alias

The endpoint /ingest/webhook/n8n is an alias for /ingest/webhook/generic — it accepts the same payload. See n8n integration → for a step-by-step guide with n8n expressions.

Next steps