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

# List the outbox facts this gateway destroyed

> Walks the terminal INVALID rows of this tenant's outbox, oldest first: the money facts this gateway DESTROYED.

A row here will never be published. Nothing retries it, and switching a relay on afterwards recovers nothing, so this page is a record rather than a queue. Nothing on this operation can move a fact: it is a read, and a screen that could retry a row would be a second publisher racing the dispatcher.

The event PAYLOAD never leaves the store. It is the whole envelope of the fact, business data and CPF included, and an operator deciding what to do about a destroyed fact does not need its body. The recorded failure text does not leave either: it travels as 'last_error_class', a MECHANISM, because a publish error can carry a tenant identifier, a contract number or a rail payload. 'unclassified' covers both a message no rule recognises and a row with no message at all, which are the same thing to an operator.

'event_type' is the stable relay type the dispatcher routed on, not the business fact's name: the concrete fact rides inside the envelope this read never opens. 'id' is what an operator quotes when asking for a fact to be replayed by hand.

There is deliberately NO status filter and NO time window. INVALID is the only status a cursor is correct over, because it is the only one nothing moves a row out of, and a window would hide exactly the old destroyed fact nobody ever noticed, which is what this surface exists to show.

Paging is keyset over the row's creation instant and its id. Send the previous page's page.next_after as after. has_more is true exactly when another page exists, and next_after is null exactly when it is false, so a client loop may terminate on either. The cursor never expires; a cursor this service did not mint is refused with 422 rather than silently restarting the scan from the top.

It answers from a LOCAL table and never reaches the Dataprev rail, so it cannot answer 501. The tenant is derived from the validated identity and is never read from the request.



## OpenAPI

````yaml /en/openapi/v3-current/consignado.yaml get /v1/consignado/event-delivery/invalid
openapi: 3.1.0
info:
  contact:
    email: contact@lerian.studio
    name: Lerian Studio
    url: https://lerian.studio
  description: >-
    OpenAPI 3.1 surface for Lerian Consignado — Dataprev. The API covers tenant
    credentials and rail configuration, worker margin, loan auctions and bids,
    contract registration and lifecycle, disbursement confirmation, portability,
    refinancing, renegotiation, FGTS guarantees, reconciliation, funds,
    assignments, usage, throughput, and event subscriptions. Secret material is
    written to the tenant secret store and is never returned by any operation.
  license:
    name: Lerian Studio General License
  title: Lerian Consignado API
  version: v1.0.0
servers:
  - url: https://br-consignado-gw.sandbox.lerian.net
security:
  - BearerAuth: []
tags:
  - description: >-
      Per-tenant Dataprev credential custody and public rail configuration
      (upload, status, rotation, revoke, requester code, and worker portal base
      URL)
    name: Credentials
  - description: >-
      Tenant-scoped consignado gateway usage: priced billable-unit aggregation
      per competência
    name: Consignado Usage
  - description: >-
      Per-tenant streaming-hub subscription control-plane (list, create, get,
      rotate, revoke, and test delivery)
    name: Subscriptions
  - description: >-
      Dataprev payroll-rail surface: FGTS balance and authorization reads, the
      FGTS guarantee execution, contract suspension, reactivation and term
      changes, the rail's own contract documents, and the on-demand reads of
      leilão solicitações, escriturações, repasses and employment terminations
    name: Consignado Rail
  - description: >-
      Synchronous rail command surface: the operations a bancarizador without
      the lender drives over HTTP. Each shares its command implementation with
      the equivalent lender event trigger.
    name: Consignado Rail Commands
  - description: >-
      Gateway-owned disbursement confirmation: a client bank recording money it
      has ALREADY paid to a worker. It crosses no government boundary and
      proxies no Dataprev operation.
    name: Consignado Disbursement
  - description: >-
      Per-tenant self-service outbound Dataprev rail throughput: read and set
      this tenant's own requests-per-second, including a deliberate pause at
      zero
    name: Consignado Throughput
