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

# Configure the default payment deadline of one provider of the tenant

> Sets the default payment deadline of one provider for the tenant of the credentials you authenticate with, in calendar days after the due date (0 is a deadline on the due date). `days: null` returns to the provider's default: the row stays and its version moves on, as on any accepted write. The write and its history line are recorded in one transaction, with the actor, the instant, the previous and the new days, the reason and the trace.

The setting applies to boletos issued after the write by that provider: single boletos and installment series that carry no `paymentDeadline`, and the items of a batch (`POST /v1/boletos/batches`), whose payment deadline is the due date plus these days, recorded on the boleto and sent to the provider. A `paymentDeadline` sent on a single boleto or a series prevails. Boletos already issued keep the deadline they were issued with. An issuance reads the setting once, a batch once for all its items, so one under way when the setting changes keeps the value it read, and a resend of the same request is answered with the boletos as they were issued. An issuance is refused with 422 PBP-0006 when days past the provider's current maximum are configured, and, with 0 days, when it carries a fine or interest that would start the day after the due date; in a batch, each such item is a problem PBP-0006 and the whole batch is refused with 422 PBP-0123.

VALIDATION. `days` must be null or 0 to 3650, `reason` must not be blank and `version` must not be negative; otherwise 400 PBP-0001, before any write. A provider not installed on this deployment is refused with 422 PBP-0702 reason PROVIDER_NOT_INSTALLED; one that registers no payment deadline, or sets its default itself (LERIAN, from the agreement), with reason CAPABILITY_MISSING; days past the provider's maximum with reason PAYMENT_DEADLINE_ABOVE_MAXIMUM and the maximum in `maxDays`; a provider not connected to the tenant with reason PROVIDER_NOT_CONNECTED. A write of the days already stored (or of null with nothing stored) is refused with reason NO_CHANGE. Writing the provider's default as a number stores it: it stays if the provider's default changes later. Nothing is written on any refusal. A connection that cannot be read answers 503 PBP-0008 and nothing is written. Writes of the same provider are serialized; one that cannot take its turn in time answers 503 PBP-0008, nothing written, and can be resent under the same Idempotency-Key.

OPTIMISTIC CONCURRENCY. `version` must be the current version of the setting (0 when never written), read with getProviderPaymentDeadline. A stale version is refused with 409 PBP-0705.

IDEMPOTENT under Idempotency-Key: a retry with the same key replays the stored 200. A missing or malformed key is refused with 400 PBP-0012.

WHO MAY CALL IT: `provider-routes:configure`; otherwise 403 PBP-0004.



## OpenAPI

