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

> Cancels a scheduled payment before it runs, and returns the schedule with `status` `CANCELLED`.

Only a schedule still `SCHEDULED` can be cancelled. Cancelling one that is already cancelled succeeds and changes nothing — the answer is the same cancelled schedule. The payment the schedule was going to make (the Pix, bank slip or transfer request) is cancelled right after; if that step fails, the schedule stays cancelled, will not run, and the answer is still a success — cancel it again to retry the payment's cancellation. Only an organization admin can cancel it.


## OpenAPI

````yaml /api-reference/scheduling.openapi.json post /realms/{realmId}/organizations/{organizationId}/accounts/{accountId}/wallets/{walletId}/schedules/{scheduleId}/cancel
openapi: 3.0.3
info:
  title: Scheduling
  version: 1.0.0
  description: >-
    Portão 3 scheduling 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). Confidence tiers:
    generated:typed=8 copied:manual=0 unknown=0.
servers:
  - url: https://api.scheduling.v2.portao3.com.br/
    description: production
  - url: https://api.scheduling.dev.3pers.com.br/
    description: development
security: []
tags:
  - name: Schedules
paths:
  /realms/{realmId}/organizations/{organizationId}/accounts/{accountId}/wallets/{walletId}/schedules/{scheduleId}/cancel:
    post:
      tags:
        - Schedules
      summary: Cancel a schedule
      description: >-
        Cancels a scheduled payment before it runs, and returns the schedule
        with `status` `CANCELLED`.
      operationId: >-
        postRealmsByRealmIdOrganizationsByOrganizationIdAccountsByAccountIdWalletsByWalletIdSchedulesByScheduleIdCancel
      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 the wallet belongs to.

            Format: `UUID`
          schema:
            type: string
            format: uuid
          example: c4bd3f21-dfbd-44e8-8055-68ba15bed410
        - name: accountId
          in: path
          required: true
          description: ID of the account (24 hexadecimal characters).
          schema:
            type: string
            pattern: ^[0-9a-fA-F]{24}$
          example: 6702b1e4a9c3d80012f4a7b1
        - name: walletId
          in: path
          required: true
          description: ID of the wallet the schedule pays from (24 hexadecimal characters).
          schema:
            type: string
            pattern: ^[0-9a-fA-F]{24}$
          example: 6702b1e4a9c3d80012f4a7b5
        - name: scheduleId
          in: path
          required: true
          description: |-
            ID of the schedule to cancel.

            Format: `UUID`
          schema:
            type: string
            format: uuid
          example: 3b9f7c2e-5d41-4e8a-9a6f-1c2d3e4f5a6b
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: ID of the schedule.
                    example: 3b9f7c2e-5d41-4e8a-9a6f-1c2d3e4f5a6b
                    format: uuid
                  amount:
                    type: number
                    description: Amount to pay, in cents (BRL).
                    example: 150000
                  scheduledAt:
                    type: string
                    format: date-time
                    description: When the payment is due to run.
                    example: '2026-11-05T03:00:00.000Z'
                  type:
                    type: string
                    enum:
                      - BANK_SLIP_PAYMENT
                      - PIX_PAYMENT
                      - P2P_TRANSFER
                      - PIX_TRANSFER
                    description: >-
                      What the schedule pays: a Pix to a key (`PIX_TRANSFER`), a
                      Pix QR code (`PIX_PAYMENT`), a bank slip
                      (`BANK_SLIP_PAYMENT`) or a transfer to another wallet of
                      the same account (`P2P_TRANSFER`).
                    example: PIX_TRANSFER
                  status:
                    type: string
                    enum:
                      - SCHEDULED
                      - PROCESSING
                      - CANCELLED
                      - FAILED
                      - DONE
                    description: >-
                      Where the schedule is: waiting for its day (`SCHEDULED`),
                      running (`PROCESSING`), paid (`DONE`), failed (`FAILED`)
                      or cancelled (`CANCELLED`).
                    example: CANCELLED
                  description:
                    type: string
                    description: Description given when the schedule was created.
                    example: Office rent — November
                  organization:
                    type: string
                    description: ID of the organization the schedule belongs to.
                    example: c4bd3f21-dfbd-44e8-8055-68ba15bed410
                    format: uuid
                  retryCount:
                    type: number
                    nullable: true
                    description: >-
                      Number of execution attempts that failed. Absent or `null`
                      before any failure.
                    example: null
                  realm:
                    type: string
                    description: ID of the realm the schedule belongs to.
                    example: f495ff0c-ab54-4f99-8e92-ca8682e4de9b
                    format: uuid
                  account:
                    type: string
                    description: ID of the account that pays.
                    example: 6702b1e4a9c3d80012f4a7b1
                  wallet:
                    type: string
                    description: ID of the wallet that pays.
                    example: 6702b1e4a9c3d80012f4a7b5
                  category:
                    type: string
                    enum:
                      - FLEX_NATIONAL
                      - FLEX_INTERNATIONAL
                      - FOOD
                      - GAS
                      - MOBILITY
                      - TOLL
                      - FLEX_NATIONAL_WITHOUT_WITHDRAWALS
                      - ADS
                      - SAAS
                      - HOTEL
                      - AIRLINES
                      - TRAVEL
                      - BLOCKED
                      - CASHBACK
                    description: Balance category of the wallet the amount is taken from.
                    example: FLEX_NATIONAL
                  createdAt:
                    type: string
                    format: date-time
                    description: When the schedule was created.
                    example: '2026-10-20T14:32:10.512Z'
                  updatedAt:
                    type: string
                    format: date-time
                    description: When the schedule was last changed.
                    example: '2026-10-22T11:05:41.207Z'
                  createdBy:
                    type: string
                    description: ID of the user who created the schedule.
                    example: e3553bc1-5e20-4e17-b22a-a796fda0aa99
                  updatedBy:
                    type: string
                    description: ID of the user who last changed the schedule.
                    example: e3553bc1-5e20-4e17-b22a-a796fda0aa99
                  cancelledBy:
                    type: string
                    description: >-
                      ID of the user who cancelled the schedule. Present only on
                      a cancelled schedule.
                    example: e3553bc1-5e20-4e17-b22a-a796fda0aa99
                  cancelledAt:
                    type: string
                    format: date-time
                    description: >-
                      When the schedule was cancelled. Present only on a
                      cancelled schedule.
                    example: '2026-10-22T11:05:41.207Z'
                required:
                  - id
                  - amount
                  - scheduledAt
                  - type
                  - status
                  - organization
                  - realm
                  - account
                  - wallet
                  - createdAt
                  - updatedAt
                  - createdBy
                  - updatedBy
                description: A scheduled payment.
        '403':
          description: >-
            `SCHEDULING_ADMIN_REQUIRED` — Only organization admins can cancel
            the schedules of a wallet.
          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:
                      - SCHEDULING_ADMIN_REQUIRED
                    description: >-
                      Stable, machine-readable error code. Branch on this, never
                      on `message`.
                  origin:
                    type: string
                    enum:
                      - SCHEDULING
                    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: SCHEDULING_ADMIN_REQUIRED
                origin: SCHEDULING
                message: Organization admin required
        '404':
          description: >-
            `TRANSACTION_SCHEDULE_NOT_FOUND` — No schedule with this ID pays
            from this wallet.
          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:
                      - TRANSACTION_SCHEDULE_NOT_FOUND
                    description: >-
                      Stable, machine-readable error code. Branch on this, never
                      on `message`.
                  origin:
                    type: string
                    enum:
                      - SCHEDULING
                    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: TRANSACTION_SCHEDULE_NOT_FOUND
                origin: SCHEDULING
                message: Transaction schedule not found
        '409':
          description: >-
            `SCHEDULE_NOT_CANCELABLE` — The payment is already running, or
            already ran.
          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:
                      - SCHEDULE_NOT_CANCELABLE
                    description: >-
                      Stable, machine-readable error code. Branch on this, never
                      on `message`.
                  origin:
                    type: string
                    enum:
                      - SCHEDULING
                    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: SCHEDULE_NOT_CANCELABLE
                origin: SCHEDULING
                message: >-
                  The schedule can no longer be cancelled (already processing,
                  done or failed)
        '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:
                      - SCHEDULING
                    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: SCHEDULING
                message: >-
                  Bad Request: Your request is invalid or incomplete. Please
                  make sure you are requesting with the right fields.
                fields:
                  - field: scheduleId
                    message: Invalid UUID
                    code: SCHEDULEID_UUID

````

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