> ## Documentation Index
> Fetch the complete documentation index at: https://developers.portao3.com.br/llms.txt
> Use this file to discover all available pages before exploring further.

# Cancel a Pix Automatic authorization

> Cancels a Pix Automático authorization: the payer can no longer grant it, and no further charge is made.

The authorization moves to `CANCELED`, and so do its charges still `CREATED` or `SCHEDULED` — the ones already sent to the payer's bank are canceled there first; paid, failed and expired charges keep their status. A charge already sent to the payer's bank can't be canceled on or after its date. Canceling an authorization that is already `CANCELED`, `REVOKED` or `EXPIRED` changes nothing and also answers `204`.

While the payer is in the middle of granting it, it can't be canceled: try again in a few minutes. If canceling one of its charges at the payer's bank fails, the authorization is already `CANCELED` and the answer is that failure; that charge keeps its status, and calling again answers `204` without retrying it. Check `schedules` with `GET .../pix-billing-automatic/{pixBillingAutomaticId}`.

Use `default` as `walletId` for the organization's main wallet. Any member of the organization can cancel one.


## OpenAPI

````yaml /api-reference/banking.openapi.json post /realms/{realmId}/organizations/{organizationId}/accounts/{accountId}/wallets/{walletId}/pix-billing-automatic/{pixBillingAutomaticId}/cancel
openapi: 3.0.3
info:
  title: Banking
  version: 1.0.0
  description: >-
    Portão 3 banking API. Every endpoint requires a bearer token in the
    Authorization header (Authorization: Bearer <token>) unless its page states
    otherwise; see the Authentication guide. That requirement is not repeated
    per endpoint. Generated by tools/openapi from code (routes + security) and
    the hand-written spec (request/response bodies). Banking attaches a zod
    validationSchema at the route; request bodies are resolved from it (object +
    array roots). Responses have no presenter layer, so they stay tier=unknown.
    Confidence tiers: generated:typed=320 copied:manual=0 unknown=8.
servers:
  - url: https://api.banking.v2.portao3.com.br/
    description: production
  - url: https://api.banking.dev.3pers.com.br/
    description: development
security: []
tags:
  - name: Accounts
  - name: Account Limits
  - name: Wallets
  - name: Transaction Limits
  - name: Transfers
  - name: Cards
  - name: Card Limits
  - name: Cards 3DS
  - name: Pix Payments
  - name: Pix Keys
  - name: PIX Charges
  - name: PIX Automatic
  - name: PIX Initiation (Open Finance)
  - name: PIX Infractions (MED)
  - name: Boleto Payments
  - name: Boleto Billing
  - name: TED Payments
  - name: Transactions
  - name: Transaction Reversals
  - name: Spend Review
  - name: Cashback
  - name: Currency Codes
