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

# Update an Operation Route

> Use this endpoint to update the details of an Operation Route.



## OpenAPI

````yaml /en/openapi/v3-current/ledger.yaml patch /v1/organizations/{organization_id}/ledgers/{ledger_id}/operation-routes/{operation_route_id}
openapi: 3.1.0
info:
  title: Midaz Ledger API
  description: >-
    Complete API reference for Midaz Ledger services including organization
    management, ledger operations, assets, segments, portfolios, accounts,
    account types, transactions, operations, balances, operation routes,
    transaction routes, and metadata indexes.
  version: 3.7.0
servers:
  - url: https://ledger.sandbox.lerian.net
security: []
tags:
  - name: Organizations API
  - name: Ledgers API
  - name: Assets API
  - name: Segments API
  - name: Portfolios API
  - name: Account Types API
  - name: Accounts API
  - name: Balances API
  - name: Transactions API
  - name: Operations API
  - name: Operation Routes API
  - name: Transaction Routes API
  - name: Metadata Indexes API
paths:
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/operation-routes/{operation_route_id}:
    patch:
      tags:
        - Operation routes API
      summary: Update an Operation Route
      description: Use this endpoint to update the details of an Operation Route.
      parameters:
        - $ref: '#/components/parameters/OrganizationId'
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/LedgerId'
        - $ref: '#/components/parameters/OperationRouteId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateOperationRouteRequest'
            example:
              title: PIX Internal Account Credit
              code: PIX-CREDIT
              description: PIX Internal Account Credit
              account:
                ruleType: account_type
                validIf:
                  - deposit
                metadata:
                  customField1: updatedValue
                  customField2: 456
                  newField: newValue
      responses:
        '200':
          description: >-
            Indicates that the resource was successfully created and the
            operation was completed as expected.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateOperationRouteResponse'
              example:
                organizationId: 019c96a0-0a98-7287-9a31-786e0809c769
                ledgerId: 019c96a0-0ac0-7de9-9f53-9cf842a2ee5a
                account:
                  ruleType: account_type
                  validIf:
                    - deposit
                code: PIX-CREDIT
                description: PIX Internal Account Credit
                operationType: destination
                title: PIX Internal Account Credit
                metadata:
                  customField1: updatedValue
                  customField2: 456
                createdAt: '2026-02-25T21:06:38.348683Z'
                deletedAt: null
                updatedAt: '2026-02-25T21:06:38.348683Z'
          headers: {}
        '400':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorFormat'
              examples:
                Error0053:
                  $ref: '#/components/examples/Error0053'
                Error0065:
                  $ref: '#/components/examples/Error0065'
                Error0103:
                  $ref: '#/components/examples/Error0103'
        '401':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorFormat'
              examples:
                Error0041:
                  $ref: '#/components/examples/Error0041'
                Error0042:
                  $ref: '#/components/examples/Error0042'
        '403':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorFormat'
              examples:
                Error0043:
                  $ref: '#/components/examples/Error0043'
        '404':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorFormat'
              examples:
                Error0101:
                  $ref: '#/components/examples/Error0101'
        '409':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorFormat'
              examples:
                Error0100:
                  $ref: '#/components/examples/Error0100'
        '500':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorFormat'
              examples:
                Error0046:
                  $ref: '#/components/examples/Error0046'
      security:
        - bearer: []
