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

# Update a card limit rule

> Replaces a card limit rule's name and conditions.

Send the whole rule: `rules` replaces every condition. The change applies at once to every card limit that uses the rule. Only rules of your account can be changed — not the default rule sets. Send `x-environment: LIVE` for a production rule.

Any member of the organization can update rules.


## OpenAPI

````yaml /api-reference/banking.openapi.json put /realms/{realmId}/organizations/{organizationId}/accounts/{accountId}/card-limit-rule/{cardLimitRuleId}
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=215 copied:manual=4 unknown=52.
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: Cards
  - name: Card Limits
  - name: Cards 3DS
  - name: PIX
  - name: PIX Keys (DICT)
  - name: PIX Charges
  - name: PIX Automatic
  - name: PIX Initiation (Open Finance)
  - name: PIX Infractions (MED)
  - name: Boleto
  - name: Boleto Charges
  - name: TED
  - name: Transfers
  - name: Transactions
  - name: Cashback
  - name: Currency Codes
  - name: Reversals
paths:
  /realms/{realmId}/organizations/{organizationId}/accounts/{accountId}/card-limit-rule/{cardLimitRuleId}:
    put:
      tags:
        - Card Limits
      summary: Update a card limit rule
      description: Replaces a card limit rule's name and conditions.
      operationId: >-
        putRealmsByRealmIdOrganizationsByOrganizationIdAccountsByAccountIdCardLimitRuleByCardLimitRuleId
      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 account 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 organization's account (24 hexadecimal characters).
          schema:
            type: string
            pattern: ^[0-9a-fA-F]{24}$
          example: 66f2a1c7b4d3e80012c9a0b4
        - name: cardLimitRuleId
          in: path
          required: true
          description: ID of the card limit rule to update (24 hexadecimal characters).
          schema:
            type: string
            pattern: ^[0-9a-fA-F]{24}$
          example: 66f2a5a0b4d3e80012c9a0f1
        - name: x-environment
          in: header
          required: false
          description: >-
            Environment of the rule: `LIVE` (production) or `TEST` (sandbox).
            When you omit it, the request runs in `TEST`; any other value is
            rejected.
          schema:
            type: string
            enum:
              - LIVE
              - TEST
          example: LIVE
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                description:
                  type: string
                  minLength: 1
                  description: Name of the rule, to tell it apart from your other rules.
                  example: Ads platforms only
                rules:
                  minItems: 1
                  type: array
                  items:
                    type: object
                    properties:
                      property:
                        type: string
                        enum:
                          - merchantId
                          - merchantName
                          - merchantCity
                          - merchantCountry
                          - mcc
                          - txnCurrency
                          - billingAmount
                          - acquiringCountryCode
                          - msgType
                          - txnType
                          - effectiveAtHour
                          - effectiveAtWeekday
                          - cardType
                        description: >-
                          Attribute of the card transaction the condition tests:
                          `merchantId`, `merchantName`, `merchantCity` or
                          `merchantCountry` (the merchant), `mcc` (merchant
                          category code), `txnCurrency` (currency of the
                          purchase, as an ISO 4217 numeric code),
                          `billingAmount` (amount charged to the card, in
                          cents), `acquiringCountryCode` (country of the
                          merchant's acquirer), `msgType` and `txnType` (the ISO
                          8583 message and transaction types), `effectiveAtHour`
                          and `effectiveAtWeekday` (when the purchase is made)
                          or `cardType` (`embossed_card` for a physical card,
                          `digital_card` for a virtual one). Country conditions
                          (`merchantCountry`, `acquiringCountryCode`) are not
                          supported yet: a rule that uses them may not be
                          applied as written.
                        example: mcc
                      operator:
                        type: string
                        enum:
                          - EQUALS
                          - NOT_EQUAL
                          - GREATER_THAN
                          - GREATER_THAN_OR_EQUAL
                          - LESS_THAN
                          - LESS_THAN_OR_EQUAL
                          - BETWEEN
                          - NOT_BETWEEN
                          - CONTAINS
                          - NOT_CONTAINS
                          - IN
                          - NOT_IN
                          - MATCHES
                          - NOT_MATCHES
                        description: >-
                          How `property` is compared with `comparative`. Each
                          test has a negated form: `EQUALS`/`NOT_EQUAL`,
                          `GREATER_THAN`, `GREATER_THAN_OR_EQUAL`, `LESS_THAN`
                          and `LESS_THAN_OR_EQUAL` (numbers),
                          `BETWEEN`/`NOT_BETWEEN` (a range),
                          `CONTAINS`/`NOT_CONTAINS` (a substring), `IN`/`NOT_IN`
                          (a list) and `MATCHES`/`NOT_MATCHES` (a regular
                          expression).
                        example: IN
                      comparative:
                        type: string
                        minLength: 1
                        description: >-
                          Value the attribute is compared with, as a string (a
                          number is accepted and converted). Write a range as
                          `min, max` (`10000, 50000`), a list as comma-separated
                          values (`5411, 5912`) and a pattern as a regular
                          expression. With `EQUALS` or `NOT_EQUAL`, an `mcc`
                          must be a known four-digit merchant category code and
                          a `cardType` must be `embossed_card` or
                          `digital_card`.
                        example: 7311, 5968
                    required:
                      - property
                      - operator
                      - comparative
                  description: >-
                    Conditions of the rule. A transaction matches the rule only
                    when it meets every condition.
              required:
                - description
                - rules
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  _id:
                    type: string
                    description: ID of the rule. Use it in a card limit's `ruleIds`.
                    example: 66f2a5a0b4d3e80012c9a0f1
                  realmId:
                    type: string
                    description: >-
                      ID of the realm the rule belongs to. Absent on the default
                      rules, which are shared.
                    example: f495ff0c-ab54-4f99-8e92-ca8682e4de9b
                    format: uuid
                  organizationId:
                    type: string
                    description: >-
                      ID of the organization the rule belongs to. Absent on the
                      default rules.
                    example: c4bd3f21-dfbd-44e8-8055-68ba15bed410
                    format: uuid
                  accountId:
                    type: string
                    description: >-
                      ID of the account the rule belongs to. Absent on the
                      default rules.
                    example: 66f2a1c7b4d3e80012c9a0b4
                  environment:
                    type: string
                    enum:
                      - LIVE
                      - TEST
                    description: >-
                      Environment of the rule: `LIVE` (production) or `TEST`
                      (sandbox). Absent on a few default rules.
                    example: LIVE
                  description:
                    type: string
                    description: Name of the rule.
                    example: Ads platforms only
                  rules:
                    type: array
                    items:
                      type: object
                      properties:
                        _id:
                          type: string
                          description: ID of the condition.
                          example: 66f2a5a0b4d3e80012c9a0f2
                        property:
                          type: string
                          description: >-
                            Attribute of the card transaction the condition
                            tests, such as `mcc`, `merchantName` or
                            `billingAmount` — the values accepted when you
                            create a rule.
                          example: mcc
                        operator:
                          type: string
                          description: >-
                            How `property` is compared with `comparative`, such
                            as `EQUALS`, `NOT_IN` or `BETWEEN` — the values
                            accepted when you create a rule. Some default rules
                            use the lower-case form (`in`, `equals`) together
                            with `negate`.
                          example: IN
                        comparative:
                          type: string
                          description: Value the attribute is compared with.
                          example: 7311, 5968
                        negate:
                          type: boolean
                          description: >-
                            Only on some default rules: `true` inverts the
                            lower-case `operator`.
                          example: false
                      required:
                        - _id
                        - property
                        - operator
                        - comparative
                      description: A condition of a card limit rule.
                    description: >-
                      Conditions of the rule. A transaction matches the rule
                      only when it meets every condition.
                  external:
                    type: object
                    properties:
                      ruleId:
                        type: string
                        description: Identifier of the rule at the card issuer.
                        example: a41c2e7d-90b3-4f5a-8c6d-1e2f3a4b5c6d
                    description: >-
                      Identifier of the rule at the card issuer. Absent on a
                      default rule.
                  createdAt:
                    type: string
                    description: When the rule was created.
                    example: '2026-11-02T12:40:03.000Z'
                    format: date-time
                  updatedAt:
                    type: string
                    description: When the rule last changed.
                    example: '2026-11-02T12:40:03.000Z'
                    format: date-time
                  __v:
                    type: number
                    description: Version of the record, incremented by some updates.
                    example: 0
                required:
                  - _id
                  - description
                  - rules
                  - createdAt
                  - updatedAt
                  - __v
                description: >-
                  A reusable set of conditions a card transaction must meet,
                  applied through card limits.
        '404':
          description: >-
            `ACCOUNT_NOT_FOUND` — No account with this ID exists in the
            organization.


            `CARD_LIMIT_RULE_NOT_FOUND` — No rule of the account with this ID
            exists 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
                      - CARD_LIMIT_RULE_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
        '422':
          description: >-
            `BAD_REQUEST` — A path parameter is not a valid ID or the body
            failed validation; `fields` lists each offending field.


            `BANKING_PROVIDER_VALIDATION_ERROR` — The card issuer rejected a
            value; `fields` names 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:
                      - BAD_REQUEST
                      - BANKING_PROVIDER_VALIDATION_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.
                  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: description
                    message: 'Invalid input: expected string, received undefined'
                    code: DESCRIPTION_REQUIRED
        '500':
          description: >-
            `BANKING_PROVIDER_UNAVAILABLE` — The card issuer failed, or its
            answer never arrived. Retry.
          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:
                      - BANKING_PROVIDER_UNAVAILABLE
                    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: BANKING_PROVIDER_UNAVAILABLE
                origin: BANKING
                message: Banking provider temporarily unavailable, please retry
        '502':
          description: >-
            `BANKING_PROVIDER_UNAVAILABLE` — The card issuer answered with a
            server error. Retry.
          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:
                      - BANKING_PROVIDER_UNAVAILABLE
                    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: BANKING_PROVIDER_UNAVAILABLE
                origin: BANKING
                message: Banking provider temporarily unavailable, please retry
        '503':
          description: >-
            `BANKING_PROVIDER_UNAVAILABLE` — The card issuer is unavailable.
            Retry.
          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:
                      - BANKING_PROVIDER_UNAVAILABLE
                    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: BANKING_PROVIDER_UNAVAILABLE
                origin: BANKING
                message: Banking provider temporarily unavailable, please retry
        '504':
          description: >-
            `BANKING_PROVIDER_UNAVAILABLE` — The card issuer didn't answer in
            time. Retry.
          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:
                      - BANKING_PROVIDER_UNAVAILABLE
                    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: BANKING_PROVIDER_UNAVAILABLE
                origin: BANKING
                message: Banking provider did not respond in time, please retry

````

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