1. Currency Exchange
Partner API
  • Getting Started
    • Introduction
    • Authentication
    • Business Use Cases
  • API References
    • Balances & History
      • Get Balances
      • Get Balance History
    • Crypto Deposits
      • Get Crypto Deposit Details
      • Add Travel Rule
    • Crypto Withdrawals
      • Get Whitelisted Wallets
      • Add Whitelisted Wallet
      • Delete Whitelisted Wallet
      • Create Crypto Withdrawal
      • Get Crypto Withdrawal Details
    • SEPA Deposits
      • Get SEPA Payment Details
      • Get SEPA Deposit Details
    • SEPA Withdrawals
      • Create SEPA Withdrawal
      • Get SEPA Withdrawal Details
    • Currency Exchange
      • Get Rates
        GET
      • Create Lock
        POST
      • Create Exchange
        POST
      • Get Exchange Details
        GET
  • Integration
    • Integration Guides
    • Transaction Processing
    • Error Handling
    • Rate Limiting
    • Webhooks
      • Crypto Deposit Webhook
      • Crypto Withdrawal Webhook
      • SEPA Deposit Webhook
      • SEPA Withdrawal Webhook
      • Exchange Webhook
  • Reference
    • Supported Currencies
    • Fees
    • FAQ
    • Changelog
    • Support
  1. Currency Exchange

Create Lock

Testing Env
http://k8s-partnera-partnera-7873f15634-69ebb7c047cac3d1.elb.eu-central-1.amazonaws.com
Testing Env
http://k8s-partnera-partnera-7873f15634-69ebb7c047cac3d1.elb.eu-central-1.amazonaws.com
POST
/v1/exchange/lock
Calculates an exchange between two balances and locks the rate. The response contains the exact amounts that will be exchanged - use the returned lockId in Create Exchange to execute it.

Lock#

A lock is valid until validUntil. Execute the exchange before this time - otherwise create a new lock.
A lock can be used only once.
A lock does not reserve funds. The balance is checked when the exchange is executed - if it is no longer sufficient, Create Exchange returns P4103.

Amounts#

sourceAmount is debited from the source balance. It is converted at rate into totalDestinationAmount, from which the exchange fee is deducted. The destination balance is credited with destinationAmount (totalDestinationAmount - fee). The fee rate is defined by exchange.feePercent of the destination balance (see Get Balances). Amounts are rounded down to the precision of the currency.

Validation#

The request is validated immediately: one of the balances must be EUR and the other a cryptocurrency (exchanges between two cryptocurrencies are not supported), sourceAmount must not be lower than exchange.minAmount of the source balance and must not exceed the precision of the source currency.

Request

Authorization
API Key
Add parameter in header
x-api-key
Example:
x-api-key: ********************
or
Body Params application/jsonRequired

Examples

Responses

🟢201Success
application/json
Exchange calculated and rate locked.
Bodyapplication/json

🟠400P4007: Validation Error
🟠400P4104: Amount Below Minimum
🟠400P4105: Amount Precision Exceeded
🟠400P4202: Invalid Exchange Pair
🟠401P4001: Missing API Key
🟠401P4002: Invalid API Key
🟠403P4003: IP Not Allowed
🟠403P4004: Access Denied
🟠404P4101: Balance Not Found
🔴500P5000: Unknown Error
Request Request Example
Shell
JavaScript
Java
Swift
curl --location 'http://k8s-partnera-partnera-7873f15634-69ebb7c047cac3d1.elb.eu-central-1.amazonaws.com/v1/exchange/lock' \
--header 'x-api-key: <api-key>' \
--header 'Content-Type: application/json' \
--data '{
  "sourceBalanceId": "ea93abc7-389d-4bd6-aeff-2257bfa72683",
  "destinationBalanceId": "6d1c19f5-993f-4495-95f2-90b88413eb47",
  "sourceAmount": "10"
}'
Response Response Example
201 - EUR to BTC
{
    "lockId": "364bae47-950f-4307-8d86-bc814b2ca12a",
    "sourceBalanceId": "ea93abc7-389d-4bd6-aeff-2257bfa72683",
    "sourceCurrency": "EUR",
    "sourceAmount": "10",
    "destinationBalanceId": "6d1c19f5-993f-4495-95f2-90b88413eb47",
    "destinationCurrency": "BTC",
    "destinationAmount": "0.00013417",
    "rate": "0.000013417859392927268",
    "sourceRate": "1",
    "destinationRate": "74527.53607830421",
    "fee": "0",
    "totalDestinationAmount": "0.00013417",
    "validUntil": "2026-10-14T09:18:00.361Z"
}
Previous
Get Rates
Next
Create Exchange
Built with