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

# Reconnect a disconnected provider

> Takes a provider out of the disconnected state for the tenant of your credentials.

<Info>**Providers:** Lerian (PCR) and BTG.</Info>

<Warning>**Under development.** This endpoint can change before it is released.</Warning>

**How it works**

- If the revocation of the last disconnect is still pending, the reconnect is refused and nothing is recorded. Repeat the disconnect until it answers `200`, then reconnect.
- It records the reconnection with the actor and the reason, then syncs the provider credential once.
- `credentialActive` says whether the tenant holds a usable credential after that sync. A failed sync is not an error: it is retried later. A provider that does not connect through a credential answers `false`.
- The route does not change.
- A provider that is not disconnected answers `outcome: ALREADY_CONNECTED`, and the call is recorded too.
- A retry under the same `Idempotency-Key` returns the stored answer of a completed call. A refusal releases the key, so a corrected retry under the same key runs again.
- `provider_type` is matched case-insensitively, as `GET /v1/admin/providers/capabilities` names it.
- Requires the `admin:create` permission, held by `editor`.



## OpenAPI

````yaml /es/openapi/v3-current/payments-pcr.yaml post /v1/admin/providers/{provider_type}/reconnect
openapi: 3.1.0
info:
  title: Payments PCR preview
  version: 2026-11-23-preview
  description: >-
    Preview of Payments with boleto collections through Lerian (PCR), CNAB 240,
    electronic payers (DDA), bill payments, and shared administration. This
    reference includes current behavior and planned changes. Read each
    operation's provider information: some operations support BTG only today.
    The preview is under development and can change before release. Confirm
    availability with Lerian before integration.


    The webhooks section describes notices Payments sends to your callback URL.
    Verify the signature and timestamp before processing a notice. Use the
    eventId and X-Webhook-Id described by each notice to detect repeated
    delivery. Do not assume delivery order.
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
  - name: CNAB Agreements
    description: >-
      CNAB agreements: the link between a Lerian-provider collections agreement
      and the CNAB 240 Lerian files of one account, with its remittance and
      return sequence numbers (NSA) and its return cut times. Every operation of
      this section answers 422 PBP-0900 to a tenant without CNAB 240 enabled.
  - name: CNAB Remittances
    description: >-
      CNAB remittances: the CNAB 240 Lerian remittance files of an organization,
      each received whole, validated and stored encrypted, its title lines
      executed afterwards. A file already received is answered with its stored
      receipt; a new one answers 422 PBP-0900 to a tenant without CNAB 240
      enabled.
  - name: CNAB Returns
    description: >-
      CNAB 240 Lerian return files, one per agreement and cut, built from the
      journal of what happened to the titles that entered by remittance, and
      their download. Every operation of this section answers 422 PBP-0900 to a
      tenant without CNAB 240 enabled.
  - description: >-
      Boleto collections agreements and their reconciliation with the
      beneficiary base of the PCR: the consumption of each beneficiary inventory
      the PCR publishes and the divergences it raises, which carry only
      agreement and situation attributes, never a document or a name. Every
      operation of this section answers 422 PBP-0830 to a tenant without
      collections enabled.
    name: Collections Agreements
  - description: >-
      Boleto collections audit trail: every operation and configuration action,
      append-only, with its author, instant, reason, evidence and the module's
      fields before and after it. Every operation of this section answers 422
      PBP-0830 to a tenant without collections enabled.
    name: Collections Audit
  - description: >-
      Boleto collections beneficiaries: the enablement of the tenant's accounts
      for collections, in batches of up to 5,000 accounts, and the progress and
      per-item outcome of the enablement and bulk adoption batches. Every
      operation of this section answers 422 PBP-0830 to a tenant without
      collections enabled.
    name: Collections Beneficiaries
  - name: Collections Credit Entries
    description: >-
      Boleto collections credit entries: what the credit of each write-off moves
      in the ledger, one entry per write-off and phase, the RELEASE to the
      available balance of the title's account and the CHARGEBACK of a write-off
      cancelled after its release, with where each entry stands with the ledger
      and, when it is not posted, why, as a closed code and never the ledger's
      own text. Every operation of this section answers 422 PBP-0830 to a tenant
      without collections enabled.
  - description: >-
      Boleto collections operation queues: each case that waits for an operator
      and already has its state in collections, with its reason, since when it
      waits and the operations that act on it, read over the states collections
      keeps rather than from a list of its own. Each queue counts the items
      whose age reached its age limit, a per-tenant operational parameter. Every
      operation of this section answers 422 PBP-0830 to a tenant without
      collections enabled.
    name: Collections Operation Queues
  - description: >-
      Boleto collections commands to the PCR: each registration, change and
      write-off sent to the PCR of the institution, with the idempotency key it
      keeps across attempts, its attempts, its next attempt and the last answer
      that did not accept it, never the body sent. Every operation of this
      section answers 422 PBP-0830 to a tenant without collections enabled.
    name: Collections PCR Commands
  - description: >-
      Boleto collections notice subscription of the tenant's connection to the
      PCR: its synchronization with the PCR, the rotation of the secret the PCR
      signs the notices with, the deliveries of notices the PCR recorded for it,
      and the redelivery of a notice whose delivery failed. Every operation of
      this section answers 422 PBP-0830 to a tenant without collections enabled.
    name: Collections PCR Connection
  - description: >-
      Boleto collections notices received from the PCR: each event the PCR of
      the institution delivered to collections, stored once per connection and
      event, with where its processing stands and what it was matched with,
      never the body received. Every operation of this section answers 422
      PBP-0830 to a tenant without collections enabled.
    name: Collections PCR Notices
  - description: >-
      Boleto collections pooled accounts: the links of accounts that issue under
      the agreement of a pooled account, whose holder stays the beneficiary
      while the account's holder is the final one. A link registers nothing at
      Núclea. Every operation of this section answers 422 PBP-0830 to a tenant
      without collections enabled.
    name: Collections Pooled Accounts
  - description: >-
      Boleto collections setup: the tenant's business settings, with the default
      agreement template, the automatic enablement and the retention periods,
      and the tenant's connection to the PCR of its institution. Every operation
      of this section answers 422 PBP-0830 to a tenant without collections
      enabled.
    name: Collections Settings
  - description: >-
      Boleto collections titles: each boleto collections issues at the PCR of
      the institution, with its four state axes (registration, situation at the
      base, credit and block), never the data of a payer or of a beneficiary.
      The barcode and the digitable line are answered only while the title is
      REGISTERED. Every operation of this section answers 422 PBP-0830 to a
      tenant without collections enabled.
    name: Collections Titles
  - name: Collections Write-offs
    description: >-
      Boleto collections write-offs: each write-off of a collections title the
      PCR of the institution notified, with its route, its settlement, the state
      of its credit, its hold and its cancellation deadline, never the data of a
      payer. Every operation of this section answers 422 PBP-0830 to a tenant
      without collections enabled.
  - description: >-
      Aggregated counts, amounts and breakdowns over a period, for boletos and
      for payments.
    name: Dashboards
  - name: Electronic payers
    description: >-
      Electronic payer (DDA): adhesion of the institution's customer to
      electronic presentment of boletos, its accounts and aggregates, and the
      outcome of each request. Under development: can change before it is
      released.
  - 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. The webhook is the channel of the first
      delivery: delivery will later move to Lerian's Streaming Hub, which will
      then be the only channel, with a change of subscription and a migration
      plan communicated to the client.
    name: Notices
  - description: >-
      Paying bankslips, utility bills and DARF tax slips, and querying those
      payments.
    name: Payments
  - name: Presented boletos
    description: >-
      Boletos of other institutions presented to the electronic payer: list,
      detail, acceptance and authorized third parties. Under development: can
      change before it is released.
