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

# Create Bulk FX Conversion

Use the Bulk Currency Exchange API to efficiently convert funds between your own multi-currency accounts within the same country. This is ideal for businesses managing international operations to optimize their internal treasury.

> **Important**
>
> * `account.debited.amount`: The amount to be deducted from the source account.
> * `account.credited.amount`: The amount to be added to the target account.
>   The value of the provided field must be greater than 0.

> [!NOTE]
>
> **Want to lock an exchange rate before executing the transaction?**
>
> Use the [Currency Exchange Quote API ](https://docs.localpayment.com/reference/currency-exchange-quote.md)to generate a rate quote for the currency pair. The response includes an `exchangeRateToken`  pass it in your FX conversion request to lock in that rate. The quoted rate is guaranteed until the token's `expirationDate`, protecting both you and your user from market fluctuations.


## OpenAPI

````yaml openapi/localpayment.json POST /api/currency-exchange
openapi: 3.1.0
info:
  version: '1.0'
  title: Localpayment
  contact:
    name: Support
    url: mailto:support@localpayment.com
servers:
  - url: https://api.stage.localpayment.com
    description: Stage
security:
  - token: []
paths:
  /api/currency-exchange:
    post:
      summary: Create Bulk FX Conversion
      operationId: exchange-bulk
      parameters:
        - name: Authorization
          in: header
          description: >-
            Bearer access token for authentication. This token is obtained from
            the [Get Access Token](/reference/get-token) or [Refresh Access
            Token](/reference/refresh-token) endpoints.
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                country:
                  type: string
                  description: The country where the payment will be processed.
                externalId:
                  type: string
                  description: >-
                    A unique identifier generated by your system to track the
                    transaction (alphanumeric and hyphens). We recommend using
                    UUID4 to ensure uniqueness.
                exchangeRateToken:
                  type: string
                  description: >-
                    Token provided by the Foreign Exchange service to use an
                    upfront agreed exchange rate
                account:
                  type: object
                  description: Object containing account details for the transaction.
                  properties:
                    debited:
                      type: object
                      description: Details of the account to be debited.
                      properties:
                        currency:
                          type: string
                          description: Currency of the debited account.
                        accountNumber:
                          type: string
                          description: Account number from which funds will be debited.
                        amount:
                          type: integer
                          description: >-
                            Amount to be debited. This parameter must be set to
                            0 if the `account.credited.amount` field is greater
                            than 0.
                      required:
                        - currency
                        - accountNumber
                        - amount
                    credited:
                      type: object
                      description: Details of the account to be credited.
                      properties:
                        currency:
                          type: string
                          description: Currency of the credited account.
                        accountNumber:
                          type: string
                          description: Account number to which funds will be credited.
                        amount:
                          type: integer
                          description: Amount to be credited
                      required:
                        - currency
                        - accountNumber
                  required:
                    - debited
                    - credited
              required:
                - country
                - externalId
                - exchangeRateToken
                - account
              x-examples:
                Example 1:
                  country: ARG
                  currency: EUR
                  externalId: '11112222'
                  exchangeRateToken: ''
                  account:
                    debited:
                      currency: EUR
                      accountNumber: 111.1111.11111111
                      amount: 10
                    credited:
                      currency: USD
                      accountNumber: '{{accountNumber}}'
            examples:
              Without requesting a quote:
                value:
                  country: ARG
                  currency: ARS
                  externalId: 7a9c72a0-7a8e-4f72-b2b3-a04054d3129f
                  account:
                    debited:
                      currency: ARS
                      accountNumber: '{{accountNumber}}'
                      amount: 10000
                    credited:
                      currency: EUR
                      accountNumber: '{{accountNumber}}'
              With quote:
                value:
                  country: ARG
                  externalId: '11112222'
                  exchangeRateToken: af5606b0-1ce7-48f8-ad8a-734934c601ec
                  account:
                    debited:
                      currency: EUR
                      accountNumber: '{{accountNumber}}'
                      amount: 10
                    credited:
                      currency: USD
                      accountNumber: '{{accountNumber}}'
                      amount: 0
              Credited amount set:
                value:
                  country: ARG
                  externalId: '{{externalId}}'
                  exchangeRateToken: ''
                  account:
                    debited:
                      currency: ARS
                      accountNumber: 111.111.1111111
                      amount: 0
                    credited:
                      currency: USD
                      accountNumber: '{{accountNumber}}'
                      amount: 10
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  transactionType:
                    type: string
                    description: >-
                      Transaction type. For currency exchange operations, this
                      value is `CurrencyExchange`.
                  externalId:
                    type: string
                    description: >-
                      A unique identifier generated by your system to track the
                      transaction (alphanumeric and hyphens). We recommend using
                      UUID4 to ensure uniqueness.
                  internalId:
                    type: string
                    description: Localpayment transaction identifier.
                  country:
                    type: string
                    description: Country where the transaction is processed.
                  currency:
                    type: string
                    description: The original currency of the transaction.
                  exchangeRateToken:
                    type: string
                    description: >-
                      A unique identifier used to track the exchange rate for
                      the transaction.
                  clientCode:
                    type: string
                    description: >-
                      A unique identifier assigned to the client within the
                      LocalPayment system.
                  creationDate:
                    type: string
                    description: The date and time when the transaction was created.
                  errors:
                    type: array
                    description: >-
                      An array of error objects, if any errors occurred during
                      the transaction.
                    items:
                      type: object
                  status:
                    type: object
                    properties:
                      code:
                        type: string
                        description: >-
                          A code representing the current status of the
                          transaction.
                      description:
                        type: string
                        description: A brief description of the transaction status.
                      detail:
                        type: string
                        description: Additional details about the transaction status.
                  account:
                    type: object
                    properties:
                      debited:
                        type: object
                        properties:
                          currency:
                            type: string
                            description: The currency of the debited account.
                          accountNumber:
                            type: string
                            description: The account number of the debited account.
                          amount:
                            type: number
                            description: The amount debited from the account.
                      credited:
                        type: object
                        properties:
                          currency:
                            type: string
                            description: The currency of the credited account.
                          accountNumber:
                            type: string
                            description: The account number of the credited account.
                          amount:
                            type: number
                            description: The amount credited to the account.
                      appliedFx:
                        type: number
                        description: The foreign exchange rate applied to the transaction.
                x-examples:
                  Example 1:
                    transactionType: CurrencyExchange
                    externalId: ''
                    internalId: X11111XX-11X1-111X-X11X-111111X1X1XX
                    country: ARG
                    currency: ARS
                    exchangeRateToken: ''
                    clientCode: '0005'
                    creationDate: '2023-03-21T21:25:14.533+00:00'
                    errors: []
                    status:
                      code: '200'
                      description: COMPLETED
                      detail: CURRENCY EXCHANGE
                    account:
                      debited:
                        currency: ARS
                        accountNumber: '{{accountNumber}}'
                        amount: 40
                      credited:
                        currency: EUR
                        accountNumber: '{{accountNumber}}'
                        amount: 0.18
                      appliedFx: 224.54
              examples:
                200 - Currency Exchange Bulk:
                  value:
                    transactionType: CurrencyExchange
                    externalId: 7a9c72a0-7a8e-4f72-b2b3-a04054d3129f
                    internalId: 8888ad65-aa6e-4643-b9ba-ff62318fd90b
                    country: ARG
                    currency: ARS
                    exchangeRateToken: ''
                    clientCode: '0005'
                    creationDate: '2023-03-21T21:25:14.533+00:00'
                    errors: []
                    status:
                      code: '200'
                      description: COMPLETED
                      detail: CURRENCY EXCHANGE
                    account:
                      debited:
                        currency: ARS
                        accountNumber: '{{accountNumber}}'
                        amount: 10000
                      credited:
                        currency: EUR
                        accountNumber: '{{accountNumber}}'
                        amount: 44.52
                      appliedFx: 224.54
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  externalId:
                    type: string
                    description: >-
                      A unique identifier generated by your system to track the
                      transaction (alphanumeric and hyphens). We recommend using
                      UUID4 to ensure uniqueness.
                  internalId:
                    type: string
                    description: Localpayment transaction identifier.
                  errors:
                    type: array
                    description: >-
                      An array of error objects, if any errors occurred during
                      the transaction.
                    items:
                      type: object
                      properties:
                        code:
                          type: string
                          description: Error code.
                        detail:
                          type: string
                          description: Error detail.
                  status:
                    type: object
                    properties:
                      code:
                        type: string
                        description: >-
                          A code representing the current status of the
                          transaction.
                      description:
                        type: string
                        description: A brief description of the transaction status.
                      detail:
                        type: string
                        description: |
                          Additional details about the transaction status.
                x-examples:
                  Example 1:
                    externalId: '11112222'
                    internalId: 6fc7e955-7704-4558-8a05-6f4a2c3d9b45
                    errors:
                      - code: '705'
                        detail: Credited account currency not match
                    status:
                      code: '705'
                      description: REJECTED
                      detail: Credited account currency not match
              examples:
                705 - Credited account currency not match:
                  value:
                    externalId: '11112222'
                    internalId: 6fc7e955-7704-4558-8a05-6f4a2c3d9b45
                    errors:
                      - code: '705'
                        detail: Credited account currency not match
                    status:
                      code: '705'
                      description: REJECTED
                      detail: Credited account currency not match
                707 - Debited and credited amounts are mutually exclusive:
                  value:
                    errors:
                      - code: '707'
                        detail: >-
                          Fields debited.amount and credited.amount are mutually
                          exclusive. Only one of them must be reported
                    status:
                      code: '707'
                      description: REJECTED
                      detail: >-
                        Fields debited.amount and credited.amount are mutually
                        exclusive. Only one of them must be reported
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: Additional information of the response.
                  code:
                    type: string
                    description: Status code.
                  messages:
                    type: array
                    description: Message list.
                    items:
                      type: object
                      properties:
                        token_class:
                          type: string
                          description: Token class.
                        token_type:
                          type: string
                          description: Token type.
                        message:
                          type: string
                          description: Message with additional information.
                x-examples:
                  Example 1:
                    detail: Given token not valid for any token type
                    code: token_not_valid
                    messages:
                      - token_class: AccessToken
                        token_type: access
                        message: Token is invalid or expired
              examples:
                401 - Token is invalid or expired:
                  value:
                    detail: Given token not valid for any token type
                    code: token_not_valid
                    messages:
                      - token_class: AccessToken
                        token_type: access
                        message: Token is invalid or expired
      security:
        - token: []
      servers:
        - url: https://api.stage.localpayment.com
          description: Stage
components:
  securitySchemes:
    token:
      type: http
      scheme: bearer

````

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