---
title: "Get GenAI span details for a specific trace."
method: GET
path: "/otel/genai/traces/{project_id}/{trace_id}"
tags: ["GenAI"]
---

# Get GenAI span details for a specific trace.

`GET /otel/genai/traces/{project_id}/{trace_id}`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/otel/genai/traces/{project_id}/{trace_id}`
- Auth: HTTP bearer

`duration_ms` is the only field guaranteed to be milliseconds. `gen_ai.*`
span attributes (e.g. time-to-first-token, token latency) often follow the
OTel GenAI semantic conventions, which use **seconds** (a fractional
double), not milliseconds — do not read them as ms without converting.

## Path parameters

- `project_id` integer, required
- `trace_id` string, required

## Query parameters

- `start_time` string
- `end_time` string

## Response `200`

GenAI trace span details

- GenAiTraceDetailResponse
  - `event_count` integer, required
  - `events` GenAiEvent[], required
    - `attributes` object, required: All event attributes.
    - `event_name` string, required
    - `span_id` string, required
    - `timestamp` string, date-time, required
    - `trace_id` string, required
  - `span_count` integer, required
  - `spans` GenAiSpanDetail[], required
    - `agent_description` string, nullable: Agent description from `gen_ai.agent.description`.
    - `agent_id` string, nullable: Agent identifier from `gen_ai.agent.id`.
    - `agent_name` string, nullable: Agent name from `gen_ai.agent.name`.
    - `agent_version` string, nullable: Agent version from `gen_ai.agent.version`.
    - `attributes` object, required: All span attributes for extensibility.
    - `aws_bedrock_guardrail_id` string, nullable: AWS Bedrock guardrail ID from `aws.bedrock.guardrail.id`.
    - `aws_bedrock_knowledge_base_id` string, nullable: AWS Bedrock knowledge base ID from `aws.bedrock.knowledge_base.id`.
    - `azure_resource_provider_namespace` string, nullable: Azure resource provider namespace from `azure.resource_provider.namespace`.
    - `cache_creation_input_tokens` integer, nullable: Tokens written to provider cache from `gen_ai.usage.cache_creation.input_tokens`.
    - `cache_read_input_tokens` integer, nullable: Tokens served from provider cache from `gen_ai.usage.cache_read.input_tokens`.
    - `conversation_id` string, nullable: Unique conversation/session/thread ID from `gen_ai.conversation.id`.
    - `data_source_id` string, nullable: Data source identifier from `gen_ai.data_source.id`.
    - `duration_ms` number, double, required
    - `embeddings_dimension_count` integer, nullable: Output embedding dimensions from `gen_ai.embeddings.dimension.count`.
    - `error_type` string, nullable: Error type from `error.type` when the span status is ERROR.
    - `gen_ai_model` string, nullable: The requested model from `gen_ai.request.model`.
    - `gen_ai_operation` string, nullable: The operation type from `gen_ai.operation.name` (e.g. "chat", "embeddings", "execute_tool").
    - `gen_ai_response_model` string, nullable: The model that actually generated the response from `gen_ai.response.model`.
    - `gen_ai_system` string, nullable: The GenAI provider from `gen_ai.provider.name` (falls back to deprecated `gen_ai.system`).
    - `input_messages` string, nullable: Chat history input from `gen_ai.input.messages` (opt-in, JSON string).
    - `input_tokens` integer, nullable
    - `kind` 'UNSPECIFIED' | 'INTERNAL' | 'SERVER' | 'CLIENT' | 'PRODUCER' | 'CONSUMER', required: Span kind.
    - `name` string, required
    - `openai_api_type` string, nullable: OpenAI API type from `openai.api.type` (chat_completions, responses).
    - `openai_request_service_tier` string, nullable: Requested service tier from `openai.request.service_tier`.
    - `openai_response_service_tier` string, nullable: Actual service tier from `openai.response.service_tier`.
    - `openai_system_fingerprint` string, nullable: System fingerprint from `openai.response.system_fingerprint`.
    - `output_messages` string, nullable: Model output from `gen_ai.output.messages` (opt-in, JSON string).
    - `output_tokens` integer, nullable
    - `output_type` string, nullable: Output content type from `gen_ai.output.type` (text, json, image, speech).
    - `parent_span_id` string, nullable
    - `request_choice_count` integer, nullable: Number of choices requested from `gen_ai.request.choice.count`.
    - `request_encoding_formats` string[], nullable: Requested encoding formats from `gen_ai.request.encoding_formats`.
    - `request_frequency_penalty` number, double, nullable: Frequency penalty from `gen_ai.request.frequency_penalty`.
    - `request_max_tokens` integer, nullable: Max tokens from `gen_ai.request.max_tokens`.
    - `request_presence_penalty` number, double, nullable: Presence penalty from `gen_ai.request.presence_penalty`.
    - `request_seed` integer, nullable: Seed for reproducibility from `gen_ai.request.seed`.
    - `request_stop_sequences` string[], nullable: Stop sequences from `gen_ai.request.stop_sequences`.
    - `request_temperature` number, double, nullable: Temperature setting from `gen_ai.request.temperature`.
    - `request_top_k` number, double, nullable: Top-k setting from `gen_ai.request.top_k`.
    - `request_top_p` number, double, nullable: Top-p setting from `gen_ai.request.top_p`.
    - `response_finish_reasons` string[], nullable: Reasons the model stopped from `gen_ai.response.finish_reasons` (e.g. ["stop"]).
    - `response_id` string, nullable: Unique completion ID from `gen_ai.response.id` (e.g. "chatcmpl-123").
    - `retrieval_documents` string, nullable: Retrieved documents from `gen_ai.retrieval.documents` (opt-in, JSON string).
    - `retrieval_query_text` string, nullable: Retrieval query text from `gen_ai.retrieval.query.text` (opt-in).
    - `server_address` string, nullable: GenAI server address from `server.address`.
    - `server_port` integer, nullable: GenAI server port from `server.port`.
    - `span_id` string, required
    - `start_time` string, date-time, required
    - `status_code` 'UNSET' | 'OK' | 'ERROR', required: Span status code.
    - `system_instructions` string, nullable: System instructions from `gen_ai.system_instructions` (opt-in, JSON string).
    - `tool_call_arguments` string, nullable: Tool call arguments from `gen_ai.tool.call.arguments` (opt-in, JSON string).
    - `tool_call_id` string, nullable: Tool call ID from `gen_ai.tool.call.id`.
    - `tool_call_result` string, nullable: Tool call result from `gen_ai.tool.call.result` (opt-in, JSON string).
    - `tool_definitions` string, nullable: Tool definitions from `gen_ai.tool.definitions` (opt-in, JSON string).
    - `tool_description` string, nullable: Tool description from `gen_ai.tool.description`.
    - `tool_name` string, nullable: Tool name from `gen_ai.tool.name`.
    - `tool_type` string, nullable: Tool type from `gen_ai.tool.type` (function, extension, datastore).
  - `trace_id` string, required

## Other responses

- `401`: Unauthorized
- `403`: Insufficient permissions
- `500`: Internal server error

## Changes

- **2026-11-09** `12896146b193`: 3 breaking
  - removed the required property `extensions` from the response with the `401` status
  - removed the required property `extensions` from the response with the `403` status
  - removed the required property `extensions` from the response with the `500` status
- **2026-10-05** `4b228ebed583`: 5 info
  - added the new optional `query` request parameter `end_time`
  - added the new optional `query` request parameter `start_time`
  - added the optional property `status` to the response with the `401` status
  - added the optional property `status` to the response with the `403` status
  - …1 more
- **2026-10-05** `63a80791dc58`: 5 warning
  - deleted the `query` request parameter `end_time`
  - deleted the `query` request parameter `start_time`
  - removed the optional property `status` from the response with the `401` status
  - removed the optional property `status` from the response with the `403` status
  - …1 more
- **2026-09-23** `f4efc4d5c7b7`: 3 info
  - added the optional property `status` to the response with the `401` status
  - added the optional property `status` to the response with the `403` status
  - added the optional property `status` to the response with the `500` status
- **2026-09-20** `92a0a5fc2ba0`: 2 info
  - added the new optional `query` request parameter `end_time`
  - added the new optional `query` request parameter `start_time`

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/otel/genai/traces/:project_id/:trace_id/get.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
