> ## 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 boleto batches

> Lists the boleto batches of the X-Organization-Id organization, most recent first, each with its outcome and counts and without its items; read one batch by its batchId for the items. The outcome, the counts, `closed` and `finished` are derived from the items on every read. The parameters are validated as on GET /v1/boletos: 400 PBP-0001 when page, limit, from or to is malformed or out of range, or when from or to names a day that does not exist, and 422 PBP-0006 when from is after to. An organization with no batch in the window is answered an empty page: `items` is `[]` and `total` is 0. A request refused earlier keeps its own status: 401 or 403 for authentication and authorization, and 400 PBP-0025 when X-Organization-Id is missing or not a canonical UUID.



## OpenAPI

````yaml /pt/openapi/v3-current/payments.yaml get /v1/boletos/batches
openapi: 3.1.0
info:
  description: >-
    API for the Lerian Payments interface via BTG. It covers boleto issuance,
    cancellation, and queries; bill payments (bankslip, utilities, and DARF) and
    queries; aggregated boleto and payment dashboards; provider connection and
    outbound webhook configuration; and the provider webhook receiver for
    settlement events.


    ERROR BODIES. A failed request arrives as an RFC 9457 problem document on
    application/problem+json. Branch on the code member. A license refusal
    carries an LCS code, listed in the License Manager error list.
  title: Payments — via BTG API
  version: 1.0.0
servers:
  - url: https://api.example.com
    description: >-
      Replace the example host with the URL provided during environment
      onboarding.
security: []
tags:
  - description: >-
      Tenant-level setup: connecting the banking provider and configuring where
      status notifications are delivered.
    name: Admin
  - description: Issuing, querying and cancelling boletos, and retrieving the rendered PDF.
    name: Boletos
  - description: >-
      Aggregated counts, amounts and breakdowns over a period, for boletos and
      for payments.
    name: Dashboards
  - description: >-
      Paying bankslips, utility bills and DARF tax slips, and querying those
      payments.
    name: Payments
  - description: >-
      The webhook the payment provider posts settlement events to. Authenticated
      with a credential agreed with the provider, not with the platform identity
      used by the rest of this API.
    name: Settlement
paths:
  /v1/boletos/batches:
    get:
      tags:
        - Boletos
      summary: List boleto batches
      description: >-
        Lists the boleto batches of the X-Organization-Id organization, most
        recent first, each with its outcome and counts and without its items;
        read one batch by its batchId for the items. The outcome, the counts,
        `closed` and `finished` are derived from the items on every read. The
        parameters are validated as on GET /v1/boletos: 400 PBP-0001 when page,
        limit, from or to is malformed or out of range, or when from or to names
        a day that does not exist, and 422 PBP-0006 when from is after to. An
        organization with no batch in the window is answered an empty page:
        `items` is `[]` and `total` is 0. A request refused earlier keeps its
        own status: 401 or 403 for authentication and authorization, and 400
        PBP-0025 when X-Organization-Id is missing or not a canonical UUID.
      operationId: listBoletoBatches
      parameters:
        - description: >-
            Organization whose batches are listed. Required: a request without
            it, or with a value that is not a canonical UUID, is refused with
            400 PBP-0025. Only batches of this organization are listed and
            counted.
          in: header
          name: X-Organization-Id
          schema:
            description: >-
              Organization whose batches are listed. Required: a request without
              it, or with a value that is not a canonical UUID, is refused with
              400 PBP-0025. Only batches of this organization are listed and
              counted.
            type: string
        - description: >-
            Created-from bound, inclusive. A calendar date (YYYY-MM-DD) is a UTC
            day and starts at its first instant; an RFC 3339 date-time with
            offset (e.g. 2026-09-30T00:00:00-03:00) is used as the exact
            instant. A positive offset must be percent-encoded (%2B).
          explode: false
          in: query
          name: from
          schema:
            description: >-
              Created-from bound, inclusive. A calendar date (YYYY-MM-DD) is a
              UTC day and starts at its first instant; an RFC 3339 date-time
              with offset (e.g. 2026-09-30T00:00:00-03:00) is used as the exact
              instant. A positive offset must be percent-encoded (%2B).
            examples:
              - '2026-10-01'
            pattern: >-
              ^[0-9]{4}-[0-9]{2}-[0-9]{2}(T[0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]{1,9})?(Z|[+-][0-9]{2}:[0-9]{2}))?$
            patternDescription: a YYYY-MM-DD date or an RFC 3339 date-time with offset
            type: string
        - description: >-
            Created-to bound, inclusive. A calendar date (YYYY-MM-DD) is a UTC
            day and covers it to its last instant; an RFC 3339 date-time with
            offset (e.g. 2026-09-30T23:59:59.999999-03:00) is used as the exact
            instant. A positive offset must be percent-encoded (%2B).
          explode: false
          in: query
          name: to
          schema:
            description: >-
              Created-to bound, inclusive. A calendar date (YYYY-MM-DD) is a UTC
              day and covers it to its last instant; an RFC 3339 date-time with
              offset (e.g. 2026-09-30T23:59:59.999999-03:00) is used as the
              exact instant. A positive offset must be percent-encoded (%2B).
            examples:
              - '2026-10-31'
            pattern: >-
              ^[0-9]{4}-[0-9]{2}-[0-9]{2}(T[0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]{1,9})?(Z|[+-][0-9]{2}:[0-9]{2}))?$
            patternDescription: a YYYY-MM-DD date or an RFC 3339 date-time with offset
            type: string
        - description: Page number, one-based.
          explode: false
          in: query
          name: page
          schema:
            default: 1
            description: Page number, one-based.
            examples:
              - 1
            format: int64
            minimum: 1
            type: integer
        - description: Items per page.
          explode: false
          in: query
          name: limit
          schema:
            default: 20
            description: Items per page.
            examples:
              - 20
            format: int64
            maximum: 100
            minimum: 1
            type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListBoletoBatchesResponse'
          description: >-
            A page of the organization's batches, most recent first. A page with
            no batch carries an empty items list, never null.
        '400':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Bad Request
        '401':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: >-
            Authentication failed: the request carries no valid credential, or
            the credential does not identify a tenant. The error body is an RFC
            9457 problem document (`application/problem+json`) with error code
            `PBP-0003`. Obtain a valid bearer token and send the request again.
        '403':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: >-
            The authenticated principal is not allowed to perform this request.
            The error body is an RFC 9457 problem document
            (`application/problem+json`) with error code `PBP-0004`: the
            principal lacks permission for this operation, and the permission
            has to be granted before the request can succeed.
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unprocessable Entity
        '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. PBP-0008 means a dependency the request needs,
            authentication or the tenant's storage, is temporarily unavailable.
            The request was not processed; wait and send it again.
      security:
        - BearerAuth: []
