> ## 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.

# Receipt lineage

> From a receipt to the delivered items and their source events: why the agent said that.



## OpenAPI

````yaml openapi/en/cell.json GET /v1/lineage/receipt/{receipt_id}
openapi: 3.1.0
info:
  title: Niadra data API
  version: '1'
  description: >-
    Writing, context, history, objects, identity, privacy and governance of one
    space. Every space has a stable address, with the space and the region in
    its name.
servers:
  - url: https://{space}.{region}.api.niadra.com
    variables:
      space:
        default: acme-prod
        description: The space, which comes in the source key.
      region:
        default: us-east-1
        description: The region of the space, which also comes in the key.
security: []
paths:
  /v1/lineage/receipt/{receipt_id}:
    get:
      tags:
        - governance
      summary: Receipt lineage
      description: >-
        Answers "why did the agent say that?": from one receipt to the items
        delivered, and from each item to the events it came from, with channel,
        source and time. `excluded` lists what the policy held back and why, and
        `manifest_found` says whether the provenance manifest is still
        available.


        **Authentication.** Console person token with the `security` role (or
        admin), or a source key with the `admin` scope.
      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: The receipt, its items and the source events behind each one.
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: The request does not match the contract.
      security:
        - sourceKey: []
        - personToken: []
components:
  schemas:
    ReceiptLineage:
      additionalProperties: false
      description: >-
        Answers "why did the agent say X?": receipt -> manifest -> items ->
        origin events.
      properties:
        excluded:
          description: What the manifest deliberately left out, with the reason.
          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: RFC 9457 problem details; `code` comes from the versioned error catalog.
      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: >-
            Hex SHA-256 over the previous hash and this receipt's canonical
            encoding.
          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: Hex SHA-256 of the previous link of this chain.
          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: >-
        Where an item came from; metadata only, the content stays behind the
        history routes.
      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: >-
        What an event records: something said, a change in a system of record,
        or what an agent did in a system.
  securitySchemes:
    sourceKey:
      type: http
      scheme: bearer
      description: nia_sk_...
    personToken:
      type: http
      scheme: bearer
      bearerFormat: JWT

````