> ## Documentation Index
> Fetch the complete documentation index at: https://docs.uselemma.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get trace

> Loads a single trace with spans and stats.



## OpenAPI

````yaml https://api.uselemma.ai/openapi.json get /traces/{trace_id}
openapi: 3.1.0
info:
  title: Lemma Platform API
  description: Lemma Platform HTTP API for AI observability and workspace operations.
  version: 0.1.0
servers:
  - url: https://api.uselemma.ai
    description: Lemma production API
security:
  - bearerAuth: []
paths:
  /traces/{trace_id}:
    get:
      tags:
        - Traces
      summary: Get trace
      description: Loads a single trace with spans and stats.
      operationId: get_trace
      parameters:
        - schema:
            type: string
          in: path
          name: trace_id
          required: true
      responses:
        '200':
          description: Trace details
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  otel_trace_id:
                    type: string
                  project_id:
                    type: string
                  project_name:
                    type: string
                  service_name:
                    type:
                      - string
                      - 'null'
                  agent_name:
                    type:
                      - string
                      - 'null'
                  thread_id:
                    type:
                      - string
                      - 'null'
                  thread_trace_count:
                    type:
                      - number
                      - 'null'
                  agent_input:
                    type: 'null'
                  agent_input_display:
                    type:
                      - string
                      - 'null'
                  agent_output:
                    type: 'null'
                  has_error:
                    type: boolean
                  total_duration_ms:
                    type:
                      - number
                      - 'null'
                  created_at:
                    type: string
                    format: date-time
                  updated_at:
                    type: string
                  spans:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        otel_span_id:
                          type: string
                        parent_otel_span_id:
                          type:
                            - string
                            - 'null'
                        name:
                          type: string
                        kind:
                          type:
                            - string
                            - 'null'
                        start_time_ns:
                          type:
                            - string
                            - 'null'
                        end_time_ns:
                          type:
                            - string
                            - 'null'
                        duration_ms:
                          type:
                            - number
                            - 'null'
                        status_code:
                          type:
                            - string
                            - 'null'
                        status_description:
                          type:
                            - string
                            - 'null'
                        input_tokens:
                          type:
                            - number
                            - 'null'
                        output_tokens:
                          type:
                            - number
                            - 'null'
                        model_name:
                          type:
                            - string
                            - 'null'
                        tps:
                          type:
                            - number
                            - 'null'
                        attributes:
                          type: object
                          additionalProperties: {}
                        events: {}
                      required:
                        - id
                        - otel_span_id
                        - parent_otel_span_id
                        - name
                        - kind
                        - start_time_ns
                        - end_time_ns
                        - duration_ms
                        - status_code
                        - status_description
                        - input_tokens
                        - output_tokens
                        - model_name
                        - tps
                      additionalProperties: true
                  stats:
                    type: object
                    properties:
                      span_count:
                        type: number
                      total_tokens:
                        type:
                          - number
                          - 'null'
                      total_duration_ms:
                        type:
                          - number
                          - 'null'
                      error_count:
                        type: number
                      tool_calls:
                        type: array
                        items:
                          type: object
                          properties:
                            name:
                              type: string
                            otel_span_id:
                              type: string
                            status:
                              type:
                                - string
                                - 'null'
                          required:
                            - name
                            - otel_span_id
                            - status
                          additionalProperties: true
                      models_used:
                        type: array
                        items:
                          type: string
                    required:
                      - span_count
                      - total_tokens
                      - total_duration_ms
                      - error_count
                      - tool_calls
                      - models_used
                    additionalProperties: true
                  issue_extraction:
                    type:
                      - object
                      - 'null'
                    properties:
                      status:
                        type: string
                        enum:
                          - running
                          - completed
                          - skipped
                          - failed
                      reason:
                        type:
                          - string
                          - 'null'
                        enum:
                          - issues_found
                          - no_issues_found
                          - no_spans
                          - unsupported_trace
                          - error
                          - null
                      issue_count:
                        type:
                          - number
                          - 'null'
                      occurrence_count:
                        type:
                          - number
                          - 'null'
                      completed_at:
                        type:
                          - string
                          - 'null'
                        format: date-time
                      error_message:
                        type:
                          - string
                          - 'null'
                    required:
                      - status
                      - reason
                      - issue_count
                      - occurrence_count
                      - completed_at
                    additionalProperties: false
                required:
                  - id
                  - otel_trace_id
                  - project_id
                  - service_name
                  - agent_name
                  - thread_id
                  - thread_trace_count
                  - agent_input_display
                  - has_error
                  - total_duration_ms
                  - created_at
                  - updated_at
                  - spans
                  - stats
                  - issue_extraction
                additionalProperties: true
        '404':
          description: Not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                required:
                  - detail
                additionalProperties: false
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````