Ratel Docs
ReferenceHTTP API

Telemetry

Send OTLP traces, OTLP logs and runtime events to the Ratel Platform.

Three endpoints take telemetry. For exporter setup, see OpenTelemetry.

POST /v1/traces

Stores OpenTelemetry spans and turns the LLM calls in them into dashboard data.

  • Method and path: POST /v1/traces (alias /api/v1/traces)
  • Auth: bearer API key with ingest:traces

Request

A standard OTLP ExportTraceServiceRequest over HTTP. gRPC is not supported.

HeaderValues
Content-Typeapplication/x-protobuf or application/json. application/octet-stream or no type is read as protobuf.
Content-EncodingOptional: gzip, x-gzip or deflate.

Limits: 4 MB per body, 16 MB once decompressed, 5,000 spans per export.

curl -s https://cloud.ratel.sh/v1/traces \
  -H "Authorization: Bearer $RATEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "resourceSpans": [{ "scopeSpans": [{ "spans": [{
        "traceId": "0123456789abcdef0123456789abcdef", "spanId": "0123456789abcdef",
        "name": "chat gpt-4o", "kind": 3,
        "startTimeUnixNano": "1751800000000000000", "endTimeUnixNano": "1751800001200000000",
        "attributes": [
          { "key": "gen_ai.operation.name", "value": { "stringValue": "chat" } },
          { "key": "gen_ai.request.model", "value": { "stringValue": "gpt-4o" } },
          { "key": "gen_ai.usage.input_tokens", "value": { "intValue": "1200" } },
          { "key": "gen_ai.usage.output_tokens", "value": { "intValue": "80" } }
        ] }] }] }] }'

Response

202 Accepted. A JSON request gets the counts as JSON:

{ "accepted": 1, "calls": 1, "spans": 1 }
  • spans: spans decoded from the export.
  • calls: LLM calls found in them.
  • accepted: calls newly stored. Only these count toward the plan's monthly event limit.

A protobuf request gets an empty protobuf body. Both carry the counts as x-ratel-accepted, x-ratel-calls and x-ratel-spans headers.

Errors

StatusCause
400Malformed OTLP payload or malformed compressed body.
401Missing, invalid, revoked or expired key.
403The key does not have ingest:traces.
413Body over 4 MB, over 16 MB decompressed, or more than 5,000 spans.
415Content-Type is not protobuf or JSON, or Content-Encoding is not gzip or deflate.
429The plan's monthly event limit is reached. No Retry-After: upgrade in Billing. An ingest-only key over its budget also gets 429, with Retry-After.
500The Platform failed to store the spans. Retry.
503The database is not configured.

POST /v1/logs

Stores OpenTelemetry log records that the Ratel SDK and GenAI instrumentations emit.

  • Method and path: POST /v1/logs (alias /api/v1/logs)
  • Auth: bearer API key with ingest:logs

Request

A standard OTLP ExportLogsServiceRequest, with the same content types, encodings and size limit as /v1/traces. Up to 5,000 log records per export.

The Platform keeps two kinds of record and drops every other one:

  • Every event whose name starts with ratel..
  • The GenAI message events: gen_ai.client.inference.operation.details, gen_ai.system.message, gen_ai.user.message, gen_ai.assistant.message, gen_ai.tool.message and gen_ai.choice.

The event name comes from the record's eventName, or else its event.name attribute. Log records do not count toward the monthly event limit.

curl -s https://cloud.ratel.sh/v1/logs \
  -H "Authorization: Bearer $RATEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "resourceLogs": [{ "scopeLogs": [{ "logRecords": [{
        "timeUnixNano": "1751800000000000000",
        "eventName": "ratel.search",
        "attributes": [
          { "key": "ratel.search.query", "value": { "stringValue": "leave a note on the task" } }
        ] }] }] }] }'

Response

202 Accepted:

{ "accepted": 1, "records": 1, "dropped": 0 }
  • records: log records decoded.
  • dropped: records not kept, because of their event name.
  • accepted: records stored.

A protobuf request gets an empty protobuf body and the same x-ratel-* count headers.

Errors

Same as /v1/traces, with ingest:logs for 403 and 5,000 log records for 413. There is no monthly-limit 429.

POST /api/v1/events

Stores typed runtime events from the Ratel SDK and runtimes: searches, invokes, errors and ranking status.

  • Method and path: POST /api/v1/events. There is no /v1/events alias.
  • Auth: bearer API key with ingest:events

Request

Content-Type: application/json, body { "events": [...] }. Up to 4 MB, 5,000 events, and 64 KB per event.

Each event is one flat object:

FieldTypeNotes
vintegerEnvelope version.
tsnumberEpoch milliseconds. Seconds are accepted.
session_idstringRequired.
typestringFor example search, skill_search, invoke_start, invoke_end, invoke_error, usage_ranking_status.
event_idstringIdempotency key. Required when v is 2 or more.
source_idstringThe runtime that sent it. Required when v is 2 or more.

Other fields depend on type, for example query and hits on search. An event of a known type that fails its schema is rejected. An event of an unknown type is stored as is.

curl -s https://cloud.ratel.sh/api/v1/events \
  -H "Authorization: Bearer $RATEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "events": [{
        "v": 2, "ts": 1751800000000, "type": "search",
        "session_id": "sess-1", "event_id": "evt-1", "source_id": "my-agent",
        "query": "leave a note on the task", "top_k": 3,
        "hits": [{ "tool_id": "add_task_comment", "score": 0.91 }]
      }] }'

Response

202 Accepted. A bad event never fails the batch:

{
  "accepted": 1,
  "duplicates": 0,
  "rejected": []
}
  • duplicates: valid events already stored under the same event_id.
  • rejected: one entry per invalid event, { "index", "event_id", "reason" }.

Runtime events do not count toward the monthly event limit.

Errors

StatusCause
400The body is not JSON, or has no events array.
401Missing, invalid, revoked or expired key.
403The key does not have ingest:events.
413Body over 4 MB, or more than 5,000 events.
415Content-Type is not application/json.
429Over 120 requests a minute for this key (bursts up to 240), or an ingest-only key over its shared budget. Carries Retry-After.
500The Platform failed to store the events. Retry.

On this page