paths:
  /realms/{realmId}/organizations/{organizationId}/accounts/{accountId}/wallets/{walletId}/pix-billing-automatic/{pixBillingAutomaticId}/cancel:
    post:
      tags:
        - PIX Automatic
      summary: Cancel a Pix Automatic authorization
      description: >-
        Cancels a Pix Automático authorization: the payer can no longer grant
        it, and no further charge is made.
      operationId: >-
        postRealmsByRealmIdOrganizationsByOrganizationIdAccountsByAccountIdWalletsByWalletIdPixBillingAutomaticByPixBillingAutomaticIdCancel
      parameters:
        - name: realmId
          in: path
          required: true
          description: |-
            ID of your realm.

            Format: `UUID`
          schema:
            type: string
            format: uuid
          example: f495ff0c-ab54-4f99-8e92-ca8682e4de9b
        - name: organizationId
          in: path
          required: true
          description: |-
            ID of the organization.

            Format: `UUID`
          schema:
            type: string
            format: uuid
          example: c4bd3f21-dfbd-44e8-8055-68ba15bed410
        - name: accountId
          in: path
          required: true
          description: ID of the organization's account (24 hexadecimal characters).
          schema:
            type: string
            pattern: ^[0-9a-fA-F]{24}$
          example: 66f2a1c7b4d3e80012c9a0b4
        - name: walletId
          in: path
          required: true
          description: >-
            ID of the wallet that receives the payments (24 hexadecimal
            characters), or `default` for the organization's main wallet.
          schema:
            type: string
            pattern: ^([0-9a-fA-F]{24}|default)$
          example: 66f2a3d1b4d3e80012c9a0d2
        - name: pixBillingAutomaticId
          in: path
          required: true
          description: ID of the authorization — its `_id` (24 hexadecimal characters).
          schema:
            type: string
            pattern: ^[0-9a-fA-F]{24}$
          example: 6729f3e1b4d3e80012c9a7c1
        - name: x-environment
          in: header
          required: false
          description: >-
            Environment of the authorization: `LIVE` (production) or `TEST`
            (sandbox). When you omit it, `TEST` is used; any other value is
            rejected.
          schema:
            type: string
            enum:
              - LIVE
              - TEST
          example: LIVE
      responses:
        '204':
          description: No Content. The operation succeeded and the response has no body.
        '400':
          description: >-
            `AUTOMATIC_PIX_PAYMENT_CANCEL_SAME_DATE` — One of its charges is due
            today or overdue: the payer's bank is already debiting it.
          content:
            application/json:
              schema:
                type: object
                properties:
                  traceId:
                    type: string
                    description: >-
                      Identifier of the request that failed. Quote it when
                      contacting support.
                    example: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                  code:
                    type: string
                    enum:
                      - AUTOMATIC_PIX_PAYMENT_CANCEL_SAME_DATE
                    description: >-
                      Stable, machine-readable error code. Branch on this, never
                      on `message`.
                  origin:
                    type: string
                    enum:
                      - BANKING
                    description: Service that produced the error.
                  message:
                    type: string
                    description: >-
                      Human-readable explanation. Its wording may change without
                      notice.
                required:
                  - traceId
                  - code
                  - origin
                  - message
              example:
                traceId: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                code: AUTOMATIC_PIX_PAYMENT_CANCEL_SAME_DATE
                origin: BANKING
                message: Cannot cancel a payment on or after its payment date
        '404':
          description: >-
            `ACCOUNT_NOT_FOUND` — No account with this ID exists in the
            organization.


            `WALLET_NOT_FOUND` — The account has no wallet with this ID in this
            environment — or, with `walletId` `default`, no main wallet.


            `PIX_BILLING_AUTOMATIC_NOT_FOUND` — The wallet has no authorization
            with this ID in this environment.
          content:
            application/json:
              schema:
                type: object
                properties:
                  traceId:
                    type: string
                    description: >-
                      Identifier of the request that failed. Quote it when
                      contacting support.
                    example: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                  code:
                    type: string
                    enum:
                      - ACCOUNT_NOT_FOUND
                      - WALLET_NOT_FOUND
                      - PIX_BILLING_AUTOMATIC_NOT_FOUND
                    description: >-
                      Stable, machine-readable error code. Branch on this, never
                      on `message`.
                  origin:
                    type: string
                    enum:
                      - BANKING
                    description: Service that produced the error.
                  message:
                    type: string
                    description: >-
                      Human-readable explanation. Its wording may change without
                      notice.
                required:
                  - traceId
                  - code
                  - origin
                  - message
              example:
                traceId: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                code: ACCOUNT_NOT_FOUND
                origin: BANKING
                message: Account not found
        '409':
          description: >-
            `PIX_BILLING_AUTOMATIC_NOT_CANCELABLE` — The payer is in the middle
            of granting the authorization. Nothing changed; try again in a few
            minutes.


            `AUTOMATIC_PIX_PAYMENT_NOT_CANCELLABLE` — One of its charges is
            already being processed by the payer's bank.
          content:
            application/json:
              schema:
                type: object
                properties:
                  traceId:
                    type: string
                    description: >-
                      Identifier of the request that failed. Quote it when
                      contacting support.
                    example: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                  code:
                    type: string
                    enum:
                      - PIX_BILLING_AUTOMATIC_NOT_CANCELABLE
                      - AUTOMATIC_PIX_PAYMENT_NOT_CANCELLABLE
                    description: >-
                      Stable, machine-readable error code. Branch on this, never
                      on `message`.
                  origin:
                    type: string
                    enum:
                      - BANKING
                    description: Service that produced the error.
                  message:
                    type: string
                    description: >-
                      Human-readable explanation. Its wording may change without
                      notice.
                required:
                  - traceId
                  - code
                  - origin
                  - message
              example:
                traceId: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                code: PIX_BILLING_AUTOMATIC_NOT_CANCELABLE
                origin: BANKING
                message: >-
                  Automatic Pix Request 2d902e74-7ca0-4f6c-9c83-4b5e6f708192 is
                  not in a valid state to be canceled
        '422':
          description: >-
            `BAD_REQUEST` — A path parameter is not a valid ID; `fields` lists
            each one.
          content:
            application/json:
              schema:
                type: object
                properties:
                  traceId:
                    type: string
                    description: >-
                      Identifier of the request that failed. Quote it when
                      contacting support.
                    example: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                  code:
                    type: string
                    enum:
                      - BAD_REQUEST
                    description: >-
                      Stable, machine-readable error code. Branch on this, never
                      on `message`.
                  origin:
                    type: string
                    enum:
                      - BANKING
                    description: Service that produced the error.
                  message:
                    type: string
                    description: >-
                      Human-readable explanation. Its wording may change without
                      notice.
                  fields:
                    type: array
                    description: >-
                      One entry per invalid request field (validation errors
                      only).
                    items:
                      type: object
                      properties:
                        field:
                          type: string
                          description: >-
                            Path of the invalid field, e.g. `label` or
                            `values[0].value`.
                          example: label
                        message:
                          type: string
                          description: Why the field was rejected.
                          example: label is required
                        code:
                          type: string
                          description: >-
                            `<FIELD>_<REASON>` — e.g. `LABEL_REQUIRED`,
                            `TYPE_ONE_OF`, `VALUES_VALUE_TYPE_ERROR`.
                          example: LABEL_REQUIRED
                        values:
                          type: array
                          items:
                            type: string
                          description: >-
                            The accepted values, when the field is an
                            enumeration.
                      required:
                        - field
                        - message
                        - code
                required:
                  - traceId
                  - code
                  - origin
                  - message
              example:
                traceId: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                code: BAD_REQUEST
                origin: BANKING
                message: >-
                  Bad Request: Your request is invalid or incomplete. Please
                  make sure you are requesting with the right fields.
                fields:
                  - field: organizationId
                    message: Invalid UUID
                    code: ORGANIZATIONID_UUID
        '500':
          description: >-
            `CONNECTION_ERROR` — The payment institution couldn't reach the
            payer's bank. Nothing changed when it failed on the authorization
            itself; retry.


            `INTERNAL_SERVER_ERROR` — An unexpected failure — for example, the
            payment institution didn't answer. If it persists, contact support
            with the `traceId`.
          content:
            application/json:
              schema:
                type: object
                properties:
                  traceId:
                    type: string
                    description: >-
                      Identifier of the request that failed. Quote it when
                      contacting support.
                    example: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                  code:
                    type: string
                    enum:
                      - CONNECTION_ERROR
                      - INTERNAL_SERVER_ERROR
                    description: >-
                      Stable, machine-readable error code. Branch on this, never
                      on `message`.
                  origin:
                    type: string
                    enum:
                      - BANKING
                    description: Service that produced the error.
                  message:
                    type: string
                    description: >-
                      Human-readable explanation. Its wording may change without
                      notice.
                required:
                  - traceId
                  - code
                  - origin
                  - message
              example:
                traceId: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                code: CONNECTION_ERROR
                origin: BANKING
                message: There was a connection error

````

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