paths:
  /v1/consignado/event-delivery/invalid:
    get:
      tags:
        - Consignado Event Delivery
      summary: List the outbox facts this gateway destroyed
      description: >-
        Walks the terminal INVALID rows of this tenant's outbox, oldest first:
        the money facts this gateway DESTROYED.


        A row here will never be published. Nothing retries it, and switching a
        relay on afterwards recovers nothing, so this page is a record rather
        than a queue. Nothing on this operation can move a fact: it is a read,
        and a screen that could retry a row would be a second publisher racing
        the dispatcher.


        The event PAYLOAD never leaves the store. It is the whole envelope of
        the fact, business data and CPF included, and an operator deciding what
        to do about a destroyed fact does not need its body. The recorded
        failure text does not leave either: it travels as 'last_error_class', a
        MECHANISM, because a publish error can carry a tenant identifier, a
        contract number or a rail payload. 'unclassified' covers both a message
        no rule recognises and a row with no message at all, which are the same
        thing to an operator.


        'event_type' is the stable relay type the dispatcher routed on, not the
        business fact's name: the concrete fact rides inside the envelope this
        read never opens. 'id' is what an operator quotes when asking for a fact
        to be replayed by hand.


        There is deliberately NO status filter and NO time window. INVALID is
        the only status a cursor is correct over, because it is the only one
        nothing moves a row out of, and a window would hide exactly the old
        destroyed fact nobody ever noticed, which is what this surface exists to
        show.


        Paging is keyset over the row's creation instant and its id. Send the
        previous page's page.next_after as after. has_more is true exactly when
        another page exists, and next_after is null exactly when it is false, so
        a client loop may terminate on either. The cursor never expires; a
        cursor this service did not mint is refused with 422 rather than
        silently restarting the scan from the top.


        It answers from a LOCAL table and never reaches the Dataprev rail, so it
        cannot answer 501. The tenant is derived from the validated identity and
        is never read from the request.
      operationId: listConsignadoInvalidEvents
      parameters:
        - description: >-
            The previous page's page.next_after. Omitted starts at the oldest
            destroyed fact. A cursor this service did not mint is refused, never
            restarted from the top.
          explode: false
          in: query
          name: after
          schema:
            description: >-
              The previous page's page.next_after. Omitted starts at the oldest
              destroyed fact. A cursor this service did not mint is refused,
              never restarted from the top.
            examples:
              - >-
                eyJ2IjoxLCJyIjoiYm9hcmQiLCJ0IjoiMjAyNi0wOC0xNFQwOToxMjozM1oiLCJrIjpbImMwMDEyIl19
            type: string
        - description: >-
            Maximum number of destroyed facts to return. Omitted means the
            ceiling of 200.
          explode: false
          in: query
          name: limit
          schema:
            description: >-
              Maximum number of destroyed facts to return. Omitted means the
              ceiling of 200.
            examples:
              - 50
            format: int64
            maximum: 200
            minimum: 1
            type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidEventsPage'
          description: OK
        '401':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unauthorized
        '403':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Forbidden
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unprocessable Entity
        '429':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Too Many Requests
        '500':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Internal Server Error
      security:
        - BearerAuth: []
