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

# Import a receipt

> Validate and store a portable Agent Work Receipt in the selected workspace.



## OpenAPI

````yaml /openapi/v1.yaml post /agent-work-receipts
openapi: 3.1.0
info:
  title: OrgX REST API v1
  version: '1'
  description: >-
    Build accountable work into your product with OrgX REST API v1.


    Create work with one field, attach evidence when it is complete, and keep
    the receipt. Every authenticated request is scoped to the workspace resolved
    from your credential.


    Start with `POST /work`. Human guide:
    https://docs.useorgx.com/docs/api/quickstart
  contact:
    name: OrgX Support
    url: https://useorgx.com/support
    email: support@useorgx.com
  license:
    name: Proprietary
    url: https://useorgx.com/terms
servers:
  - url: https://useorgx.com/api/v1
    description: Production
security: []
tags:
  - name: Work
    description: Create accountable work and complete it with evidence
  - name: Initiatives
    description: Organize related work around an outcome
  - name: Operating processes
    description: Evidence-backed company workflow/process lifecycle
  - name: Operating map
    description: Derived, rebuildable Operating Map projection over the process ledger
  - name: Discovery runs
    description: Wizard and deep-search workflow discovery over connected company sources
  - name: Handoffs
    description: Ledger-backed stage handoffs between operating-process stages
  - name: Events
    description: Replayable, workspace-scoped accepted ledger events
  - name: Projections
    description: Workspace-scoped, rebuildable read projections over OrgX sources
  - name: Episodes
    description: Mission-compatible Episode read adapters
  - name: Receipt validation
    description: Account-free Agent Work Receipt schema discovery and conformance
  - name: Receipt import
    description: Authenticated, workspace-scoped import into the hosted receipt ledger
  - name: Workload diagnosis
    description: >-
      Account-free evaluation of time, agents, systems, authority, and
      accountability boundaries
  - name: Content Studio
    description: >-
      Estimate, showcase, checkout, and payment event operations for Content
      Studio
  - name: Decisions
    description: Raise decisions for human ruling and read their state
  - name: Artifacts
    description: Register produced work against the entity it belongs to
  - name: Launches
    description: Preview and run an initiative launch through its spend gates
  - name: Runs
    description: Control agent runs with pause, resume, cancel, and rollback
  - name: Lifecycle
    description: Pause, resume, retry, or cancel work hierarchy nodes and runs
  - name: Deduplication
    description: Claim durable event fingerprints so duplicate triggers fire once
  - name: Credential
    description: >-
      Resolve the calling credential, the workspaces it reaches, and what it may
      do
  - name: API discovery
    description: Account-free error codes, request schemas, and closed vocabularies for v1
externalDocs:
  description: Human-readable OrgX REST API v1 reference
  url: https://docs.useorgx.com/docs/api/public-api
