POST /v1/ingest
Ingest telemetry data (traces and metrics) into Anyway.
For most use cases, use the Python SDK which handles batching, retries, and serialization automatically.
Request
curl -X POST https://api.anyway.sh/v1/ingest \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"traces": [...],
"metrics": [...]
}'
Request Body
Array of trace objects to ingest.
Array of metric objects to ingest.
Trace Object
Unique identifier for the trace (32 hex characters).
Array of span objects within this trace.
Span Object
Unique identifier for the span (16 hex characters).
Parent span ID for nested spans.
ISO 8601 timestamp of when the span started.
ISO 8601 timestamp of when the span ended.
Key-value pairs of span attributes.
Span status (code and message).
Example Request
{
"traces": [
{
"trace_id": "4bf92f3577b34da6a3ce929d0e0e4736",
"spans": [
{
"span_id": "00f067aa0ba902b7",
"name": "openai.chat.completions",
"start_time": "2024-01-15T10:30:00.000Z",
"end_time": "2024-01-15T10:30:01.234Z",
"attributes": {
"llm.vendor": "openai",
"llm.model": "gpt-4",
"llm.tokens.input": 150,
"llm.tokens.output": 200,
"llm.cost": 0.0135
},
"status": {
"code": "OK"
}
}
]
}
]
}
Response
Number of traces received.
Number of spans received.
Number of metrics received.
{
"data": {
"traces_received": 1,
"spans_received": 1,
"metrics_received": 0
},
"meta": {
"request_id": "req_abc123",
"timestamp": "2024-01-15T10:30:02Z"
}
}
Errors
| Code | Description |
|---|
invalid_request | Request body is malformed |
invalid_trace | Trace object is invalid |
quota_exceeded | Monthly trace quota exceeded |