````yaml /es/openapi/v3-current/payments.yaml post /v1/admin/providers/{provider_type}/payment-deadline
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/{provider_type}/payment-deadline:
    post:
      tags:
        - Admin
      summary: Configure the default payment deadline of one provider of the tenant
      description: >-
        Sets the default payment deadline of one provider for the tenant of the
        credentials you authenticate with, in calendar days after the due date
        (0 is a deadline on the due date). `days: null` returns to the
        provider's default: the row stays and its version moves on, as on any
        accepted write. The write and its history line are recorded in one
        transaction, with the actor, the instant, the previous and the new days,
        the reason and the trace.


        The setting applies to boletos issued after the write by that provider:
        single boletos and installment series that carry no `paymentDeadline`,
        and the items of a batch (`POST /v1/boletos/batches`), whose payment
        deadline is the due date plus these days, recorded on the boleto and
        sent to the provider. A `paymentDeadline` sent on a single boleto or a
        series prevails. Boletos already issued keep the deadline they were
        issued with. An issuance reads the setting once, a batch once for all
        its items, so one under way when the setting changes keeps the value it
        read, and a resend of the same request is answered with the boletos as
        they were issued. An issuance is refused with 422 PBP-0006 when days
        past the provider's current maximum are configured, and, with 0 days,
        when it carries a fine or interest that would start the day after the
        due date; in a batch, each such item is a problem PBP-0006 and the whole
        batch is refused with 422 PBP-0123.


        VALIDATION. `days` must be null or 0 to 3650, `reason` must not be blank
        and `version` must not be negative; otherwise 400 PBP-0001, before any
        write. A provider not installed on this deployment is refused with 422
        PBP-0702 reason PROVIDER_NOT_INSTALLED; one that registers no payment
        deadline, or sets its default itself (LERIAN, from the agreement), with
        reason CAPABILITY_MISSING; days past the provider's maximum with reason
        PAYMENT_DEADLINE_ABOVE_MAXIMUM and the maximum in `maxDays`; a provider
        not connected to the tenant with reason PROVIDER_NOT_CONNECTED. A write
        of the days already stored (or of null with nothing stored) is refused
        with reason NO_CHANGE. Writing the provider's default as a number stores
        it: it stays if the provider's default changes later. Nothing is written
        on any refusal. A connection that cannot be read answers 503 PBP-0008
        and nothing is written. Writes of the same provider are serialized; one
        that cannot take its turn in time answers 503 PBP-0008, nothing written,
        and can be resent under the same Idempotency-Key.


        OPTIMISTIC CONCURRENCY. `version` must be the current version of the
        setting (0 when never written), read with getProviderPaymentDeadline. A
        stale version is refused with 409 PBP-0705.


        IDEMPOTENT under Idempotency-Key: a retry with the same key replays the
        stored 200. A missing or malformed key is refused with 400 PBP-0012.


        WHO MAY CALL IT: `provider-routes:configure`; otherwise 403 PBP-0004.
      operationId: configureProviderPaymentDeadline
      parameters:
        - description: >-
            Provider whose default payment deadline is read or written, as the
            capabilities read names it. Matched case-insensitively.
          in: path
          name: provider_type
          required: true
          schema:
            description: >-
              Provider whose default payment deadline is read or written, as the
              capabilities read names it. Matched case-insensitively.
            examples:
              - TESTPROV_A
            maxLength: 20
            minLength: 1
            pattern: ^[A-Za-z][A-Za-z0-9_]{0,19}$
            type: string
        - 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: >-
            Client-supplied idempotency key, a UUID. Required: a request without
            it, with a value that is not a UUID, or with the nil UUID
            (00000000-0000-0000-0000-000000000000) is refused with 400 PBP-0012.
            A retry with the same key replays the stored 2xx answer.
          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
              (00000000-0000-0000-0000-000000000000) is refused with 400
              PBP-0012. A retry with the same key replays the stored 2xx answer.
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConfigurePaymentDeadlineRequest'
              description: The days, the reason and the version read.
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConfiguredPaymentDeadlineResponse'
          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.
        '409':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: >-
            Conflict. PBP-0705: `version` is stale — another write changed this
            setting since it was read; read again and resend with the current
            version and a NEW Idempotency-Key. While an earlier request under
            the same `Idempotency-Key` is still being processed, a request under
            that key is answered PBP-0007 and is not run. Send it again under
            the SAME key after a short wait: the key answers this code for at
            most five minutes after the earlier request arrived. Afterwards the
            same key answers with the earlier request's stored answer, with 500
            PBP-0002 when that answer cannot be replayed, or, when no answer was
            kept, by running the request. Do not send it under a new key to get
            past this answer: the earlier request may still take effect.
        '413':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Request Entity Too Large
        '415':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: 'Unsupported Media Type. PBP-0022: the body is not JSON.'
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProviderRouteRejectedProblem'
          description: >-
            Unprocessable Entity. PBP-0702: the payment deadline write was
            refused; `reason` says why (NO_CHANGE, PROVIDER_NOT_INSTALLED,
            CAPABILITY_MISSING, PAYMENT_DEADLINE_ABOVE_MAXIMUM with `maxDays`,
            PROVIDER_NOT_CONNECTED). PBP-0013: the Idempotency-Key was already
            used with a different request.
        '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 the same request again
            with the same Idempotency-Key.
      security:
        - BearerAuth: []
