metrics
Ingest metric samples for evaluation. Each sample targets a router via router_id. GZIP compression: Supported via Content-Encoding: gzip header. When using GZIP, compute the HMAC signature on the compressed (wire) bytes, not the uncompressed JSON. Flow: serialize JSON → gzip compress → compute HMAC on compressed bytes → send.
POST
/v1/projects/:project_id/ingest
Ingest metric samples
Auth:
HMAC signature (X-EB-Timestamp and X-EB-Signature headers). When using GZIP, sign the compressed bytes.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
project_id |
path | uuid | Yes | Project ID |
Request Body
samples
*
sample_fields
Responses
202
Samples accepted
accepted
400
Invalid payload
401
Invalid HMAC signature
413
Batch too large (max 1000 samples)
422
Validation error (invalid_router_id, invalid_metric, invalid_ts_ms, ts_ms_too_old, ts_ms_in_future, invalid_ok)
429
Rate limited (check Retry-After header)
Headers:
Retry-After: Seconds to wait before retrying
Example
Request
curl -X POST https://api.tripswitch.dev/v1/projects/PROJECT_ID/ingest \
-H "X-EB-Timestamp: 1705312200000" \
-H "X-EB-Signature: HMAC_SIGNATURE" \
-H "Content-Type: application/json" \
-d '[
{"router_id": "550e8400-e29b-41d4-a716-446655440000", "metric": "api.latency_ms", "ts_ms": 1705312200000, "value": 245.5, "ok": true},
{"router_id": "550e8400-e29b-41d4-a716-446655440000", "metric": "api.latency_ms", "ts_ms": 1705312201000, "value": 312.0, "ok": true, "tags": {"endpoint": "/users"}}
]'
Response
{
"accepted": 2
}