> ## 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 issue chat context

> Returns the issue, recent occurrences, aggregate stats, and per-trace bundles (trace row + trace_stats + spans) for issue chat.



## OpenAPI

````yaml https://api.uselemma.ai/openapi.json get /issues/{issue_id}/chat-context
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:
  /issues/{issue_id}/chat-context:
    get:
      tags:
        - Issues
      summary: Get issue chat context
      description: >-
        Returns the issue, recent occurrences, aggregate stats, and per-trace
        bundles (trace row + trace_stats + spans) for issue chat.
      operationId: get_issue_chat_context
      parameters:
        - name: issue_id
          in: path
          required: true
          description: Issue ID.
          schema:
            type: string
        - name: project_id
          in: query
          required: true
          description: Project ID.
          schema:
            type: string
      responses:
        '200':
          description: Issue chat context
          content:
            application/json:
              schema:
                type: object
                properties:
                  issue:
                    type: object
                    properties:
                      id:
                        type: string
                      project_id:
                        type: string
                      agent_name:
                        type:
                          - string
                          - 'null'
                      name:
                        type: string
                      subsystem:
                        type:
                          - string
                          - 'null'
                      failure_class:
                        type:
                          - string
                          - 'null'
                      canonical_mechanism:
                        type:
                          - string
                          - 'null'
                      status:
                        type: string
                        enum:
                          - open
                          - closed
                      created_at:
                        type:
                          - string
                          - 'null'
                        format: date-time
                      updated_at:
                        type:
                          - string
                          - 'null'
                        format: date-time
                    required:
                      - id
                      - project_id
                      - agent_name
                      - name
                      - subsystem
                      - failure_class
                      - canonical_mechanism
                      - status
                      - created_at
                      - updated_at
                    additionalProperties: true
                  occurrences:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        trace_id:
                          type: string
                        issue_id:
                          type:
                            - string
                            - 'null'
                        title:
                          type: string
                        rationale:
                          type: string
                        source_span_ids:
                          type: array
                          items:
                            type: string
                        evidence_span_ids:
                          type: array
                          items:
                            type: string
                        citations: {}
                        category:
                          type:
                            - string
                            - 'null'
                        created_at:
                          type:
                            - string
                            - 'null'
                          format: date-time
                      required:
                        - id
                        - trace_id
                        - issue_id
                        - title
                        - rationale
                      additionalProperties: true
                  traces:
                    type: array
                    items:
                      type: object
                      properties:
                        trace:
                          type: object
                          properties:
                            id:
                              type: string
                            project_id:
                              type: string
                            service_name:
                              type:
                                - string
                                - 'null'
                            created_at:
                              type:
                                - string
                                - 'null'
                              format: date-time
                            updated_at:
                              type:
                                - string
                                - 'null'
                              format: date-time
                            otel_trace_id:
                              type: string
                            ready:
                              type: boolean
                          required:
                            - id
                            - project_id
                            - service_name
                            - created_at
                            - updated_at
                            - otel_trace_id
                            - ready
                          additionalProperties: true
                        stats:
                          type:
                            - object
                            - 'null'
                          additionalProperties: {}
                        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
                      required:
                        - trace
                        - stats
                        - spans
                      additionalProperties: true
                  stats:
                    type: object
                    properties:
                      first_seen_at:
                        type:
                          - string
                          - 'null'
                        format: date-time
                      last_seen_at:
                        type:
                          - string
                          - 'null'
                        format: date-time
                      occurrence_count:
                        type: number
                      trace_count:
                        type: number
                    required:
                      - first_seen_at
                      - last_seen_at
                      - occurrence_count
                      - trace_count
                    additionalProperties: false
                required:
                  - issue
                  - occurrences
                  - traces
                  - stats
                additionalProperties: false
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                required:
                  - detail
                additionalProperties: false
        '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

````