paths:
  /v1/admin/providers/{provider_type}/reconnect:
    post:
      tags:
        - Admin
      summary: Reconnect a disconnected provider
      description: >-
        Takes a provider out of the disconnected state for the tenant of your
        credentials.


        <Info>**Providers:** Lerian (PCR) and BTG.</Info>


        <Warning>**Under development.** This endpoint can change before it is
        released.</Warning>


        **How it works**


        - If the revocation of the last disconnect is still pending, the
        reconnect is refused and nothing is recorded. Repeat the disconnect
        until it answers `200`, then reconnect.

        - It records the reconnection with the actor and the reason, then syncs
        the provider credential once.

        - `credentialActive` says whether the tenant holds a usable credential
        after that sync. A failed sync is not an error: it is retried later. A
        provider that does not connect through a credential answers `false`.

        - The route does not change.

        - A provider that is not disconnected answers `outcome:
        ALREADY_CONNECTED`, and the call is recorded too.

        - A retry under the same `Idempotency-Key` returns the stored answer of
        a completed call. A refusal releases the key, so a corrected retry under
        the same key runs again.

        - `provider_type` is matched case-insensitively, as `GET
        /v1/admin/providers/capabilities` names it.

        - Requires the `admin:create` permission, held by `editor`.
      operationId: reconnectProvider
      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
        - description: >-
            Provider to reconnect, as the capabilities read names it. Matched
            case-insensitively.
          in: path
          name: provider_type
          required: true
          schema:
            description: >-
              Provider to reconnect, as the capabilities read names it. Matched
              case-insensitively.
            examples:
              - LERIAN
            maxLength: 20
            minLength: 1
            pattern: ^[A-Za-z][A-Za-z0-9_]{0,19}$
            type: string
        - description: >-
            Client-supplied idempotency key, a UUID. Required: a request without
            it, with a value that is not a UUID, or with the nil UUID is refused
            with 400 PBP-0012.
          in: header
          name: Idempotency-Key
          required: true
          schema:
            description: >-
              Client-supplied idempotency key, a UUID. Required: a request
              without it, with a value that is not a UUID, or with the nil UUID
              is refused with 400 PBP-0012.
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProviderDisconnectionRequest'
              description: Why the provider is reconnected.
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReconnectProviderResponse'
          description: >-
            OK. The provider is reconnected, or was already connected
            (`outcome`). Read `credentialActive` to know whether the credential
            is usable.
        '400':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              examples:
                PBP-0001:
                  summary: 'PBP-0001: Request malformed'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0001
                    title: Bad Request
                    status: 400
                    detail: >-
                      The reason must have 1 to 500 characters of text, not only
                      spaces and without NUL bytes, and the request must carry
                      an identified actor.
                    code: PBP-0001
                PBP-0012:
                  summary: 'PBP-0012: Idempotency-Key missing'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0012
                    title: Idempotency Key Required
                    status: 400
                    detail: The Idempotency-Key header is required for this endpoint.
                    code: PBP-0012
          description: >-
            Bad Request.


            - `PBP-0001`: the `reason` is not 1 to 500 characters of text (only
            spaces, or NUL bytes), or the request has no identified actor.

            - `PBP-0012`: `Idempotency-Key` is missing or is not a UUID.


            See the [error
            list](/es/reference/interfaces/payments-btg/payments-error-list) for
            every code.
        '401':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              examples:
                PBP-0003:
                  summary: 'PBP-0003: Invalid credential'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0003
                    title: Unauthorized
                    status: 401
                    detail: authentication required
                    code: PBP-0003
          description: >-
            Unauthorized.


            - `PBP-0003`: the credential is missing or invalid, or does not
            identify a tenant. Get a valid bearer token.
        '403':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              examples:
                PBP-0004:
                  summary: 'PBP-0004: No permission'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0004
                    title: Forbidden
                    status: 403
                    detail: permission denied
                    code: PBP-0004
          description: >-
            Forbidden.


            - `PBP-0004`: the credential does not have the `admin:create`
            permission.
        '404':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              examples:
                PBP-0005:
                  summary: 'PBP-0005: Provider unknown'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0005
                    title: Not Found
                    status: 404
                    detail: >-
                      The provider is not installed and the tenant has neither a
                      credential nor a disconnect record of it.
                    code: PBP-0005
          description: >-
            Not Found.


            - `PBP-0005`: the provider is not installed, and the tenant has
            neither a credential nor a disconnect record of it.
        '409':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProviderDisconnectBlockedProblem'
              examples:
                PBP-0703:
                  summary: 'PBP-0703: Revocation pending'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0703
                    title: PROVIDER_DISCONNECT_BLOCKED
                    status: 409
                    detail: >-
                      The provider cannot be reconnected while the revocation of
                      its last disconnect is pending. Repeat the disconnect,
                      then reconnect.
                    code: PBP-0703
                    reason: REVOCATION_PENDING
                PBP-0007:
                  summary: 'PBP-0007: Same key still running'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0007
                    title: Request In Progress
                    status: 409
                    detail: >-
                      A request with this idempotency key is already being
                      processed.
                    code: PBP-0007
          description: >-
            Conflict.


            - `PBP-0703`: `reason` `REVOCATION_PENDING`: the revocation of the
            provider's last disconnect has not completed. Repeat the disconnect
            until it answers `200`, then reconnect.

            - `PBP-0007`: an earlier request under the same `Idempotency-Key` is
            still running. Retry under the same key after a short wait: this
            code lasts at most five minutes after the first request arrived.
            After that, the same key returns the stored answer, `500` `PBP-0002`
            when that answer cannot be replayed, or, when no answer was kept,
            runs the request again. Do not switch keys: the earlier request can
            still take effect.


            See the [error
            list](/es/reference/interfaces/payments-btg/payments-error-list) for
            every code.
        '413':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              examples:
                PBP-0010:
                  summary: 'PBP-0010: Body too large'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0010
                    title: Request Entity Too Large
                    status: 413
                    detail: request body too large
                    code: PBP-0010
          description: |-
            Payload Too Large.

            - `PBP-0010`: the body is larger than the size limit.
        '415':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              examples:
                PBP-0022:
                  summary: 'PBP-0022: Body is not JSON'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0022
                    title: Unsupported Media Type
                    status: 415
                    detail: the request body must be JSON
                    code: PBP-0022
          description: |-
            Unsupported Media Type.

            - `PBP-0022`: the body is not JSON.
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unprocessable Entity.
        '500':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              examples:
                PBP-0002:
                  summary: 'PBP-0002: Unexpected failure'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0002
                    title: Internal Server Error
                    status: 500
                    detail: internal error
                    code: PBP-0002
          description: >-
            Internal Server Error.


            - `PBP-0002`: an unexpected failure. The reconnect may or may not
            have taken effect, and a resend under the same key returns `500`
            `PBP-0002` again. A repeated reconnect is safe: send it again under
            a new `Idempotency-Key`. A provider already connected answers
            `outcome: ALREADY_CONNECTED`.
        '503':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              examples:
                PBP-0008:
                  summary: 'PBP-0008: Dependency unavailable'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0008
                    title: Service Unavailable
                    status: 503
                    detail: internal error
                    code: PBP-0008
          description: >-
            Service Unavailable.


            - `PBP-0008`: a dependency (authentication or storage) is
            unavailable. Nothing was processed. Retry under the same
            `Idempotency-Key`.
      security:
        - BearerAuth: []