components:
  schemas:
    InvalidEventsPage:
      additionalProperties: false
      properties:
        items:
          items:
            $ref: '#/components/schemas/InvalidEventItem'
          type: array
        page:
          $ref: '#/components/schemas/KeysetPageMetadata'
      required:
        - items
        - page
      type: object
    Detail:
      additionalProperties: false
      properties:
        code:
          description: >-
            Stable, machine-readable domain error code scoped to the emitting
            service (format: <SERVICE>-NNNN).
          examples:
            - ERR-0001
          type: string
        detail:
          description: >-
            A human-readable explanation specific to this occurrence of the
            problem.
          examples:
            - Property foo is required but is missing.
          type: string
        errors:
          description: Optional list of individual error details
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type:
            - array
            - 'null'
        instance:
          description: >-
            A URI reference that identifies the specific occurrence of the
            problem.
          examples:
            - https://example.com/error-log/abc123
          format: uri
          type: string
        status:
          description: HTTP status code
          examples:
            - 400
          format: int64
          type: integer
        title:
          description: >-
            A short, human-readable summary of the problem type. This value
            should not change between occurrences of the error.
          examples:
            - Bad Request
          type: string
        type:
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          examples:
            - https://example.com/errors/example
          format: uri
          type: string
        upstream:
          $ref: '#/components/schemas/Upstream'
          description: >-
            RFC 9457 extension member: the error a proxied third-party provider
            reported. Absent unless the emitting service explicitly surfaced
            one.
      type: object
    InvalidEventItem:
      additionalProperties: false
      properties:
        aggregate_id:
          description: The entity the fact was about.
          examples:
            - 99999999999AN1
          type: string
        attempts:
          description: How many dispatch attempts were spent before the row went terminal.
          examples:
            - 5
          format: int64
          type: integer
        created_at:
          description: When the fact was written, in UTC.
          examples:
            - '2026-08-14T09:12:33Z'
          format: date-time
          type: string
        event_type:
          description: >-
            The stable relay type the dispatcher routed on, not the business
            fact's name.
          examples:
            - consignado.averbacao.confirmed
          type: string
        id:
          description: >-
            The outbox row's own identity, which is what an operator quotes when
            asking for the fact to be replayed by hand.
          examples:
            - 0192f1a0-0000-7000-8000-00000000d301
          type: string
        last_error_class:
          description: >-
            The class of the last recorded failure. Never the error message,
            which can carry a tenant identifier, a contract number or a rail
            payload.
          enum:
            - serialization
            - broker_refused
            - broker_unreachable
            - tenant_unresolved
            - unclassified
          examples:
            - serialization
          type: string
        updated_at:
          description: When the row last changed status, in UTC.
          examples:
            - '2026-08-14T09:18:02Z'
          format: date-time
          type: string
      required:
        - id
        - event_type
        - aggregate_id
        - attempts
        - last_error_class
        - created_at
        - updated_at
      type: object
    KeysetPageMetadata:
      additionalProperties: false
      properties:
        after:
          description: >-
            The cursor this page resumed from, echoed back. Null when the read
            started at the beginning.
          examples:
            - >-
              eyJ2IjoxLCJyIjoiYm9hcmQiLCJ0IjoiMjAyNi0wOC0xNFQwOToxMjozM1oiLCJrIjpbImMwMDEyIl19
          type:
            - string
            - 'null'
        has_more:
          description: Whether at least one further page exists.
          examples:
            - true
          type: boolean
        next_after:
          description: >-
            The cursor for the page after this one. Null exactly when has_more
            is false.
          examples:
            - >-
              eyJ2IjoxLCJyIjoiYm9hcmQiLCJ0IjoiMjAyNi0wOC0xNFQwOTowNzo1MVoiLCJrIjpbImMwMDM3Il19
          type:
            - string
            - 'null'
      required:
        - after
        - next_after
        - has_more
      type: object
    ErrorDetail:
      additionalProperties: false
      properties:
        location:
          description: >-
            Where the error occurred, e.g. 'body.items[3].tags' or
            'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        value:
          description: The value at the given location
      type: object
    Upstream:
      additionalProperties: false
      properties:
        code:
          description: The upstream provider's own error code, verbatim.
          examples:
            - E4001
          type: string
        message:
          description: >-
            The upstream provider's own error message, verbatim (bounded, never
            its raw response body).
          examples:
            - account not found at provider
          type: string
      type: object
  securitySchemes:
    BearerAuth:
      bearerFormat: JWT
      description: JWT bearer token issued by the identity provider.
      scheme: bearer
      type: http

````