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

# Linhagem de um comprovante

> Do comprovante aos itens entregues e aos eventos de origem: por que o agente disse aquilo.



## OpenAPI

````yaml openapi/pt/cell.json GET /v1/lineage/receipt/{receipt_id}
openapi: 3.1.0
info:
  title: API de dados da Niadra
  version: '1'
  description: >-
    Escrita, contexto, histórico, objetos, identidade, privacidade e governança
    de um espaço. Cada espaço tem um endereço estável, com o espaço e a região
    no nome.
servers:
  - url: https://{space}.{region}.api.niadra.com
    variables:
      space:
        default: acme-prod
        description: O espaço, que vem na chave de fonte.
      region:
        default: us-east-1
        description: A região do espaço, que também vem na chave.
security: []
paths:
  /v1/lineage/receipt/{receipt_id}:
    get:
      tags:
        - governance
      summary: Linhagem de um comprovante
      description: >-
        Responde "por que o agente disse aquilo?": de um comprovante aos itens
        entregues, e de cada item aos eventos de origem, com canal, fonte e
        hora. `excluded` lista o que a política reteve e por quê, e
        `manifest_found` diz se o manifesto de proveniência ainda está
        disponível.


        **Autenticação.** Token de pessoa do Console com o papel `security` (ou
        admin), ou chave de fonte com o escopo `admin`.
      operationId: receipt_lineage_v1_lineage_receipt__receipt_id__get
      parameters:
        - in: path
          name: receipt_id
          required: true
          schema:
            format: uuid
            title: Receipt Id
            type: string
          example: 0192f7a4-0e21-7f9b-a2d5-4a7f9e0b1c23
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReceiptLineage'
              example:
                receipt:
                  receipt_id: 0192f7a4-0e21-7f9b-a2d5-4a7f9e0b1c23
                  kind: history
                  surface: search
                  audience: customer_agent
                  day: '2026-09-22'
                  read_at: '2026-09-22T17:07:09Z'
                  source_id: 0192f79e-11aa-7b20-9f3e-6c1d2e4f5a60
                  profile_id: 0192f7a0-3b2e-7d41-8c5a-2e9f4b7a1c03
                  conversation_id: call-4471
                  purpose: customer_service
                  verification: V1
                  policy_version: pol-14
                  item_ids:
                    - 0192f7a3-7c32-7b0c-9e16-5b8a0f1c2d34
                    - 0192f7a2-5d10-7a8e-b1c4-3f6e8d9a0b12
                  withheld: 1
                  slice: 3
                  seq: 88214
                  prev_hash: sha256:0d9f3a61c2
                  hash: sha256:7e21c8a4b9
                manifest_found: true
                items:
                  - id: 0192f7a3-7c32-7b0c-9e16-5b8a0f1c2d34
                    kind: episode
                    evidence_event_ids:
                      - 0192f10a-2c3d-7e4f-8a5b-6c7d8e9f0a1b
                    events:
                      - event_id: 0192f10a-2c3d-7e4f-8a5b-6c7d8e9f0a1b
                        kind: message
                        channel: voice
                        source_id: 0192f79e-11aa-7b20-9f3e-6c1d2e4f5a60
                        conversation_id: call-2210
                        task_id: null
                        occurred_at: '2026-03-12T14:20:00Z'
                excluded:
                  - id: 0192f7a2-9e10-7b8c-a1d2-3e4f5a6b7c8d
                    reason: verification
          description: O comprovante, os itens e os eventos de origem de cada um.
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: O pedido não bate com o contrato.
      security:
        - sourceKey: []
        - personToken: []
