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

# Detail for one trace: full span tree with per-span token/cost attribution.



## OpenAPI

````yaml /api-reference/openapi.json get /api/observability/trace/{trace_id}
openapi: 3.1.0
info:
  title: Nasiko API
  description: >-
    HTTP API for the Nasiko OpenRuntime: agents, coding harnesses, TokenOps,
    routing, MCP, and secrets. Spec is generated from annotated routes; some
    surfaces are documented on the hand-written pages alongside this file.
  license:
    name: ''
  version: 0.1.0
servers: []
security: []
tags:
  - name: secrets
    description: Encrypted per-user agent secrets
  - name: catalog
    description: >-
      Agent catalog: registration, discovery, versions, per-agent secrets, and
      source import
  - name: agents
    description: >-
      Agent lifecycle: deployments, LLM routing config, update/rollback,
      upload-and-deploy
  - name: orchestrator
    description: >-
      A2A dispatch: routing-engine/ReAct orchestrator and direct agent chat,
      plus routing stats
  - name: users
    description: >-
      User management: CRUD, roles, credentials, accessible agents
      (superuser-only)
  - name: usage
    description: Per-user token usage and cost reporting
  - name: observability
    description: Sessions, traces, spans, agent logs, and FinOps reporting
  - name: llm-router
    description: LLM routing presets, provider/model catalog, and tier→model registry
  - name: mcp
    description: >-
      MCP gateway: agent-facing JSON-RPC tool calls, connector
      registration/upload/sharing, credentials & OAuth, and per-agent tool
      permissions
paths:
  /api/observability/trace/{trace_id}:
    get:
      tags:
        - observability
      summary: >-
        Detail for one trace: full span tree with per-span token/cost
        attribution.
      operationId: get_trace_details
      parameters:
        - name: trace_id
          in: path
          description: W3C trace ID (hex)
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Trace detail with span tree
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TraceDetailResponse'
        '404':
          description: Trace not found
components:
  schemas:
    TraceDetailResponse:
      type: object
      required:
        - data
      properties:
        data:
          $ref: '#/components/schemas/TraceDetailData'
    TraceDetailData:
      type: object
      required:
        - trace
      properties:
        trace:
          $ref: '#/components/schemas/TraceDetail'
    TraceDetail:
      type: object
      required:
        - id
        - num_spans
        - cost_summary
        - root_spans
        - spans
        - span_lookup
      properties:
        cost_summary:
          $ref: '#/components/schemas/NestedCostSummary'
        id:
          type: string
        latency_ms:
          type:
            - number
            - 'null'
          format: double
        num_spans:
          type: integer
          minimum: 0
        project_session_id:
          type:
            - string
            - 'null'
        root_spans:
          $ref: '#/components/schemas/RootSpansWrapper'
        span_lookup:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/SpanNode'
          propertyNames:
            type: string
        spans:
          type: array
          items:
            $ref: '#/components/schemas/SpanNode'
    NestedCostSummary:
      type: object
      required:
        - total
        - prompt
        - completion
        - cache_read
        - cache_creation
      properties:
        cache_creation:
          $ref: '#/components/schemas/CostOnly'
        cache_read:
          $ref: '#/components/schemas/CostOnly'
        completion:
          $ref: '#/components/schemas/CostOnly'
        prompt:
          $ref: '#/components/schemas/CostOnly'
        total:
          $ref: '#/components/schemas/CostOnly'
    RootSpansWrapper:
      type: object
      required:
        - edges
      properties:
        edges:
          type: array
          items:
            $ref: '#/components/schemas/RootSpanEdge'
    SpanNode:
      type: object
      required:
        - id
        - span_id
        - name
        - span_kind
        - status_code
        - token_count_total
        - input_tokens
        - output_tokens
        - cache_read_tokens
        - cache_creation_tokens
        - span_annotation_summaries
        - children
      properties:
        cache_creation_tokens:
          type: integer
          format: int64
          minimum: 0
        cache_read_tokens:
          type: integer
          format: int64
          minimum: 0
        children:
          type: array
          items:
            $ref: '#/components/schemas/SpanNode'
        end_time:
          type:
            - string
            - 'null'
        id:
          type: string
        input_tokens:
          type: integer
          format: int64
          minimum: 0
        latency_ms:
          type:
            - number
            - 'null'
          format: double
        model:
          type:
            - string
            - 'null'
        name:
          type: string
        operation:
          type:
            - string
            - 'null'
          description: |-
            The greyed second label on a span row (`chat`, `git.clone`, …).
            `None` when no attribute names one — the UI must not synthesise it
            from the span name.
        output_tokens:
          type: integer
          format: int64
          minimum: 0
        parent_id:
          type:
            - string
            - 'null'
        provider:
          type:
            - string
            - 'null'
          description: GenAI provider (`openai`, `anthropic`, …), for the row's glyph.
        span_annotation_summaries:
          type: array
          items:
            type: object
        span_id:
          type: string
        span_kind:
          type: string
        start_time:
          type:
            - string
            - 'null'
        status_code:
          type: string
        token_count_total:
          type: integer
          format: int64
          minimum: 0
    CostOnly:
      type: object
      required:
        - cost
      properties:
        cost:
          type: number
          format: double
    RootSpanEdge:
      type: object
      required:
        - span
      properties:
        span:
          $ref: '#/components/schemas/RootSpanRef'
    RootSpanRef:
      type: object
      required:
        - id
        - span_id
        - status_code
      properties:
        id:
          type: string
        parent_id:
          type:
            - string
            - 'null'
        span_id:
          type: string
        status_code:
          type: string

````