Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.cerca.dev/llms.txt

Use this file to discover all available pages before exploring further.

This page lists every webhook event Cerca emits, with the payload shape and a representative JSON example. For the delivery model, signing, and retry semantics, see Webhooks. For the receive path, see Receiving webhooks.

Envelope

Every delivery shares the same outer shape. The event-specific payload lives under data; everything else identifies which agent, fleet, and thread the event belongs to.
FieldTypeDescription
idstringStable ID for this event. Mirrors the X-Agent-Delivery-Id header and is the right key to dedupe on.
eventstringThe event type, e.g. thread.completed. Mirrors X-Agent-Event.
timestampstringISO 8601 timestamp the event was generated at.
agentIdstringAgent the event belongs to.
orgIdstringOrganization that owns the agent.
fleetIdstringFleet the subscription is scoped to.
threadIdstring | nullThread the event belongs to, if any. null for agent- and connection-level events.
dataobjectEvent-specific payload. See sections below.
{
  "id": "evt_01HZX9F4G2N3K7B0Q1WVYE6T8M",
  "event": "thread.completed",
  "timestamp": "2026-05-04T12:00:00.000Z",
  "agentId": "agent_abc123",
  "orgId": "org_acme",
  "fleetId": "fleet_internal_ops",
  "threadId": "thread_xyz789",
  "data": {
    "status": "idle",
    "previousStatus": "running",
    "result": "Booked the flight and emailed the itinerary."
  }
}

Agent

agent.created

Fired when a new agent is provisioned in the fleet.
FieldTypeDescription
agentAgentThe full agent record, minus internal-only fields.
{
  "agent": {
    "id": "agent_abc123",
    "userId": "user_carol",
    "orgId": "org_acme",
    "fleetId": "fleet_internal_ops",
    "configuration": {
      "model": "claude-sonnet-4-5",
      "instructions": "You are a research assistant.",
      "tools": []
    },
    "metadata": { "team": "research" },
    "createdAt": "2026-05-04T12:00:00.000Z",
    "updatedAt": "2026-05-04T12:00:00.000Z"
  }
}

agent.updated

Fired when an agent’s configuration or metadata changes. trigger distinguishes the two so you can decide whether to invalidate cached config.
FieldTypeDescription
trigger"configuration" | "metadata"Which kind of change triggered the event.
agentAgentThe agent record after the update.
{
  "trigger": "configuration",
  "agent": {
    "id": "agent_abc123",
    "userId": "user_carol",
    "orgId": "org_acme",
    "fleetId": "fleet_internal_ops",
    "configuration": {
      "model": "claude-sonnet-4-5",
      "instructions": "You are a research assistant. Cite your sources.",
      "tools": []
    },
    "metadata": { "team": "research" },
    "createdAt": "2026-05-04T12:00:00.000Z",
    "updatedAt": "2026-05-04T12:05:00.000Z"
  }
}

agent.deleted

Fired when an agent is deleted. The agent record is no longer retrievable, so only the ID is included.
FieldTypeDescription
agentIdstringThe deleted agent’s ID.
{
  "agentId": "agent_abc123"
}

Thread

Thread status values are "idle", "running", "awaiting", or "closed".

thread.created

Fired when a new thread starts on an agent. The threadId is on the envelope.
FieldTypeDescription
messagestringThe user message that opened the thread.
modelstringModel the thread was created against.
{
  "message": "Plan a three-day trip to Lisbon.",
  "model": "claude-sonnet-4-5"
}

thread.status.changed

Fired on every thread status transition. Use this when you want to track every state change; use thread.completed and thread.failed if you only care about runs that finished.
FieldTypeDescription
statusThreadStatusThe new status.
previousStatusThreadStatusThe status before the transition.
resultstring | nullFinal result if the thread is closing successfully.
errorstring | nullError message if the thread is failing.
{
  "status": "awaiting",
  "previousStatus": "running",
  "result": null,
  "error": null
}

thread.completed

