> For the complete documentation index, see [llms.txt](https://docs.amigo.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.amigo.ai/api-reference/readme/platform/traces.md).

# Traces

## Export gen\_ai.\* + voice.\* traces as OTLP/JSON

> Export the workspace's durable trace spans over a time window as OpenTelemetry Protocol (OTLP/HTTP JSON) spans: \`\`gen\_ai.\*\`\` tool-call spans and the per-call voice-isolation \`\`voice.\*\`\` infra spans (allocate / media-attach / reap). Read-only; \`Audit:View\` permission required; dark behind \`\`OTEL\_TRACE\_EXPORT\_ENABLED\`\` (404 when off). Paginated PULL API — extract \`\`.resourceSpans\`\` before forwarding to an OTLP collector. Attributes are an allowlist of tool-call + infra metadata; the raw tool-result \`\`error\`\` text is NOT exported (PHI-safe by construction).

```json
{"openapi":"3.1.0","info":{"title":"Platform API","version":"1.0.0"},"servers":[{"url":"https://api.platform.amigo.ai","description":"Production"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","description":"API key issued via `POST /v1/{workspace_id}/api-keys`. Pass the returned `api_key` value as a Bearer token."}},"schemas":{"TracesExportRequest":{"properties":{"start_time":{"type":"string","format":"date-time","title":"Start Time","description":"Inclusive lower bound on span ``effective_at`` (ISO-8601)."},"end_time":{"type":"string","format":"date-time","title":"End Time","description":"Exclusive upper bound on span ``effective_at`` (ISO-8601)."},"limit":{"type":"integer","maximum":1000,"exclusiveMinimum":0,"title":"Limit","description":"Max spans per page (1-1000).","default":500},"continuation_token":{"title":"Continuation Token","description":"Opaque page cursor — round-trip the value from the previous response."}},"type":"object","required":["start_time","end_time"],"title":"TracesExportRequest"},"TracesExportResponse":{"properties":{"resourceSpans":{"items":{"$ref":"#/components/schemas/ResourceSpans"},"type":"array","title":"Resourcespans","description":"OTLP/JSON ``ResourceSpans`` envelope (empty list when no spans match)."},"has_more":{"type":"boolean","title":"Has More"},"continuation_token":{"title":"Continuation Token"}},"type":"object","required":["resourceSpans","has_more"],"title":"TracesExportResponse","description":"Paginated PULL response — NOT a bare OTLP ``ExportTraceServiceRequest``.\n\n``resourceSpans`` is OTLP/JSON-conformant; to forward to an OTLP collector,\nextract ``.resourceSpans`` and re-wrap as ``{\"resourceSpans\": [...]}`` (a\nstrict protojson push receiver rejects the ``has_more``/``continuation_token``\nsiblings). Round-trip ``continuation_token`` to page."},"ResourceSpans":{"properties":{"resource":{"$ref":"#/components/schemas/Resource"},"scopeSpans":{"items":{"$ref":"#/components/schemas/ScopeSpans"},"type":"array","title":"Scopespans"}},"type":"object","required":["resource","scopeSpans"],"title":"ResourceSpans"},"Resource":{"properties":{"attributes":{"items":{"$ref":"#/components/schemas/KeyValue"},"type":"array","title":"Attributes"}},"type":"object","required":["attributes"],"title":"Resource"},"KeyValue":{"properties":{"key":{"type":"string","title":"Key"},"value":{"$ref":"#/components/schemas/AnyValue"}},"type":"object","required":["key","value"],"title":"KeyValue","description":"OTLP ``KeyValue`` attribute pair."},"AnyValue":{"additionalProperties":true,"type":"object"},"ScopeSpans":{"properties":{"scope":{"$ref":"#/components/schemas/InstrumentationScope"},"spans":{"items":{"$ref":"#/components/schemas/Span"},"type":"array","title":"Spans"}},"type":"object","required":["scope","spans"],"title":"ScopeSpans"},"InstrumentationScope":{"properties":{"name":{"type":"string","title":"Name"},"version":{"type":"string","title":"Version"}},"type":"object","required":["name","version"],"title":"InstrumentationScope"},"Span":{"properties":{"traceId":{"type":"string","title":"Traceid"},"spanId":{"type":"string","title":"Spanid"},"name":{"type":"string","title":"Name"},"kind":{"type":"integer","title":"Kind"},"startTimeUnixNano":{"type":"string","title":"Starttimeunixnano"},"endTimeUnixNano":{"type":"string","title":"Endtimeunixnano"},"attributes":{"items":{"$ref":"#/components/schemas/KeyValue"},"type":"array","title":"Attributes"},"status":{"$ref":"#/components/schemas/Status"}},"type":"object","required":["traceId","spanId","name","kind","startTimeUnixNano","endTimeUnixNano","attributes","status"],"title":"Span","description":"OTLP ``Span`` in OTLP/JSON encoding (ids hex, timestamps decimal-string)."},"Status":{"properties":{"code":{"type":"integer","title":"Code"}},"type":"object","required":["code"],"title":"Status","description":"OTLP ``Status`` — 0=UNSET, 1=OK, 2=ERROR."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v1/{workspace_id}/traces:export":{"post":{"tags":["Traces"],"summary":"Export gen_ai.* + voice.* traces as OTLP/JSON","description":"Export the workspace's durable trace spans over a time window as OpenTelemetry Protocol (OTLP/HTTP JSON) spans: ``gen_ai.*`` tool-call spans and the per-call voice-isolation ``voice.*`` infra spans (allocate / media-attach / reap). Read-only; `Audit:View` permission required; dark behind ``OTEL_TRACE_EXPORT_ENABLED`` (404 when off). Paginated PULL API — extract ``.resourceSpans`` before forwarding to an OTLP collector. Attributes are an allowlist of tool-call + infra metadata; the raw tool-result ``error`` text is NOT exported (PHI-safe by construction).","operationId":"export_traces_v1__workspace_id__traces_export_post","parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Workspace Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TracesExportRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TracesExportResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.amigo.ai/api-reference/readme/platform/traces.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
