Tensile Docs

POST /capture-events

Send up to 500 events in one request and inspect acceptance or rejection for each event.

Watch the workflow: Inspect a recorded tool failure · Authored dummy data

See how stored demo events can be inspected in Raw Logs. This clip does not execute the request examples or verify a live API response. Filter authored requests, inspect one failed tool call and read its recorded timeout. An event failure does not establish a customer outcome.

Read matching command examples.

Read the walkthrough transcript
  • 00:00 — Filter the loaded requests to Failed. These are authored demo events.
  • 00:05 — Inspect one failed tool call. Its identity and latency remain visible.
  • 00:10 — Read the recorded timeout. An event failure is separate from a customer outcome.

Send a batch of events with one request. Each event uses the same fields as POST /capture-event. Tensile reports each row's outcome so you can retry rejected events without resending accepted ones.

POST https://api.withtensile.com/api/v1/capture-events

After a batch capture, filter the recorded events and inspect one failure in Raw Logs. These examples do not run the commands or verify a live SDK/API response. See the command examples.

Headers

HeaderValueRequired
x-api-keyYour ingestion API keyYes
Content-Typeapplication/jsonYes

Body

The body contains an events array. Each event must include event_id and session_id; other event fields are described in the single-event reference.

{
  "events": [
    {
      "event_id": "b1d7a2f4-8c60-4e21-9f3a-1c2d3e4f5a6b",
      "session_id": "6f9c1b8e-3d2a-4a1f-9c7b-2e5d0a4b1c33",
      "timestamp": 1712345678901,
      "primitive_name": "support-bot",
      "primitive_type": "PRIMITIVE_TYPE_AGENT_TURN",
      "args": "How do I reset my password?",
      "result": "Open Settings, then choose Reset password."
    },
    {
      "event_id": "d9e0c1a2-7b34-4f56-8a9b-0c1d2e3f4a5b",
      "session_id": "6f9c1b8e-3d2a-4a1f-9c7b-2e5d0a4b1c33",
      "timestamp": 1712345678901,
      "primitive_name": "knowledge_search",
      "primitive_type": "PRIMITIVE_TYPE_TOOL",
      "parent_id": "b1d7a2f4-8c60-4e21-9f3a-1c2d3e4f5a6b",
      "args": "{\"query\": \"password reset\"}",
      "result": "{\"hits\": 3}"
    }
  ]
}

Request

Save the example body above as tensile-events.json. Replace the example IDs and timestamps with those for your own events. Load TENSILE_API_KEY from your server-side secret store.

curl --fail --silent --show-error \
  https://api.withtensile.com/api/v1/capture-events \
  -H "x-api-key: $TENSILE_API_KEY" \
  -H "Content-Type: application/json" \
  --data @tensile-events.json

A 202 response confirms acceptance into the ingestion buffer. Verify stored arrival in Raw Logs. It does not prove that every downstream worker processed an event.

Response

A valid batch request returns HTTP 202 Accepted. The response includes totals and a result for every input row. index is zero-based and refers to the row in events.

{
  "accepted": 2,
  "rejected": 0,
  "results": [
    {
      "index": 0,
      "event_id": "b1d7a2f4-8c60-4e21-9f3a-1c2d3e4f5a6b",
      "status": "accepted",
      "reason": ""
    },
    {
      "index": 1,
      "event_id": "d9e0c1a2-7b34-4f56-8a9b-0c1d2e3f4a5b",
      "status": "accepted",
      "reason": ""
    }
  ]
}

For a rejected row, status is rejected and reason explains the failure (for example, session_id is required). Retry only rejected rows after addressing their reason. A temporary enqueue failure includes a Retry-After header; accepted rows should not be sent again.

Errors

  • More than 500 events returns HTTP 400 for the whole request.
  • Missing or invalid API key returns HTTP 401.
  • Invalid JSON or a request body that is too large is rejected before processing rows.

On this page