components:
  parameters:
    OrganizationId:
      name: organization_id
      in: path
      description: The unique identifier of the Organization associated with the Ledger.
      required: true
      example: 019c96a0-0a98-7287-9a31-786e0809c769
      schema:
        type: string
    Authorization:
      name: Authorization
      in: header
      description: >-
        The authorization token. **This header is required if your environment
        has Access Manager enabled**.
      required: false
      schema:
        type: string
    LedgerId:
      name: ledger_id
      in: path
      description: The unique identifier of the associated Ledger.
      required: true
      example: 019c96a0-0ac0-7de9-9f53-9cf842a2ee5a
      schema:
        type: string
    OperationRouteId:
      name: operation_route_id
      in: path
      description: The unique identifier of the Operation Route that you want to retrieve.
      required: true
      example: 019c96a0-1071-7a0d-9916-a831221de252
      schema:
        type: string
  schemas:
    UpdateOperationRouteRequest:
      type: object
      properties:
        title:
          type: string
          maxLength: 255
          description: >-
            Short text summarizing the purpose of the operation. Used as an
            entry note for identification.
        description:
          type: string
          maxLength: 250
          description: Detailed description of the Operation Route purpose and usage.
        code:
          type: string
          maxLength: 100
          deprecated: true
          description: >-
            An external reference used to identify the operation route.
            **Deprecated:** use rubric codes inside `accountingEntries` instead.
        account:
          type: object
          required:
            - validIf
          description: >-
            Defines the rule for selecting the account that will participate in
            the operation (debit or credit).
          properties:
            ruleType:
              type: string
              enum:
                - alias
                - account_type
              description: >
                Specifies the rule type for account validation in the operation.

                - **alias**: Expects a specific account alias. The `validIf`
                field must contain the exact alias string (e.g., "validIf":
                "@john_doe").

                - **account_type**: Expects the account to have one of the
                specified account types. The `validIf` field must contain an
                array of account type `keyValues` (e.g., "validIf":
                ["current_asset", "payment_account"]).
            validIf:
              oneOf:
                - type: array
                  items:
                    type: string
                    example:
                      - current_asset
                      - payment_account
                - type: string
                  example: '@external/BRL'
              description: >
                The validation criteria based on the ruleType. When `ruleType`
                is **alias**: A string containing the specific account alias
                (e.g., "@john_doe"). When `ruleType` is **account_type**: An
                array of strings containing the account type `keyValues` (e.g.,
                ["current_asset", "payment_account"]).
        metadata:
          $ref: '#/components/schemas/Metadata'
        accountingEntries:
          $ref: '#/components/schemas/AccountingEntries'
    CreateOperationRouteResponse:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: The unique identifier of the Operation Route.
        organizationId:
          type: string
          format: uuid
          description: The unique identifier of the Organization.
        ledgerId:
          type: string
          description: The unique identifier of the Ledger.
          format: uuid
        title:
          type: string
          description: >-
            Short text summarizing the purpose of the operation. Used as an
            entry note for identification.
        code:
          type: string
          maxLength: 100
          deprecated: true
          description: >-
            An external reference used to identify the operation route.
            **Deprecated:** use rubric codes inside `accountingEntries` instead.
        description:
          type: string
          description: Detailed description of the Operation Route purpose and usage.
        operationType:
          type: string
          enum:
            - source
            - destination
            - bidirectional
          description: >-
            The type of the Operation Route. Use `bidirectional` when the route
            can operate in both directions.
        accountingEntries:
          $ref: '#/components/schemas/AccountingEntries'
        account:
          type: object
          description: >-
            Defines the rule for selecting the account that will participate in
            the operation (debit or credit).
          properties:
            ruleType:
              type: string
              enum:
                - alias
                - account_type
              description: >
                Specifies the rule type for account validation in the operation.

                - **alias**: Expects a specific account alias. The `validIf`
                field must contain the exact alias string (e.g., "validIf":
                "@john_doe").

                - **account_type**: Expects the account to have one of the
                specified account types. The `validIf` field must contain an
                array of account type `keyValues` (e.g., "validIf":
                ["current_asset", "payment_account"]).
            validIf:
              oneOf:
                - type: array
                  items:
                    type: string
                    example:
                      - current_asset
                      - payment_account
                - type: string
                  example: '@external/BRL'
              description: >
                The validation criteria based on the ruleType. When `ruleType`
                is **alias**: A string containing the specific account alias
                (e.g., "@john_doe"). When `ruleType` is **account_type**: An
                array of strings containing the account type `keyValues` (e.g.,
                ["current_asset", "payment_account"]).
        createdAt:
          type: string
          format: date-time
          description: Timestamp of creation (UTC).
        updatedAt:
          type: string
          format: date-time
          description: Timestamp of last update (UTC).
        deletedAt:
          type:
            - string
            - 'null'
          format: date-time
          description: Timestamp of soft deletion, if applicable (UTC).
        metadata:
          $ref: '#/components/schemas/Metadata'
    ErrorFormat:
      type: object
      description: The response message error.
      required:
        - code
        - title
        - message
      properties:
        code:
          type: string
          description: A unique, stable identifier for the error.
        title:
          type: string
          description: A brief summary of the issue.
        message:
          type: string
          description: Detailed guidance for resolving the error.
        fields:
          type: object
          additionalProperties: true
          description: Additional information about the fields that caused the error.
    Metadata:
      type: object
      additionalProperties:
        type: string
      description: >-
        An object containing key-value pairs to add as metadata, where the field
        `name` is the key and the field `value` is the value. For example, to
        add a Cost Center, use 'costCenter': 'BR_11101997'.
    AccountingEntries:
      type: object
      description: >-
        Accounting entries grouped by transaction action type. Each action maps
        to a pair of debit and credit rubrics.
      properties:
        direct:
          $ref: '#/components/schemas/AccountingEntry'
          description: Accounting entry for direct (immediate approval) actions.
        hold:
          $ref: '#/components/schemas/AccountingEntry'
          description: Accounting entry for hold (pending transaction) actions.
        commit:
          $ref: '#/components/schemas/AccountingEntry'
          description: >-
            Accounting entry for commit (confirming a pending transaction)
            actions.
        cancel:
          $ref: '#/components/schemas/AccountingEntry'
          description: >-
            Accounting entry for cancel (canceling a pending transaction)
            actions.
          nullable: true
        revert:
          $ref: '#/components/schemas/AccountingEntry'
          description: >-
            Accounting entry for revert (reversing an approved transaction)
            actions.
          nullable: true
        overdraft:
          $ref: '#/components/schemas/AccountingEntry'
          description: >-
            Accounting entry for the overdraft lifecycle. The debit rubric
            classifies overdraft draws (deficit grows); the credit rubric
            classifies repayments (deficit shrinks). Both rubrics are required
            when this entry is present.
          nullable: true
    AccountingEntry:
      type: object
      description: A double-entry accounting pair with debit and credit rubrics.
      required:
        - debit
        - credit
      properties:
        debit:
          $ref: '#/components/schemas/AccountingRubric'
        credit:
          $ref: '#/components/schemas/AccountingRubric'
    AccountingRubric:
      type: object
      description: An accounting rubric representing one side of a double-entry record.
      required:
        - code
        - description
      properties:
        code:
          type: string
          maxLength: 50
          description: The accounting rubric code (e.g., 1.1.001).
        description:
          type: string
          maxLength: 250
          description: A description of the accounting rubric.
  examples:
    Error0053:
      value:
        code: '0053'
        title: Unexpected Fields in the Request
        message: >-
          The request body contains more fields than expected. Please send only
          the allowed fields as per the documentation. The unexpected fields are
          listed in the fields object.
        fields:
          '{{field}}': '{{value}}'
      summary: Unexpected Fields in the Request
    Error0065:
      value:
        code: '0065'
        title: Invalid Path Parameter
        message: >-
          The provided path parameter {{parameter_name}} is not in the expected
          format. Please ensure the parameter adheres to the required format and
          try again.
      summary: Invalid Path Parameter
    Error0103:
      value:
        code: '0103'
        title: Invalid Operation Route Type
        message: >-
          The provided operation route type is not valid. Accepted types are
          'source', 'destination', or 'bidirectional'. Please provide a valid
          operation type.
      summary: Invalid Operation Route Type
    Error0041:
      summary: Token Missing
      value:
        code: '0041'
        title: Token Missing
        message: >-
          A valid token must be provided in the request header. Please include a
          token and try again.
    Error0042:
      summary: Invalid Token
      value:
        code: '0042'
        title: Invalid Token
        message: >-
          The provided token is expired, invalid or malformed. Please provide a
          valid token and try again.
    Error0043:
      summary: Insufficient Privileges
      value:
        code: '0043'
        title: Insufficient Privileges
        message: >-
          You do not have the necessary permissions to perform this action.
          Please contact your administrator if you believe this is an error.
    Error0101:
      value:
        code: '0101'
        title: Operation Route Not Found
        message: >-
          The provided operation route does not exist in our records. Please
          verify the operation route and try again.
      summary: Operation Route Not Found
    Error0100:
      value:
        code: '0100'
        title: Operation Route Title Already Exists
        message: >-
          An operation route with the specified title already exists. Please use
          a different title and try again.
      summary: Operation Route Title Already Exists
    Error0046:
      summary: Internal Server Error
      value:
        code: '0046'
        title: Internal Server Error
        message: >-
          The server encountered an unexpected error. Please try again later or
          contact support.
  securitySchemes:
    bearer:
      type: http
      scheme: bearer

````