components:
  schemas:
    ConfigurePaymentDeadlineRequest:
      additionalProperties: false
      properties:
        days:
          description: >-
            Calendar days after the due date; 0 is a deadline on the due date.
            Null returns to the provider's default. Required: send null
            explicitly to return to the default. Above the provider's maxDays is
            refused with 422 PBP-0702 reason PAYMENT_DEADLINE_ABOVE_MAXIMUM.
          examples:
            - 10
          format: int64
          maximum: 3650
          minimum: 0
          type:
            - integer
            - 'null'
        reason:
          description: >-
            Why the deadline is changed. Recorded in the history. Blank is
            refused with 400 PBP-0001.
          examples:
            - Shorter collection window for this portfolio.
          maxLength: 500
          minLength: 1
          pattern: \S
          type: string
        version:
          description: The setting's current version, as read; 0 when never written.
          examples:
            - 0
          format: int64
          minimum: 0
          type: integer
      required:
        - days
        - reason
        - version
      type: object
    ConfiguredPaymentDeadlineResponse:
      additionalProperties: false
      properties:
        aboveMaximum:
          description: >-
            True when the configured days are past maxDays: the provider's
            maximum fell below them after they were written. Write days within
            maxDays, or return to the default.
          examples:
            - false
          type: boolean
        changeId:
          description: Identifier of the history line this write recorded.
          examples:
            - 019a5c1e-2b3d-7f4a-8c5d-6e7f8a9b0c1d
          format: uuid
          type: string
        days:
          description: >-
            Calendar days after the due date of the payment deadline in force; 0
            is a deadline on the due date. The tenant's days, or
            providerDefaultDays when it configured none.
          examples:
            - 30
          format: int64
          minimum: 0
          type: integer
        isDefault:
          description: >-
            True when no days are configured for the provider, or they were
            returned to the default: the provider's default applies.
          examples:
            - true
          type: boolean
        maxDays:
          description: >-
            Furthest deadline the provider accepts, in calendar days after the
            due date. A write above it is refused with 422 PBP-0702 reason
            PAYMENT_DEADLINE_ABOVE_MAXIMUM.
          examples:
            - 365
          format: int64
          minimum: 0
          type: integer
        providerDefaultDays:
          description: >-
            Default payment deadline the provider declares, in calendar days
            after the due date.
          examples:
            - 30
          format: int64
          minimum: 0
          type: integer
        providerType:
          description: Provider the setting belongs to.
          examples:
            - BTG
          maxLength: 20
          type: string
        updatedAt:
          description: When the setting was last written, in UTC. Null when never written.
          examples:
            - '2026-11-15T14:05:09Z'
          format: date-time
          type:
            - string
            - 'null'
        updatedByType:
          description: Kind of principal of the last write. Null when never written.
          enum:
            - USER
            - MACHINE
            - SYSTEM
          examples:
            - USER
          type:
            - string
            - 'null'
        version:
          description: >-
            Version of this (tenant, provider) setting. 0 when never written.
            Incremented by every accepted write, including a return to the
            default. A write sends it back; a stale one is refused with 409
            PBP-0705.
          examples:
            - 0
          format: int64
          minimum: 0
          type: integer
      required:
        - changeId
        - providerType
        - days
        - isDefault
        - providerDefaultDays
        - maxDays
        - aboveMaximum
        - version
        - updatedAt
        - updatedByType
      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
    ProviderRouteRejectedProblem:
      allOf:
        - $ref: '#/components/schemas/Detail'
        - properties:
            maxDays:
              description: >-
                The provider's maximum payment deadline, in calendar days after
                the due date. Present only with reason
                PAYMENT_DEADLINE_ABOVE_MAXIMUM.
              minimum: 0
              type: integer
            reason:
              description: >-
                Why the route, counterparty or payment deadline write was
                refused (PBP-0702 only). ACCOUNT_NOT_FOUND,
                ACCOUNT_NOT_EXTERNAL, ACCOUNT_ASSET_MISMATCH, POSTINGS_IN_FLIGHT
                and LEDGER_COUNTERPARTY_CONFLICT only on the counterparty write;
                PAYMENT_DEADLINE_ABOVE_MAXIMUM only on the payment deadline
                write.
              enum:
                - PROVIDER_NOT_CONNECTED
                - CAPABILITY_MISSING
                - PROVIDER_NOT_INSTALLED
                - UNKNOWN_OPERATION
                - NO_CHANGE
                - PROVIDER_SWITCH_UNAVAILABLE
                - ACCOUNT_NOT_FOUND
                - ACCOUNT_NOT_EXTERNAL
                - ACCOUNT_ASSET_MISMATCH
                - POSTINGS_IN_FLIGHT
                - LEDGER_COUNTERPARTY_CONFLICT
                - PAYMENT_DEADLINE_ABOVE_MAXIMUM
              type: string
          type: object
      description: >-
        Problem document of the configure 422 (route, ledger counterparty and
        payment deadline). `reason` is present only when code is PBP-0702; the
        counterparty write answers only NO_CHANGE, PROVIDER_NOT_INSTALLED,
        PROVIDER_NOT_CONNECTED, ACCOUNT_NOT_FOUND, ACCOUNT_NOT_EXTERNAL,
        ACCOUNT_ASSET_MISMATCH, POSTINGS_IN_FLIGHT or
        LEDGER_COUNTERPARTY_CONFLICT; the payment deadline write only NO_CHANGE,
        PROVIDER_NOT_INSTALLED, CAPABILITY_MISSING,
        PAYMENT_DEADLINE_ABOVE_MAXIMUM or PROVIDER_NOT_CONNECTED.
    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.