Fired when a running or awaiting thread settles back to idle with a result. A thread can complete multiple times over its lifetime — once per run that finishes successfully. Always paired with a thread.status.changed event for the same transition.
FieldTypeDescription
statusThreadStatusCurrently always "idle" at runtime, but the contract is typed as the full ThreadStatus union — don’t write a typed handler that asserts the literal "idle".
previousStatusThreadStatusThe status before the transition ("running" or "awaiting").
resultstringThe run’s final result.
{
  "status": "idle",
  "previousStatus": "running",
  "result": "Booked the flight and emailed the itinerary."
}

thread.failed

Fired when a running or awaiting thread settles back to idle with an error. Like thread.completed, this can fire more than once over a thread’s lifetime.
FieldTypeDescription
statusThreadStatusCurrently always "idle" at runtime, but the contract is typed as the full ThreadStatus union — don’t write a typed handler that asserts the literal "idle".
previousStatusThreadStatusThe status before the transition ("running" or "awaiting").
errorstringThe error message.
{
  "status": "idle",
  "previousStatus": "running",
  "error": "Tool call exceeded retry budget: search_flights"
}

Turn

A turn is one user-message-and-response exchange inside a thread.

turn.created

Fired when a new turn starts. seq orders turns within a thread.
FieldTypeDescription
turnIdstringThe new turn’s ID.
seqnumberMonotonic sequence number within the thread.
messagestringThe user message that opened this turn.
startedAtstringISO 8601 timestamp the turn started.
{
  "turnId": "turn_01HZX9F4G2N3K7B0Q1WVYE6T8M",
  "seq": 3,
  "message": "Now book the cheapest of the three.",
  "startedAt": "2026-05-04T12:00:00.000Z"
}

turn.completed

Fired when a turn finishes successfully.
FieldTypeDescription
turnIdstringThe turn’s ID.
seqnumberSequence number within the thread.
status"completed"Always "completed" for this event.
resultstring | nullThe turn’s result text, if any.
errorstring | nullAlways null for completed turns; included for shape parity with turn.failed.
tokenUsageTokenUsage | nullInput and output token counts, when available.
completedAtstringISO 8601 timestamp the turn finished.
{
  "turnId": "turn_01HZX9F4G2N3K7B0Q1WVYE6T8M",
  "seq": 3,
  "status": "completed",
  "result": "Booked TAP flight TP202 for $312.",
  "error": null,
  "tokenUsage": {
    "inputTokens": 1842,
    "outputTokens": 256
  },
  "completedAt": "2026-05-04T12:00:08.000Z"
}

turn.failed

Fired when a turn ends in failure. Same shape as turn.completed with a "failed" status and a populated error.
FieldTypeDescription
turnIdstringThe turn’s ID.
seqnumberSequence number within the thread.
status"failed"Always "failed" for this event.
resultstring | nullPartial result, if any.
errorstring | nullError message describing the failure.
tokenUsageTokenUsage | nullToken usage up to the point of failure.
completedAtstringISO 8601 timestamp the turn ended.
{
  "turnId": "turn_01HZX9F4G2N3K7B0Q1WVYE6T8M",
  "seq": 3,
  "status": "failed",
  "result": null,
  "error": "Tool call exceeded retry budget: book_flight",
  "tokenUsage": {
    "inputTokens": 1842,
    "outputTokens": 64
  },
  "completedAt": "2026-05-04T12:00:08.000Z"
}

Message

message.created

Fired when a new user or assistant message is appended to a thread. Tool messages and intermediate assistant content do not fire this event — use thread streaming for the full transcript. The message body is not included in this payload. You only get the role and metadata; to read what was actually said, fetch the message via the API or subscribe to thread streaming.
FieldTypeDescription
turnIdstring | nullTurn the message belongs to, if any.
seqnumberMonotonic sequence number within the thread.
role"user" | "assistant"Who authored the message.
createdAtstringISO 8601 timestamp the message was created.
{
  "turnId": "turn_01HZX9F4G2N3K7B0Q1WVYE6T8M",
  "seq": 7,
  "role": "assistant",
  "createdAt": "2026-05-04T12:00:08.000Z"
}

Approval

approval.requested

