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

# Reconciliation report for a rail

> Answers "did we lose a message?" by evaluating E(m) = C(m) + T(m) + R(m) per rail over a declared window. What pages: a non-zero divergence, and a send with no captured return leg past the return-leg window. What does not: a hole in the vendor's sequence, which is counted and listed here.



## OpenAPI

````yaml /en/openapi/v3-current/jd-courier.yaml get /v1/channels/{channelId}/reconciliation
openapi: 3.1.0
info:
  description: >-
    The JD Courier API. Operators use it to manage the engines, the ownership
    map, the delivery modes and bypass of each rail, the retained messages, the
    SPB send journal and reconciliation. Engines use it to resolve the owner of
    a key, claim their Pix Automático recurrences and declare their Pix
    Automático payment legs.
  title: JD Courier API
  version: v1.0.0
servers: []
security:
  - BearerAuth: []
tags:
  - description: >-
      The engine registry: the cores that consume the JD channel through the
      Courier, each with its participant set
    name: Engines
  - description: 'The ownership map: which engine owns each key. Every change is audited.'
    name: ownership
  - description: >-
      The rails: what each declares about itself, its state per tenant, and the
      bypass declaration
    name: channels
  - description: >-
      The engines' side of the ownership map: resolution for the on-us gate,
      authoritative and never advisory, the claim of a Pix Automático recurrence
      the engine holds, and the declaration of a payment leg it holds.
    name: ownership-query
  - description: >-
      The durable message store: redelivery on demand, without asking the vendor
      again
    name: ledger
  - description: >-
      Count reconciliation per rail: E(m) = C(m) + T(m) + R(m), the sequence
      gaps it saw, and the sends whose return leg never arrived
    name: assurance
  - description: >-
      The SPB send journal: every send, written before it leaves, and the sends
      whose outcome is unknown. A by-hand close records an operator's finding
      and never resends.
    name: send-journal
  - description: >-
      Per-(tenant, channel) state an operator acts on: lifting a durable channel
      halt
    name: channel-leases
  - description: >-
      Messages the Courier holds because no engine could receive them. A routing
      or delivery retention leaves by itself once its cause lifts, or when an
      operator asks for its routing decision to be run again.
    name: retained
paths:
  /v1/channels/{channelId}/reconciliation:
    get:
      tags:
        - assurance
      summary: Reconciliation report for a rail
      description: >-
        Answers "did we lose a message?" by evaluating E(m) = C(m) + T(m) + R(m)
        per rail over a declared window. What pages: a non-zero divergence, and
        a send with no captured return leg past the return-leg window. What does
        not: a hole in the vendor's sequence, which is counted and listed here.
      operationId: getReconciliationReport
      parameters:
        - description: >-
            The rail. A value outside the vocabulary, or a rail this build does
            not carry, is a 404.
          in: path
          name: channelId
          required: true
          schema:
            description: >-
              The rail. A value outside the vocabulary, or a rail this build
              does not carry, is a 404.
            type: string
        - description: A specific cycle. Omitted returns the most recent.
          explode: false
          in: query
          name: cycleId
          schema:
            description: A specific cycle. Omitted returns the most recent.
            maxLength: 64
            type: string
        - description: >-
            RFC 3339. With to, lists the sequence gaps of every cycle whose
            window overlaps [from, to), each with its cycle. One bound alone
            leaves the other open. Both omitted list the reported cycle's own
            gaps.
          explode: false
          in: query
          name: from
          schema:
            description: >-
              RFC 3339. With to, lists the sequence gaps of every cycle whose
              window overlaps [from, to), each with its cycle. One bound alone
              leaves the other open. Both omitted list the reported cycle's own
              gaps.
            maxLength: 64
            type: string
        - description: RFC 3339; see from.
          explode: false
          in: query
          name: to
          schema:
            description: RFC 3339; see from.
            maxLength: 64
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReconciliationReport'
          description: OK
        '400':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Bad Request
        '401':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unauthorized
        '403':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Forbidden
        '404':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Not Found
        '500':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Internal Server Error
        '503':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Service Unavailable