components:
  schemas:
    ReceiptLineage:
      additionalProperties: false
      description: >-
        Responde "por que o agente disse X?": comprovante, manifesto, itens e
        eventos de origem.
      properties:
        excluded:
          description: O que o manifesto deixou de fora de propósito, com o motivo.
          items:
            additionalProperties: true
            type: object
          title: Excluded
          type: array
        items:
          items:
            $ref: '#/components/schemas/LineageItem'
          title: Items
          type: array
        manifest_found:
          title: Manifest Found
          type: boolean
        receipt:
          $ref: '#/components/schemas/ReceiptOut'
      required:
        - receipt
        - manifest_found
      title: ReceiptLineage
      type: object
    Problem:
      additionalProperties: false
      description: >-
        Detalhes do problema no formato da RFC 9457; `code` vem do catálogo de
        erros versionado.
      properties:
        code:
          title: Code
          type: string
        detail:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Detail
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Request Id
        status:
          title: Status
          type: integer
        title:
          title: Title
          type: string
        type:
          default: about:blank
          title: Type
          type: string
      required:
        - title
        - status
        - code
      title: Problem
      type: object
    LineageItem:
      additionalProperties: false
      properties:
        events:
          items:
            $ref: '#/components/schemas/LineageEvent'
          title: Events
          type: array
        evidence_event_ids:
          items:
            type: string
          title: Evidence Event Ids
          type: array
        id:
          title: Id
          type: string
        kind:
          anyOf:
            - type: string
            - type: 'null'
          title: Kind
      required:
        - id
      title: LineageItem
      type: object
    ReceiptOut:
      additionalProperties: false
      properties:
        about_handle_id:
          anyOf:
            - type: string
            - type: 'null'
          title: About Handle Id
        audience:
          $ref: '#/components/schemas/Audience'
        conversation_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Conversation Id
        day:
          format: date
          title: Day
          type: string
        experiment_group:
          anyOf:
            - type: string
            - type: 'null'
          title: Experiment Group
        hash:
          description: >-
            SHA-256, em hexadecimal, sobre o hash anterior e a codificação
            canônica deste comprovante.
          title: Hash
          type: string
        item_ids:
          items:
            type: string
          title: Item Ids
          type: array
        kind:
          $ref: '#/components/schemas/ReceiptKind'
        manifest_hash:
          anyOf:
            - type: string
            - type: 'null'
          title: Manifest Hash
        object_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Object Id
        pack_hash:
          anyOf:
            - type: string
            - type: 'null'
          title: Pack Hash
        person_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Person Id
        policy_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Policy Version
        prev_hash:
          description: SHA-256, em hexadecimal, do elo anterior desta cadeia.
          title: Prev Hash
          type: string
        profile_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Profile Id
        purpose:
          anyOf:
            - type: string
            - type: 'null'
          title: Purpose
        read_at:
          format: date-time
          title: Read At
          type: string
        receipt_id:
          title: Receipt Id
          type: string
        seq:
          title: Seq
          type: integer
        slice:
          title: Slice
          type: integer
        source_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Id
        surface:
          $ref: '#/components/schemas/ReceiptSurface'
        task_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Task Id
        verification:
          anyOf:
            - type: string
            - type: 'null'
          title: Verification
        withheld:
          default: 0
          title: Withheld
          type: integer
      required:
        - receipt_id
        - kind
        - surface
        - audience
        - read_at
        - slice
        - day
        - seq
        - prev_hash
        - hash
      title: ReceiptOut
      type: object
    LineageEvent:
      additionalProperties: false
      description: >-
        De onde veio um item; só metadados, o conteúdo fica atrás das rotas de
        histórico.
      properties:
        channel:
          title: Channel
          type: string
        conversation_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Conversation Id
        event_id:
          title: Event Id
          type: string
        kind:
          $ref: '#/components/schemas/EventKind'
        occurred_at:
          format: date-time
          title: Occurred At
          type: string
        source_id:
          title: Source Id
          type: string
        task_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Task Id
      required:
        - event_id
        - kind
        - source_id
        - channel
        - occurred_at
      title: LineageEvent
      type: object
    Audience:
      enum:
        - customer_agent
        - internal_agent
        - human
        - reviewer
        - analyst
        - trigger_target
        - export
      title: Audience
      type: string
    ReceiptKind:
      enum:
        - read
        - history
        - analytics
        - admin
        - holdout
      title: ReceiptKind
      type: string
    ReceiptSurface:
      enum:
        - pack
        - live
        - delta
        - search
        - timeline
        - open
        - object
        - console
      title: ReceiptSurface
      type: string
    EventKind:
      enum:
        - message
        - system_event
        - action
      title: EventKind
      type: string
      description: >-
        O que um evento registra: algo que foi dito, uma mudança num sistema de
        registro ou o que um agente fez num sistema.
  securitySchemes:
    sourceKey:
      type: http
      scheme: bearer
      description: nia_sk_...
    personToken:
      type: http
      scheme: bearer
      bearerFormat: JWT

````