components:
  schemas:
    ProviderDisconnectionRequest:
      additionalProperties: false
      properties:
        reason:
          description: >-
            Why the provider is disconnected or reconnected. Recorded in the
            disconnect history, also when the call is refused. Must not carry
            personal data or secrets.
          examples:
            - Contrato com o provider encerrado em 30/11.
          maxLength: 500
          minLength: 1
          pattern: \S
          type: string
      required:
        - reason
      type: object
    ReconnectProviderResponse:
      additionalProperties: false
      properties:
        credentialActive:
          description: >-
            Whether the tenant has an active credential of the provider after
            the immediate credential sync. Always false for a provider that does
            not connect through a credential.
          type: boolean
        outcome:
          description: >-
            RECONNECTED, this call took the provider out of the disconnected
            state; ALREADY_CONNECTED, the provider was not disconnected.
          enum:
            - RECONNECTED
            - ALREADY_CONNECTED
          type: string
        providerType:
          description: Provider reconnected.
          examples:
            - LERIAN
          type: string
        reconnectedAt:
          description: >-
            When the provider was reconnected, in UTC. Null on ALREADY_CONNECTED
            when the provider was never disconnected.
          examples:
            - '2026-12-02T13:00:00Z'
          format: date-time
          type:
            - string
            - 'null'
      required:
        - providerType
        - outcome
        - credentialActive
        - reconnectedAt
      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
    ProviderDisconnectBlockedProblem:
      allOf:
        - $ref: '#/components/schemas/Detail'
        - properties:
            openOperations:
              properties:
                boletoBatches:
                  description: Batches with a submission not finalized.
                  format: int64
                  minimum: 0
                  type: integer
                boletos:
                  description: Boletos PENDING or CREATED.
                  format: int64
                  minimum: 0
                  type: integer
                payments:
                  description: Payments in a live status.
                  format: int64
                  minimum: 0
                  type: integer
                pendingNotices:
                  description: Inbound notices accepted and not yet processed.
                  format: int64
                  minimum: 0
                  type: integer
              required:
                - boletos
                - boletoBatches
                - payments
                - pendingNotices
              type: object
            reason:
              description: >-
                Present only on the reconnect refusal: the revocation of the
                last disconnect has not completed.
              enum:
                - REVOCATION_PENDING
              type: string
            routedOperations:
              description: >-
                Operations of the route that point to the provider. Empty when
                only open operations block.
              items:
                enum:
                  - BOLETO_ISSUANCE
                  - BANKSLIP_PAYMENT
                  - BARCODE_BILL_PAYMENT
                  - DARF_PAYMENT
                type: string
              type: array
              uniqueItems: true
          type: object
      description: >-
        Problem document of the disconnect and reconnect 409. On the disconnect,
        `openOperations` and `routedOperations` are present only when code is
        PBP-0703. On the reconnect, PBP-0703 carries `reason` instead.
    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: 'Never returned: the service drops the rejected value.'
      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.