INGEST API

Send events over the TrafficWar ingest API.

Use the HTTP API when no official SDK fits. Capture accepts one event object, batch accepts a bare event array, and both authenticate with a service API key.

JSON batch request

Shell
curl https://ingest.trafficwar.tech/v1/server/batch \
  -H "Authorization: Bearer $TRAFFICWAR_API_KEY" \
  -H "Content-Type: application/json" \
  --data '[{"event":"http","label":"Health","path":"/health","http_method":"GET","latency_ms":3.4,"status_code":200,"distinct_id":"usr_7f3a91c2","properties":{"device_id":"dev_0198e743-a2c4-7c21"}}]'

Request behavior

  • Content-Type may be application/json or application/msgpack.
  • /capture accepts one event object; /batch accepts a bare array, not an object containing an events property.
  • A request may contain at most 10,000 events.
  • Plan quotas are hard all-or-nothing limits; a rejected batch is not partially charged.
  • HTTP 200 is returned only after the ClickHouse insert succeeds.

Choose server or web routes deliberately

Trusted runtimes should use /v1/server/capture or /v1/server/batch. Browser routes are subject to the service CORS allowlist and should use credentials intended for that browser integration.

Declare instrumentation before traffic

POST /v1/server/catalog registers fixed event/label pairs and optional source, span_kind, and operation_type metadata using the service Bearer key. The Node SDK uploads a complete startup source catalog automatically. This list populates idle SpaceWar stations and event/label selects without generating events or latency samples.

Each registration replaces that service’s stored list and deletes pairs missing from the upload, with at most 4,000 declarations. A repeated identical list changes nothing. Set station_known to false when station metadata cannot be resolved; the event/label choices remain available but the map waits for real traffic. GET /v1/server/catalog reads the key’s service catalog; the panel reads GET /panel/api/catalog?service=<service_id> with an owned session.

JSON declaration body
{"captures":[{"event":"http","label":"Checkout","source":"backend-a","span_kind":"server","operation_type":"route.handler","station_known":true}]}