Reference
Trace drains
A drain sends every batch your workspace accepts to an HTTPS endpoint you run. A Webhook drain signs each request. An OTLP/HTTP JSON drain forwards an unsigned OpenTelemetry ExportTraceServiceRequest. Drains are part of the Pro plan and included in Enterprise.
Add a drain
Open Settings and add the address under Trace drains. Choose Webhook (signed) or OTLP/HTTP JSON under Drain type. Workspace owners and admins manage drains. A webhook drain's signing secret is shown once, when it is created. An OTLP drain has no signature and no secret.
- Up to 3 drains per workspace. Adding a fourth is refused until you delete one.
- Every environment. A drain receives accepted batches from all environments of the workspace; each delivery names its environment.
- Send test posts a signed
drain.testevent for a webhook drain, or a single-span OTLP request for an OTLP drain, so you can check your receiver. - Delete removes the drain and discards what it still had queued. Stored traces are unchanged.
- Pro and Enterprise only. Creating, testing, flushing and delivering need the
trace_drainsentitlement. If the workspace moves to a lower plan, listing and deleting still work, and queued deliveries are not sent and expire after 3 days.
Drain types
Both kinds use the same address checks, TLS pinning, no-redirect rule, retry schedule, queue limit and deadline. Settings labels each drain with its kind.
- Webhook (signed). A
POSTof the batch body below, withX-Supatrace-Signature,X-Supatrace-EventandX-Supatrace-Deliveryheaders. - OTLP/HTTP JSON. An unsigned
POSTwithContent-Type: application/jsonand an OpenTelemetryExportTraceServiceRequestbody. Point it at your collector's OTLP/HTTP traces path, usually/v1/traces. There is no signature and no authorization header you can set. The signing secret returned at creation is not used. Use an endpoint that accepts this transport.
Which addresses are accepted
The endpoint must be a public https:// address with a host name and the default port.
- Public HTTPS only. IP addresses, single-label names, internal suffixes and addresses that resolve to private, loopback, link-local or other reserved ranges are refused.
- No credentials or fragments, and no port other than 443.
- Resolved and pinned. The host is resolved before delivery. Every resolved address must be public, and the request connects to the checked address, so a second DNS answer cannot redirect it.
- Redirects are not followed. A
3xxanswer counts as a failed attempt.
What a webhook drain delivers
One POST per accepted batch, with Content-Type: application/json. The request carries X-Supatrace-Event: batch.accepted, X-Supatrace-Delivery and X-Supatrace-Signature.
{
"id": "5f1c0e…",
"type": "batch.accepted",
"created_at": "2026-11-14T20:00:00.000Z",
"workspace_id": "…",
"project_id": "proj_…",
"environment_id": "default",
"batch_id": "…",
"run_id": "…",
"request_hash": "…",
"event_count": 2,
"byte_count": 412,
"batch": {"version": 1, "batch_id": "…", "run_id": "…", "events": []}
}batch is the stored batch, up to 512 KiB. It can contain prompts, tool output and secrets, exactly as uploaded. id is the same on every retry of one delivery; use it to ignore duplicates.
What an OTLP drain delivers
Choose OTLP/HTTP JSON under Drain type in Settings, or send an explicit "kind": "otlp" field on POST /api/drains. Omitting kind keeps the signed webhook format.
One ExportTraceServiceRequest per accepted batch, encoded as OTLP/HTTP JSON. Spans that came in through the OTLP receiver keep their original trace id, span id, parent, resource, scope, name, nanosecond times and stored attributes. A SupaTrace event that did not come from OpenTelemetry has no OTLP ids, so the drain derives them deterministically:
- Trace id: the first 32 hex characters of
sha256("supatrace:trace:" + batch.run_id), forced non-zero. - Span id: the first 16 hex characters of
sha256("supatrace:span:" + event.id), forced non-zero. - Start time:
Date.parse(event.time) * 1_000_000nanoseconds, at least1. - End time: the start time, because a SupaTrace event is a point in time.
- Attributes: the event id, kind and data are stored under the
supatraceattribute keys, as JSON text.
The payload looks like this (values abbreviated):
{
"resourceSpans": [
{
"scopeSpans": [
{
"scope": {"name": "SupaTrace"},
"spans": [
{
"traceId": "4f3f3fd8812d8fb48b3c3c27b10fd766",
"spanId": "148ef2cee3722967",
"name": "synthetic 1",
"kind": 1,
"startTimeUnixNano": "1794614401000000000",
"endTimeUnixNano": "1794614401000000000",
"attributes": [
{"key": "supatrace.event.id", "value": {"stringValue": "e1"}},
{"key": "supatrace.event.kind", "value": {"stringValue": "note"}},
{"key": "supatrace.event.data", "value": {"stringValue": "{\"n\":1}"}}
]
}
]
}
]
}
]
}Intake truncation still applies: clipped binary attributes become strings containing the clipped base64 text and ellipsis. If clipped attribute keys collide, the first value is retained. Intact binary attributes stay binary. Malformed user-supplied OTLP metadata falls back to the ordinary deterministic SupaTrace event mapping.
For HTTP 4xx and 5xx responses, OTLP retries only 429, 502, 503 and 504; other responses in those ranges are removed and counted as failed immediately. Network failures retry. A valid Retry-After delay (seconds or HTTP date) extends the usual backoff, up to the 3-day queue age limit. Explicit flush overrides the pause. POST /api/drains/test sends an OTLP test span; POST /api/drains/flush attempts queued exports. Listing a drain returns its kind.
The create response carries a legacy secret field that OTLP does not use. Settings does not show it.
Verify a webhook signature
Each webhook request carries X-Supatrace-Signature: t=<unix seconds>,v1=<hex>. The value of v1 is the HMAC-SHA256 of <t>.<raw request body> with the signing secret. Compare in constant time and reject a timestamp more than 300 seconds away from your clock.
POST /supatrace-hook HTTP/1.1
Host: hooks.example.com
Content-Type: application/json
X-Supatrace-Event: batch.accepted
X-Supatrace-Delivery: 5f1c0e…
X-Supatrace-Signature: t=<unix seconds>,v1=<hex>
{"type":"batch.accepted"}Treat the signing secret like an API key. It is shown once. If it leaks, delete the drain and add it again.
Delivery and retries
- Retried, not guaranteed. A delivery is queued once its batch is accepted, before the upload is answered. A failing endpoint never fails an upload.
- 2xx within 3 seconds removes the queued delivery. Anything else counts as a failed attempt.
- Possibly more than once. The same delivery can arrive twice, for example when your
2xxis lost. Useidto ignore repeats. - When attempts happen. Queued deliveries are attempted right after uploads to the workspace, oldest first, and when you press Deliver queued now. There is no background scheduler: if uploads stop, queued deliveries wait for the next upload or the button.
- Failures pause the drain for 30 seconds, then 1, 5, 15 and 60 minutes, so a dead endpoint does not slow uploads.
- Given up after 8 failed attempts or 3 days. The delivery is removed and counted as failed; the batch itself stays stored and exportable.
- Queue limit. Up to 500 queued deliveries per drain. A batch accepted while the queue is full is not delivered to that drain. It is counted as dropped, once.
- Uploads can take longer. An upload may spend up to about 8 seconds attempting deliveries before it answers; whatever is unfinished stays queued.
Not available yet
- Drains to an S3 bucket or Datadog.
- A custom authorization header or other per-drain credentials.
- Background retries on a schedule, a per-delivery log and replay of failed deliveries.
- Per-project or per-environment drains, event filters and secret rotation (delete and add the drain again).
See Management API and Limits.