paths:
  /agent-work-receipts:
    post:
      tags:
        - Receipt import
      summary: Import a receipt
      description: >-
        Validate and store a portable Agent Work Receipt in the selected
        workspace.
      operationId: importAgentWorkReceipt
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReceiptImportRequest'
            example:
              receipt:
                schema_version: agent-work-receipt/v0.1
                receipt_id: awr:example:launch-review-001
                intent:
                  summary: >-
                    Add a portable receipt validator and prove it with focused
                    tests.
                  objective: >-
                    Produce an account-free contract that another runtime can
                    validate without OrgX identifiers.
                  acceptance_criteria:
                    - The JSON Schema accepts opaque external identifiers.
                    - The focused conformance tests pass.
                  constraints:
                    - Do not change application routes.
                  request_ref:
                    system: example-app
                    type: task
                    id: launch-review-001
                actor:
                  type: agent
                  id: launch-review-agent
                  display_name: Launch Review Agent
                  runtime:
                    name: example-runtime
                    version: 1.0.0
                  model:
                    provider: example
                    name: workflow-model
                authority:
                  mode: delegated
                  status: restricted
                  scope:
                    actions:
                      - read_source
                      - edit_package
                      - run_tests
                    resources:
                      - system: git
                        type: repository
                        id: launch-planning
                    systems:
                      - filesystem
                      - git
                    spend_limit:
                      currency: USD
                      amount: 1
                  delegated_by:
                    type: human
                    id: launch-owner
                  authorization_ref:
                    system: example-app
                    type: task_message
                    id: launch-review-message-001
                  constraints:
                    - Write only inside packages/agent-work-receipt.
                  valid_from: '2026-07-19T15:00:00.000Z'
                  valid_until: '2026-07-19T16:00:00.000Z'
                actions:
                  - id: inspect-receipt
                    type: source.inspect
                    summary: Reviewed the receipt fields required by the integration.
                    status: completed
                    system: filesystem
                    started_at: '2026-07-19T15:00:00.000Z'
                    completed_at: '2026-07-19T15:02:00.000Z'
                  - id: run-conformance
                    type: test.run
                    summary: Ran the Agent Work Receipt conformance suite.
                    status: completed
                    system: vitest
                    tool_ref:
                      system: vitest
                      type: command
                      id: receipt-conformance
                    output_refs:
                      - system: local-filesystem
                        type: test_output
                        id: receipt-conformance-output
                    started_at: '2026-07-19T15:08:00.000Z'
                    completed_at: '2026-07-19T15:08:05.000Z'
                artifacts:
                  - id: artifact-schema
                    kind: json_schema
                    name: Agent Work Receipt v0.1 schema
                    role: output
                    ref:
                      system: git
                      type: file
                      id: >-
                        packages/agent-work-receipt/schema/agent-work-receipt.v0.1.schema.json
                      uri: >-
                        file:packages/agent-work-receipt/schema/agent-work-receipt.v0.1.schema.json
                    media_type: application/schema+json
                    digest:
                      algorithm: sha256
                      value: >-
                        1111111111111111111111111111111111111111111111111111111111111111
                      encoding: hex
                    created_at: '2026-07-19T15:07:00.000Z'
                evidence:
                  - id: evidence-tests
                    kind: test_result
                    summary: Focused conformance tests passed.
                    ref:
                      system: local-filesystem
                      type: test_output
                      id: receipt-conformance-output
                    observed_at: '2026-07-19T15:08:05.000Z'
                    excerpt: 'Tests: passed'
                    supports:
                      - verification
                      - outcome
                outcome:
                  status: succeeded
                  summary: >-
                    The portable schema, types, validator, and fixtures were
                    produced.
                  observed_effects:
                    - >-
                      An external runtime can emit a receipt without an OrgX
                      account.
                  metrics:
                    - name: focused_tests_passed
                      value: 1
                      unit: boolean
                      target: 1
                      observed_at: '2026-07-19T15:08:05.000Z'
                      evidence_ids:
                        - evidence-tests
                verification:
                  status: passed
                  method: Deterministic JSON Schema and semantic conformance suite.
                  verifier:
                    type: service
                    id: vitest-local
                  checks:
                    - id: check-conformance
                      name: Agent Work Receipt conformance
                      status: passed
                      method: vitest run
                      evidence_ids:
                        - evidence-tests
                  evidence_ids:
                    - evidence-tests
                  verified_at: '2026-07-19T15:08:05.000Z'
                cost:
                  currency: USD
                  total: 0.08
                  components:
                    - category: model
                      amount: 0.08
                  usage:
                    - name: agent_runtime
                      quantity: 8
                      unit: minutes
                      cost: 0.08
                  human_minutes: 0
                  estimated: true
                lineage:
                  run_ref:
                    system: example-app
                    type: run
                    id: run-2026-07-19-001
                  parent_receipt_refs: []
                  references:
                    - relationship: produced_in
                      ref:
                        system: git
                        type: branch
                        id: example-app/launch-review-001
                  trace_id: launch-review-trace-001
                human_interventions: []
                timestamps:
                  started_at: '2026-07-19T15:00:00.000Z'
                  completed_at: '2026-07-19T15:08:05.000Z'
                  issued_at: '2026-07-19T15:08:06.000Z'
                  duration_ms: 485000
      responses:
        '200':
          description: Idempotent retry returned the existing hosted receipt
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReceiptImportSuccess'
              example:
                ok: true
                receipt_id: 13aef4be-6435-448e-8ac3-2c9e2724fafd
                external_receipt_id: awr:example:launch-review-001
                schema_version: agent-work-receipt/v0.1
                idempotent: true
        '201':
          description: Receipt imported into the workspace ledger
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReceiptImportSuccess'
              example:
                ok: true
                receipt_id: 13aef4be-6435-448e-8ac3-2c9e2724fafd
                external_receipt_id: awr:example:launch-review-001
                schema_version: agent-work-receipt/v0.1
                idempotent: true
        '400':
          description: Invalid import envelope or missing workspace identifier
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReceiptImportError'
        '401':
          description: Authentication required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReceiptImportError'
        '404':
          description: Workspace is unavailable to the caller
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReceiptImportError'
        '409':
          description: >-
            Idempotency key is bound to different content, the workspace hard
            import quota is exhausted, or signed pilot metadata is present but
            unverifiable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReceiptImportError'
        '413':
          description: Import envelope exceeds the 278,528-byte limit
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReceiptImportError'
        '415':
          description: Content-Type is not application/json
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReceiptImportError'
        '422':
          description: >-
            Portable receipt does not conform to v0.1 or contains values the
            hosted PostgreSQL ledger cannot represent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReceiptImportError'
        '429':
          description: Per-user/workspace write rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReceiptImportError'
        '500':
          description: Receipt persistence failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReceiptImportError'
        '503':
          description: >-
            Workspace authorization, ledger database, pilot signing, enrollment
            lookup, or distributed production rate limiting is unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReceiptImportError'
      security:
        - bearerAuth: []
        - cookieAuth: []
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: true
      schema:
        type: string
        minLength: 1
        maxLength: 200
        pattern: ^[A-Za-z0-9][A-Za-z0-9._:/-]{0,199}$
      description: Workspace-scoped retry key for safe mutation replay.
  schemas:
    ReceiptImportRequest:
      type: object
      additionalProperties: false
      required:
        - receipt
      properties:
        workspace_id:
          type: string
          format: uuid
          description: Existing OrgX workspace the authenticated caller can access
        receipt:
          $ref: '#/components/schemas/AgentWorkReceipt'
        idempotency_key:
          type: string
          minLength: 1
          maxLength: 160
          pattern: ^[A-Za-z0-9][A-Za-z0-9._:/-]{0,159}$
          description: >-
            Compatibility field. New integrations send the Idempotency-Key
            header.
          deprecated: true
    ReceiptImportSuccess:
      type: object
      additionalProperties: false
      required:
        - ok
        - receipt_id
        - external_receipt_id
        - schema_version
        - idempotent
      properties:
        ok:
          type: boolean
          const: true
        receipt_id:
          type: string
          format: uuid
          description: OrgX-hosted receipt identifier
        external_receipt_id:
          type: string
          description: Producer-owned portable receipt identifier
        schema_version:
          type: string
          const: agent-work-receipt/v0.1
        idempotent:
          type: boolean
        imported_at:
          type: string
          format: date-time
        pilot:
          oneOf:
            - type: 'null'
            - type: object
              additionalProperties: false
              required:
                - cohort_id
                - partner_ref
              properties:
                cohort_id:
                  type: string
                partner_ref:
                  type: string
    ReceiptImportError:
      type: object
      properties:
        ok:
          type: boolean
          const: false
        error:
          oneOf:
            - type: string
            - type: object
              required:
                - code
                - message
              properties:
                code:
                  type: string
                message:
                  type: string
                details:
                  type: object
                issues:
                  type: array
                  maxItems: 100
                  items: 9c9255c8-9275-4fb6-9710-ac97c284466d
                issue_count:
                  type: integer
                  minimum: 0
                issues_truncated:
                  type: boolean
    AgentWorkReceipt:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: https://useorgx.com/schemas/agent-work-receipt/v0.1/schema.json
      title: Agent Work Receipt v0.1
      description: >-
        A portable, account-free record of agent intent, authority, actions,
        evidence, outcome, verification, cost, lineage, and human intervention.
        Identifiers are opaque external strings and never require an OrgX
        account or UUID.
      type: object
      additionalProperties: false
      required:
        - schema_version
        - receipt_id
        - intent
        - actor
        - authority
        - actions
        - artifacts
        - evidence
        - outcome
        - verification
        - cost
        - lineage
        - human_interventions
        - timestamps
      properties:
        schema_version:
          const: agent-work-receipt/v0.1
          description: >-
            Stable contract version. Producers must not silently emit a
            different shape under this value.
        receipt_id:
          $ref: 1f1c004e-f67a-44be-9200-6e799f9a9209
          description: >-
            Producer-owned opaque receipt identifier. UUIDs are allowed but
            never required.
        intent: 7bf0e826-925e-42c9-b125-27378d0ab9f4
        actor: ffd5dbe3-f6f2-49be-9693-f4f99ba0d82d
        authority: dfdecc99-15d1-4fbe-8086-18007df2bedd
        actions:
          type: array
          minItems: 1
          maxItems: 10000
          items: e09c253e-6422-41f7-b296-a8af7a91c3d7
        artifacts:
          type: array
          maxItems: 10000
          items: 9e54a472-67b2-4cde-b927-2523284dbd22
        evidence:
          type: array
          minItems: 1
          maxItems: 10000
          items: 7608b810-e8f5-4f6c-a86b-39799fdf5bbc
        outcome: a319c29f-8bb9-452f-a7f1-043e9fd2ce0a
        verification: 60cff116-6876-4cb2-af42-8ba01c0dd0ad
        cost: 83b008d5-d89c-40ba-ac7c-d388214a9e19
        lineage: 6af71703-14ed-4ca3-b011-f2c35aead1a5
        human_interventions:
          type: array
          maxItems: 10000
          items: 5de89f80-90f7-43b7-b231-9e5ef4788e69
        timestamps: 29d3515c-89c2-4c3b-a87b-8f207d6c9d9e
        integrity: a9116029-74d4-4553-ae53-389a64fc8409
        extensions:
          $ref: a8f593ec-c0c7-4386-84bc-ad576a2d46c2
          description: >-
            Namespaced producer or consumer extensions. Core interoperability
            must not depend on extension fields.
      $defs:
        id:
          type: string
          minLength: 1
          maxLength: 512
          pattern: \S
        short_string:
          type: string
          minLength: 1
          maxLength: 512
          pattern: \S
        long_string:
          type: string
          minLength: 1
          maxLength: 20000
          pattern: \S
        json_value:
          anyOf:
            - type: string
            - type: number
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: boolean
            - type: 'null'
            - $ref: '#/components/schemas/AgentWorkReceipt/$defs/json_object'
            - type: array
              items:
                $ref: '#/components/schemas/AgentWorkReceipt/$defs/json_value'
        json_object:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/AgentWorkReceipt/$defs/json_value'
        digest:
          type: object
          additionalProperties: false
          required:
            - algorithm
            - value
          properties:
            algorithm:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/short_string'
              description: Digest algorithm such as sha256, sha512, or blake3.
            value:
              type: string
              minLength: 1
              maxLength: 8192
            encoding:
              type: string
              enum:
                - hex
                - base64
                - base64url
        external_reference:
          type: object
          additionalProperties: false
          required:
            - system
            - type
            - id
          properties:
            system:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/short_string'
              description: >-
                Owning namespace or protocol, for example git, github, mcp, a2a,
                opentelemetry, or a vendor-defined system.
            type:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/short_string'
            id:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/id'
            uri:
              type: string
              minLength: 1
              maxLength: 8192
              format: uri-reference
            version:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/short_string'
            digest:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/digest'
            metadata:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/json_object'
        runtime:
          type: object
          additionalProperties: false
          required:
            - name
          properties:
            name:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/short_string'
            version:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/short_string'
        model:
          type: object
          additionalProperties: false
          required:
            - provider
            - name
          properties:
            provider:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/short_string'
            name:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/short_string'
            version:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/short_string'
        actor:
          type: object
          additionalProperties: false
          required:
            - type
            - id
          properties:
            type:
              type: string
              enum:
                - agent
                - service
                - human
                - team
                - system
                - other
            id:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/id'
            display_name:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/short_string'
            runtime:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/runtime'
            model:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/model'
            external_refs:
              type: array
              maxItems: 1000
              items:
                $ref: '#/components/schemas/AgentWorkReceipt/$defs/external_reference'
            metadata:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/json_object'
        intent:
          type: object
          additionalProperties: false
          required:
            - summary
          properties:
            summary:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/long_string'
            objective:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/long_string'
            acceptance_criteria:
              type: array
              maxItems: 1000
              items:
                $ref: '#/components/schemas/AgentWorkReceipt/$defs/long_string'
            constraints:
              type: array
              maxItems: 1000
              items:
                $ref: '#/components/schemas/AgentWorkReceipt/$defs/long_string'
            request_ref:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/external_reference'
            metadata:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/json_object'
        money_limit:
          type: object
          additionalProperties: false
          required:
            - currency
            - amount
          properties:
            currency:
              type: string
              minLength: 3
              maxLength: 12
              pattern: ^[A-Z][A-Z0-9_-]+$
            amount:
              type: number
              minimum: 0
              maximum: 9007199254740991
        authority_scope:
          type: object
          additionalProperties: false
          required:
            - actions
            - resources
          properties:
            actions:
              type: array
              maxItems: 1000
              items:
                $ref: '#/components/schemas/AgentWorkReceipt/$defs/short_string'
            resources:
              type: array
              maxItems: 1000
              items:
                $ref: '#/components/schemas/AgentWorkReceipt/$defs/external_reference'
            systems:
              type: array
              maxItems: 1000
              items:
                $ref: '#/components/schemas/AgentWorkReceipt/$defs/short_string'
            spend_limit:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/money_limit'
        approval:
          type: object
          additionalProperties: false
          required:
            - status
            - approver
            - occurred_at
          properties:
            status:
              type: string
              enum:
                - requested
                - granted
                - denied
                - revoked
                - expired
            approver:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/actor'
            scope:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/long_string'
            occurred_at:
              type: string
              format: date-time
            ref:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/external_reference'
        authority:
          type: object
          additionalProperties: false
          required:
            - mode
            - status
            - scope
          properties:
            mode:
              type: string
              enum:
                - explicit
                - delegated
                - inherited
                - policy
                - none
                - unknown
            status:
              type: string
              enum:
                - granted
                - restricted
                - denied
                - expired
                - unknown
            scope:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/authority_scope'
            delegated_by:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/actor'
            authorization_ref:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/external_reference'
            approvals:
              type: array
              maxItems: 1000
              items:
                $ref: '#/components/schemas/AgentWorkReceipt/$defs/approval'
            constraints:
              type: array
              maxItems: 1000
              items:
                $ref: '#/components/schemas/AgentWorkReceipt/$defs/long_string'
            valid_from:
              type: string
              format: date-time
            valid_until:
              type: string
              format: date-time
            metadata:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/json_object'
        action:
          type: object
          additionalProperties: false
          required:
            - id
            - type
            - summary
            - status
          properties:
            id:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/id'
            type:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/short_string'
            summary:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/long_string'
            status:
              type: string
              enum:
                - planned
                - running
                - completed
                - failed
                - skipped
                - blocked
            system:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/short_string'
            tool_ref:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/external_reference'
            target_refs:
              type: array
              maxItems: 1000
              items:
                $ref: '#/components/schemas/AgentWorkReceipt/$defs/external_reference'
            input_refs:
              type: array
              maxItems: 1000
              items:
                $ref: '#/components/schemas/AgentWorkReceipt/$defs/external_reference'
            output_refs:
              type: array
              maxItems: 1000
              items:
                $ref: '#/components/schemas/AgentWorkReceipt/$defs/external_reference'
            started_at:
              type: string
              format: date-time
            completed_at:
              type: string
              format: date-time
            error:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/long_string'
            metadata:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/json_object'
        artifact:
          type: object
          additionalProperties: false
          required:
            - id
            - kind
            - name
            - ref
          properties:
            id:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/id'
            kind:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/short_string'
            name:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/short_string'
            ref:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/external_reference'
            role:
              type: string
              enum:
                - input
                - intermediate
                - output
                - log
                - report
                - other
            media_type:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/short_string'
            digest:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/digest'
            size_bytes:
              type: integer
              minimum: 0
              maximum: 9007199254740991
            created_at:
              type: string
              format: date-time
            metadata:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/json_object'
        evidence:
          type: object
          additionalProperties: false
          required:
            - id
            - kind
            - summary
            - observed_at
          properties:
            id:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/id'
            kind:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/short_string'
            summary:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/long_string'
            ref:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/external_reference'
            digest:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/digest'
            observed_at:
              type: string
              format: date-time
            excerpt:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/long_string'
            supports:
              type: array
              maxItems: 1000
              items:
                $ref: '#/components/schemas/AgentWorkReceipt/$defs/short_string'
            metadata:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/json_object'
        outcome_metric:
          type: object
          additionalProperties: false
          required:
            - name
            - value
            - unit
          properties:
            name:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/short_string'
            value:
              type: number
              minimum: -9007199254740991
              maximum: 9007199254740991
            unit:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/short_string'
            baseline:
              type: number
              minimum: -9007199254740991
              maximum: 9007199254740991
            target:
              type: number
              minimum: -9007199254740991
              maximum: 9007199254740991
            observed_at:
              type: string
              format: date-time
            evidence_ids:
              type: array
              maxItems: 1000
              items:
                $ref: '#/components/schemas/AgentWorkReceipt/$defs/id'
        acceptance:
          type: object
          additionalProperties: false
          required:
            - status
          properties:
            status:
              type: string
              enum:
                - pending
                - accepted
                - rejected
                - changes_requested
            actor:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/actor'
            occurred_at:
              type: string
              format: date-time
            evidence_ids:
              type: array
              maxItems: 1000
              items:
                $ref: '#/components/schemas/AgentWorkReceipt/$defs/id'
            notes:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/long_string'
        outcome:
          type: object
          additionalProperties: false
          required:
            - status
            - summary
          properties:
            status:
              type: string
              enum:
                - succeeded
                - partially_succeeded
                - failed
                - blocked
                - cancelled
                - unknown
            summary:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/long_string'
            observed_effects:
              type: array
              maxItems: 1000
              items:
                $ref: '#/components/schemas/AgentWorkReceipt/$defs/long_string'
            metrics:
              type: array
              maxItems: 1000
              items:
                $ref: '#/components/schemas/AgentWorkReceipt/$defs/outcome_metric'
            acceptance:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/acceptance'
            metadata:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/json_object'
        verification_check:
          type: object
          additionalProperties: false
          required:
            - id
            - name
            - status
            - evidence_ids
          properties:
            id:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/id'
            name:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/short_string'
            status:
              type: string
              enum:
                - passed
                - failed
                - skipped
                - inconclusive
            method:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/long_string'
            evidence_ids:
              type: array
              maxItems: 1000
              items:
                $ref: '#/components/schemas/AgentWorkReceipt/$defs/id'
            details:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/long_string'
        verification:
          type: object
          additionalProperties: false
          required:
            - status
            - method
            - checks
            - evidence_ids
          properties:
            status:
              type: string
              enum:
                - unverified
                - passed
                - failed
                - partial
                - inconclusive
            method:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/long_string'
            verifier:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/actor'
            checks:
              type: array
              maxItems: 10000
              items:
                $ref: '#/components/schemas/AgentWorkReceipt/$defs/verification_check'
            evidence_ids:
              type: array
              maxItems: 10000
              items:
                $ref: '#/components/schemas/AgentWorkReceipt/$defs/id'
            verified_at:
              type: string
              format: date-time
            notes:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/long_string'
            metadata:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/json_object'
        cost_component:
          type: object
          additionalProperties: false
          required:
            - category
            - amount
          properties:
            category:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/short_string'
            amount:
              type: number
              minimum: 0
              maximum: 9007199254740991
            description:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/long_string'
        usage:
          type: object
          additionalProperties: false
          required:
            - name
            - quantity
            - unit
          properties:
            name:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/short_string'
            quantity:
              type: number
              minimum: 0
              maximum: 9007199254740991
            unit:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/short_string'
            cost:
              type: number
              minimum: 0
              maximum: 9007199254740991
        cost:
          type: object
          additionalProperties: false
          required:
            - currency
            - total
          properties:
            currency:
              type: string
              minLength: 3
              maxLength: 12
              pattern: ^[A-Z][A-Z0-9_-]+$
            total:
              type: number
              minimum: 0
              maximum: 9007199254740991
            components:
              type: array
              maxItems: 1000
              items:
                $ref: '#/components/schemas/AgentWorkReceipt/$defs/cost_component'
            usage:
              type: array
              maxItems: 1000
              items:
                $ref: '#/components/schemas/AgentWorkReceipt/$defs/usage'
            human_minutes:
              type: number
              minimum: 0
              maximum: 9007199254740991
            estimated:
              type: boolean
            metadata:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/json_object'
        lineage_edge:
          type: object
          additionalProperties: false
          required:
            - relationship
            - ref
          properties:
            relationship:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/short_string'
              description: >-
                Producer-defined relationship such as produced_from, depends_on,
                supersedes, retries, or trace.
            ref:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/external_reference'
        lineage:
          type: object
          additionalProperties: false
          required:
            - parent_receipt_refs
            - references
          properties:
            run_ref:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/external_reference'
            parent_receipt_refs:
              type: array
              maxItems: 1000
              items:
                $ref: '#/components/schemas/AgentWorkReceipt/$defs/external_reference'
            references:
              type: array
              maxItems: 10000
              items:
                $ref: '#/components/schemas/AgentWorkReceipt/$defs/lineage_edge'
            trace_id:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/id'
            span_id:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/id'
            metadata:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/json_object'
        human_intervention:
          type: object
          additionalProperties: false
          required:
            - id
            - kind
            - actor
            - summary
            - occurred_at
          properties:
            id:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/id'
            kind:
              type: string
              enum:
                - approval
                - correction
                - input
                - execution
                - escalation
                - override
                - review
                - other
            actor:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/actor'
            summary:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/long_string'
            occurred_at:
              type: string
              format: date-time
            duration_minutes:
              type: number
              minimum: 0
              maximum: 9007199254740991
            evidence_ids:
              type: array
              maxItems: 1000
              items:
                $ref: '#/components/schemas/AgentWorkReceipt/$defs/id'
            refs:
              type: array
              maxItems: 1000
              items:
                $ref: '#/components/schemas/AgentWorkReceipt/$defs/external_reference'
            metadata:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/json_object'
        timestamps:
          type: object
          additionalProperties: false
          required:
            - started_at
            - completed_at
            - issued_at
          properties:
            started_at:
              type: string
              format: date-time
            completed_at:
              type: string
              format: date-time
            issued_at:
              type: string
              format: date-time
            observed_at:
              type: string
              format: date-time
            duration_ms:
              type: integer
              minimum: 0
              maximum: 9007199254740991
        signature:
          type: object
          additionalProperties: false
          required:
            - algorithm
            - encoding
            - value
            - key_id
          properties:
            algorithm:
              const: ed25519
            encoding:
              const: base64url
            value:
              type: string
              pattern: ^[A-Za-z0-9_-]{85}[AQgw]$
              description: >-
                An unpadded canonical base64url encoding of the 64-byte Ed25519
                signature.
            key_id:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/id'
            signer:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/actor'
            signed_at:
              type: string
              format: date-time
        integrity:
          type: object
          additionalProperties: false
          required:
            - content_hash
          properties:
            content_hash:
              $ref: '#/components/schemas/AgentWorkReceipt/$defs/content_hash'
              description: >-
                Digest of RFC 8785 canonical JSON for this receipt with the
                integrity property omitted.
            signatures:
              type: array
              minItems: 1
              maxItems: 100
              description: >-
                Ed25519 signatures over the domain-separated
                agent-work-receipt-signature/v0.1 canonical payload. Key
                resolution and signer trust are consumer policy.
              items:
                $ref: '#/components/schemas/AgentWorkReceipt/$defs/signature'
        content_hash:
          type: object
          additionalProperties: false
          required:
            - algorithm
            - value
          properties:
            algorithm:
              enum:
                - sha-256
                - sha256
            value:
              type: string
              minLength: 1
              maxLength: 128
            encoding:
              type: string
              enum:
                - hex
                - base64
                - base64url
          oneOf:
            - not:
                properties:
                  encoding: true
                required:
                  - encoding
              properties:
                value:
                  type: string
                  pattern: ^[0-9A-Fa-f]{64}$
            - required:
                - encoding
              properties:
                encoding:
                  const: hex
                value:
                  type: string
                  pattern: ^[0-9A-Fa-f]{64}$
            - required:
                - encoding
              properties:
                encoding:
                  const: base64
                value:
                  type: string
                  pattern: ^[A-Za-z0-9+/]{42}[AEIMQUYcgkosw048]=$
            - required:
                - encoding
              properties:
                encoding:
                  const: base64url
                value:
                  type: string
                  pattern: ^[A-Za-z0-9_-]{42}[AEIMQUYcgkosw048]$
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'OrgX API key, sent as `Authorization: Bearer oxk_...`'
    cookieAuth:
      type: apiKey
      in: cookie
      name: __session
      description: Session cookie from web authentication

````