> ## 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 ledger counterparty of each provider of the tenant

> Returns, for the tenant of the credentials you authenticate with, the ledger account used as the counterparty of the postings of each provider's operations, per ledger. Each configured item is one (ledger, provider, asset). For each provider installed on this deployment and connected to the tenant, the list also carries its BRL default item, with `ledgerId: null`, `isDefault: true`, `accountAlias: "@external/BRL"` and `version: 0`: it applies to every ledger with no configured item, whose postings use `@external/<asset>`. A configured item written back to `@external/<asset>` also reads `isDefault: true`.

A posting of an operation uses the counterparty of the ledger and of the provider recorded on it, never the one of the provider currently on the route. A posting reads the counterparty each time it is presented, so one presented again after a change would carry the new account: while a posting of that provider in that ledger may still be presented again, the write is refused with 422 PBP-0702 reason POSTINGS_IN_FLIGHT. The commit or cancel of a reserve follows the original pending transaction in the ledger.

The counterparty is changed with configureLedgerCounterparty (`provider-routes:configure`). WHO MAY CALL IT: `provider-routes:read`; otherwise 403 PBP-0004.



## OpenAPI

````yaml /en/openapi/v3-current/payments.yaml get /v1/admin/providers/ledger-counterparties
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.


    NOTICES. The webhooks section describes each notice Payments posts to the
    tenant's callback URL. Delivery does not guarantee order: order a boleto's
    notices by the occurredAt member of the body. Notices of one boleto recorded
    together never tie and follow the order of the facts; notices recorded at
    different moments can tie, and in a tie the boleto query tells the current
    state. The same notice can arrive more than once: after verifying its
    signature and its X-Webhook-Timestamp, discard repetitions by the eventId
    member of the body, equal to the X-Webhook-Id header and the same on every
    attempt.
  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: >-
      The notices Payments posts to the tenant's callback URL, one per type
      enabled in enabledEvents, each signed with the configuration's secret.
      Each item describes the body, the delivery headers, when the notice is
      sent and which providers send it.
    name: Notices
  - 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/admin/providers/ledger-counterparties:
    get:
      tags:
        - Admin
      summary: List the ledger counterparty of each provider of the tenant
      description: >-
        Returns, for the tenant of the credentials you authenticate with, the
        ledger account used as the counterparty of the postings of each
        provider's operations, per ledger. Each configured item is one (ledger,
        provider, asset). For each provider installed on this deployment and
        connected to the tenant, the list also carries its BRL default item,
        with `ledgerId: null`, `isDefault: true`, `accountAlias:
        "@external/BRL"` and `version: 0`: it applies to every ledger with no
        configured item, whose postings use `@external/<asset>`. A configured
        item written back to `@external/<asset>` also reads `isDefault: true`.


        A posting of an operation uses the counterparty of the ledger and of the
        provider recorded on it, never the one of the provider currently on the
        route. A posting reads the counterparty each time it is presented, so
        one presented again after a change would carry the new account: while a
        posting of that provider in that ledger may still be presented again,
        the write is refused with 422 PBP-0702 reason POSTINGS_IN_FLIGHT. The
        commit or cancel of a reserve follows the original pending transaction
        in the ledger.


        The counterparty is changed with configureLedgerCounterparty
        (`provider-routes:configure`). WHO MAY CALL IT: `provider-routes:read`;
        otherwise 403 PBP-0004.
      operationId: listLedgerCounterparties
      parameters:
        - description: >-
            Tenant organization ID. Optional. The organization context is
            determined by the credentials you authenticate with; this header
            does not select or change it.
          in: header
          name: X-Organization-Id
          schema:
            description: >-
              Tenant organization ID. Optional. The organization context is
              determined by the credentials you authenticate with; this header
              does not select or change it.
            format: uuid
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LedgerCounterpartyList'
          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: >-
            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:
    LedgerCounterpartyList:
      additionalProperties: false
      properties:
        items:
          description: >-
            One item per configured (ledger, provider, asset), plus the BRL
            default item (ledgerId null) of each installed provider connected to
            the tenant, ordered by provider, asset and ledger, with the default
            item first.
          items:
            $ref: '#/components/schemas/LedgerCounterparty'
          type:
            - array
            - 'null'
      required:
        - items
      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
    LedgerCounterparty:
      additionalProperties: false
      properties:
        accountAlias:
          description: >-
            Alias of the ledger account, with the leading @ of the Midaz alias;
            @external/<asset> is the default counterparty.
          examples:
            - '@external/BRL'
          maxLength: 100
          minLength: 2
          type: string
        assetCode:
          description: Asset code in the ledger.
          examples:
            - BRL
          maxLength: 10
          minLength: 3
          pattern: ^[A-Z]{3,10}$
          type: string
        isDefault:
          description: >-
            True when the postings of the (ledger, provider, asset) use
            @external/<asset>: no counterparty is configured, or the configured
            one is @external/<asset>.
          examples:
            - false
          type: boolean
        ledgerId:
          description: >-
            Midaz ledger of the counterparty. Null only on the default item of
            the tenant list, which applies to every ledger with no configured
            counterparty.
          examples:
            - 0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a6c
          maxLength: 100
          type:
            - string
            - 'null'
        providerType:
          description: Provider whose operations post against the counterparty.
          examples:
            - BTG
          maxLength: 20
          type: string
        updatedAt:
          description: >-
            When the counterparty was last written, in UTC. Null when never
            configured.
          examples:
            - '2026-11-07T14:05:09Z'
          format: date-time
          type:
            - string
            - 'null'
        version:
          description: >-
            Version of this (tenant, ledger, provider, asset) counterparty. 0
            when never configured. Incremented by every accepted write. A write
            sends it back; a stale one is refused with 409 PBP-0705.
          examples:
            - 1
          format: int64
          minimum: 0
          type: integer
      required:
        - ledgerId
        - providerType
        - assetCode
        - accountAlias
        - isDefault
        - version
      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.