components:
  schemas:
    ReconciliationReport:
      additionalProperties: false
      properties:
        channelCount:
          format: int64
          minimum: 0
          type: integer
        channelId:
          enum:
            - spb
            - pix
          type: string
        cycleId:
          maxLength: 64
          type: string
        divergence:
          description: E − (C + T + R). Non-zero is an alert.
          format: int64
          type: integer
        engineCounts:
          description: >-
            C per engine: completed deliveries whose engine is in the message's
            frozen resolved set.
          items:
            $ref: '#/components/schemas/ReconciliationEngineCount'
          type: array
        expectedOutcomeCount:
          description: >-
            E, summed from each message's own stored expectation, never
            recomputed.
          format: int64
          minimum: 0
          type: integer
        generatedAt:
          format: date-time
          type: string
        guaranteesSuspended:
          description: Guarantees suspended during the cycle, typically an active bypass.
          items:
            type: string
          type: array
        historyUnjudgedBefore:
          description: >-
            Set on a channel's first cycle when the channel was registered more
            than a day before reconciliation first ran: nothing captured or sent
            before this instant was judged, and a divergence older than it is
            never reconciled automatically. Null when the cycle judged all it
            could.
          format: date-time
          type:
            - string
            - 'null'
        missingReturnLegs:
          description: >-
            Sends whose return-leg window closed during this cycle with no
            captured message echoing their control identifier. Each one pages.
          items:
            $ref: '#/components/schemas/MissingReturnLeg'
          type: array
        refusedCount:
          format: int64
          minimum: 0
          type: integer
        retainedCount:
          format: int64
          minimum: 0
          type: integer
        returnLegWindowSeconds:
          description: A send with no captured return leg older than this pages.
          format: int64
          minimum: 1
          type: integer
        sequenceGapCount:
          description: >-
            Holes in the channel's own sequence over the cycle, or over the
            range when from/to are given; null when no sequence was measured:
            the rail has none, or no key that arrived could be read as one.
            Counted and exposed, never paged.
          format: int64
          type:
            - integer
            - 'null'
        sequenceGaps:
          description: >-
            The holes, oldest cycle first, each with the cycle that saw it; null
            when no sequence was measured, as for sequenceGapCount. At most
            1000; sequenceGapsTruncated says when there were more.
          items:
            $ref: '#/components/schemas/SequenceGap'
          type:
            - array
            - 'null'
        sequenceGapsTruncated:
          description: >-
            True when sequenceGapCount is larger than the list returned: narrow
            the range to see the rest.
          type: boolean
        sequenceRegressions:
          description: >-
            Arrivals at or below the sequence before them: a reorder or a reset,
            never a gap.
          format: int64
          minimum: 0
          type: integer
        windowEnd:
          format: date-time
          type: string
        windowSeconds:
          description: >-
            The declared window. A divergence inside it may be a message in
            transit; outside it, a loss candidate.
          format: int64
          minimum: 1
          type: integer
        windowStart:
          description: >-
            The capture instants this cycle judged, [windowStart, windowEnd).
            Consecutive cycles tile time.
          format: date-time
          type: string
      required:
        - cycleId
        - channelId
        - windowSeconds
        - windowStart
        - windowEnd
        - generatedAt
        - channelCount
        - expectedOutcomeCount
        - engineCounts
        - retainedCount
        - refusedCount
        - divergence
        - guaranteesSuspended
        - historyUnjudgedBefore
        - sequenceGapCount
        - sequenceGaps
        - sequenceGapsTruncated
        - sequenceRegressions
        - returnLegWindowSeconds
        - missingReturnLegs
      type: object
    Detail:
      additionalProperties: true
      properties:
        code:
          description: >-
            Stable, machine-readable domain error code scoped to the emitting
            service (format: <SERVICE>-NNNN).
          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
    ReconciliationEngineCount:
      additionalProperties: false
      properties:
        delivered:
          format: int64
          minimum: 0
          type: integer
        engineId:
          maxLength: 32
          type: string
      required:
        - engineId
        - delivered
      type: object
    MissingReturnLeg:
      additionalProperties: false
      properties:
        controlId:
          type: string
        engineId:
          maxLength: 32
          type: string
      required:
        - engineId
        - controlId
      type: object
    SequenceGap:
      additionalProperties: false
      properties:
        afterKey:
          type: string
        beforeKey:
          type: string
        cycleId:
          description: The cycle that saw the hole.
          maxLength: 64
          type: string
        missingCount:
          description: >-
            How many sequence numbers are missing, as a decimal string: the
            vendor's counter is twenty digits.
          type: string
      required:
        - cycleId
        - afterKey
        - beforeKey
        - missingCount
      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

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.