Fired when a tool call requires human approval before running. Surface the approval to a human and resolve it via the API; the resolution drives an approval.resolved event.
FieldTypeDescription
approvalPublicWebhookApprovalRequestThe approval request, including tool, input, and timeout.
{
  "approval": {
    "id": "approval_01HZX9F4G2N3K7B0Q1WVYE6T8M",
    "threadId": "thread_xyz789",
    "turnId": "turn_01HZX9F4G2N3K7B0Q1WVYE6T8M",
    "toolName": "book_flight",
    "runtimeToolName": "book_flight",
    "input": {
      "carrier": "TAP",
      "flightNumber": "TP202",
      "priceUsd": 312
    },
    "toolUseId": "toolu_01ABC",
    "toolIndex": 0,
    "status": "pending",
    "timeoutMs": 3600000,
    "timeoutAt": "2026-05-04T13:00:00.000Z",
    "createdAt": "2026-05-04T12:00:00.000Z",
    "resolvedAt": null
  }
}

approval.resolved

Fired when an approval reaches a terminal state — approved by a human, denied, timed out, or cancelled because the thread moved on.
FieldTypeDescription
approvalIdstringID of the resolved approval.
decision"approved" | "denied" | "timed_out" | "cancelled"How the approval was resolved.
{
  "approvalId": "approval_01HZX9F4G2N3K7B0Q1WVYE6T8M",
  "decision": "approved"
}

approval.granted

Fired when a user grants standing approval for a tool, scoped to either a single thread or the whole agent. Subsequent calls to that tool within the scope skip the approval step.
FieldTypeDescription
scope"thread" | "agent"Scope the grant applies to.
toolNamestringTool the grant covers.
threadId?stringThread the grant applies to, when scope is "thread".
grantIdstringID of the new grant.
{
  "scope": "thread",
  "toolName": "book_flight",
  "threadId": "thread_xyz789",
  "grantId": "grant_01HZX9F4G2N3K7B0Q1WVYE6T8M"
}

Schedule

schedule.created

Fired when an agent creates a schedule via the agent.schedule.* namespace.
FieldTypeDescription
scheduleIdstringThe new schedule’s ID.
namestringHuman-readable name.
cron?stringCron expression, when the schedule is recurring.
runAt?stringISO 8601 timestamp, when the schedule is one-shot.
{
  "scheduleId": "sched_01HZX9F4G2N3K7B0Q1WVYE6T8M",
  "name": "Weekly research digest",
  "cron": "0 9 * * MON"
}

schedule.deleted

Fired when a schedule is removed.
FieldTypeDescription
scheduleIdstringThe removed schedule’s ID.
{
  "scheduleId": "sched_01HZX9F4G2N3K7B0Q1WVYE6T8M"
}

schedule.triggered

Fired when a schedule fires and starts a thread. The new thread’s ID is in the payload; the envelope’s threadId also points at it.
FieldTypeDescription
scheduleIdstringSchedule that fired.
threadIdstringThread the schedule started.
{
  "scheduleId": "sched_01HZX9F4G2N3K7B0Q1WVYE6T8M",
  "threadId": "thread_xyz789"
}

Connection

connection.attached

Fired when a connection is attached to an agent. Pair this with connection.detached to keep your own view of which integrations the agent currently has.
FieldTypeDescription
connectionIdstringConnection that was attached.
providerstringProvider identifier, e.g. "google" or "slack".
{
  "connectionId": "conn_01HZX9F4G2N3K7B0Q1WVYE6T8M",
  "provider": "google"
}

connection.detached

Fired when a connection is removed from an agent.
FieldTypeDescription
connectionIdstringConnection that was detached.
providerstringProvider identifier.
{
  "connectionId": "conn_01HZX9F4G2N3K7B0Q1WVYE6T8M",
  "provider": "google"
}

Test

webhook.test

Synthetic event fired only by POST /fleets/{fleetId}/webhooks/{id}/test. The payload data is always {}. This event is not subscribable — you cannot include "webhook.test" in a subscription’s events array on create or update — and it does not appear in ALL_WEBHOOK_EVENT_TYPES. Treat it as a probe for verifying the receive path; ignore unknown event types in your handler so a future test event does not fail closed.
{}