components:
  schemas:
    ListBoletoBatchesResponse:
      additionalProperties: false
      properties:
        items:
          description: Batches of the page, most recent first.
          items:
            $ref: '#/components/schemas/BoletoBatchSummary'
          type:
            - array
            - 'null'
        limit:
          description: Items per page.
          examples:
            - 20
          format: int64
          type: integer
        page:
          description: Page number, one-based.
          examples:
            - 1
          format: int64
          type: integer
        total:
          description: Number of batches of the organization that match the filter.
          examples:
            - 42
          format: int64
          type: integer
      required:
        - items
        - page
        - limit
        - total
      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
    BoletoBatchSummary:
      additionalProperties: false
      properties:
        batchId:
          description: Batch identifier.
          examples:
            - 0192a3b4-c5d6-7e8f-9a0b-1c2d3e4f5a6b
          format: uuid
          type: string
        closed:
          description: >-
            Whether every item is SETTLED, CANCELED, INACTIVATED or FAILED:
            nothing else will happen to the batch, payment included. Always
            present. It moves back to false when a cancellation is refused and
            the item returns to CREATED. True implies finished.
          type: boolean
        counts:
          $ref: '#/components/schemas/BoletoBatchCounts'
        createdAt:
          description: When the batch was created, RFC 3339 in UTC.
          examples:
            - '2026-10-14T19:34:00Z'
          format: date-time
          type: string
        finished:
          description: >-
            Whether no item is PENDING: the issuance of the batch is over.
            Always present. It never moves back to false; an overdue item keeps
            it false.
          type: boolean
        ledgerId:
          description: Ledger of the batch and of each item.
          examples:
            - 7c1e5b9a-3d2f-4a6b-8e0c-1f2a3b4c5d6e
          format: uuid
          type: string
        midazAccountId:
          description: Collection account of the batch and of each item.
          examples:
            - 3f9a2c1e-5b7d-4e8f-9a0b-1c2d3e4f5a6b
          type: string
        organizationId:
          description: >-
            Organization the batch was recorded with: always the organization of
            the X-Organization-Id header.
          examples:
            - 0f9d6c2a-1b3e-4f5a-8c7d-6e5f4a3b2c1d
          format: uuid
          type: string
        status:
          $ref: '#/components/schemas/BoletoBatchOutcome'
      required:
        - batchId
        - organizationId
        - ledgerId
        - midazAccountId
        - status
        - closed
        - finished
        - counts
        - createdAt
      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
    BoletoBatchCounts:
      additionalProperties: false
      properties:
        canceled:
          description: Items CANCELED.
          examples:
            - 1
          format: int64
          minimum: 0
          type: integer
        failed:
          description: Items FAILED.
          examples:
            - 1
          format: int64
          minimum: 0
          type: integer
        inactivated:
          description: 'Items INACTIVATED: written off.'
          examples:
            - 0
          format: int64
          minimum: 0
          type: integer
        overdue:
          description: >-
            Items still processing past the service's deadline (overdue: true).
            Never more than processing.
          examples:
            - 0
          format: int64
          minimum: 0
          type: integer
        processing:
          description: Items PENDING, still being issued.
          examples:
            - 1
          format: int64
          minimum: 0
          type: integer
        registered:
          description: 'Items CREATED: registered and available for payment.'
          examples:
            - 2
          format: int64
          minimum: 0
          type: integer
        requested:
          description: 'Number of items requested: the size of the batch.'
          examples:
            - 5
          format: int64
          maximum: 25
          minimum: 1
          type: integer
        settled:
          description: 'Items SETTLED: paid.'
          examples:
            - 0
          format: int64
          minimum: 0
          type: integer
      required:
        - requested
        - processing
        - registered
        - settled
        - canceled
        - inactivated
        - failed
        - overdue
      type: object
    BoletoBatchOutcome:
      description: >-
        Issuance outcome of the batch, derived from its items on every read.
        CREATED: some item is still PENDING. COMPLETED: no item is PENDING and
        none is FAILED. PARTIAL_FAILURE: no item is PENDING and some, not all,
        are FAILED; those carry errorCode and errorMessage. FAILED: every item
        is FAILED. Only issuance moves it: payment, cancellation and write-off
        do not, and it never moves back to CREATED.
      enum:
        - CREATED
        - COMPLETED
        - PARTIAL_FAILURE
        - FAILED
      type: string
  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.