Creation of a cross-chain exchange

The method allows you to create a cross-chain exchange. Cross-chain exchange allows you to exchange one asset for another

Creation of a cross-chain exchange

post
Header parameters
x-api-public-keystringOptional

Public API-key

x-api-signaturestringOptional

Signing the request body with a private API-key

Content-typestringOptional

Request content type

Example: application/json
Body
clientIdstringOptional

Unique exchange identifier in the merchant system (to prevent duplicate requests)

Example: merchant_unique_id
addressFromIdstringRequired

Identifier of the outgoing address from which the specified amount will be debited

Example: ed7c4941-a5ab-4f53-afb1-195f3a217a62
addressToIdstringRequired

Identifier of the destination address where the coins will be credited after the swap

Example: 96acba77-e951-4be2-a95a-0dc4f29348ab
feeTokenstringRequired

Commission Token

Example: U2FsdGVkX18uAAWGbqwI/SqEoCCY09g2erW3YqYwVYyChxcv8hxBTHcvnNmpEBXodzW4r5xnmYFIT2/I3FnIoZPdXhcaU3RjUxREz4EidY1BASgOX458DKmnGLYNt+ZT/XxUt1vJpSzGwg6YNQ7UPAOcjr6aGNRUO7eJE/rD6J1VPJuAheqhj/yEgJ1p9cZQfqAep9bGq3ED/oqDsouKag==
webhookUrlstringOptional

URL address for notifying about the change in the status of the swap operation

Example: https://merchant.domain/webhooks/swap
Responses
200Success
application/json
post
POST /api-gateway/swaps/create HTTP/1.1
Host: ocp.onchainpay.io
Content-Type: application/json
Accept: */*
Content-Length: 424

{
  "clientId": "merchant_unique_id",
  "addressFromId": "ed7c4941-a5ab-4f53-afb1-195f3a217a62",
  "addressToId": "96acba77-e951-4be2-a95a-0dc4f29348ab",
  "feeToken": "U2FsdGVkX18uAAWGbqwI/SqEoCCY09g2erW3YqYwVYyChxcv8hxBTHcvnNmpEBXodzW4r5xnmYFIT2/I3FnIoZPdXhcaU3RjUxREz4EidY1BASgOX458DKmnGLYNt+ZT/XxUt1vJpSzGwg6YNQ7UPAOcjr6aGNRUO7eJE/rD6J1VPJuAheqhj/yEgJ1p9cZQfqAep9bGq3ED/oqDsouKag==",
  "webhookUrl": "https://merchant.domain/webhooks/swap"
}
200Success
{
  "success": true,
  "response": {
    "id": "9ee110b2-b8dc-4191-90ae-fb0153f5eed6",
    "clientId": "merchant_unique_id",
    "addressFromId": "ed7c4941-a5ab-4f53-afb1-195f3a217a62",
    "addressToId": "96acba77-e951-4be2-a95a-0dc4f29348ab",
    "currencyFrom": "USDT",
    "currencyTo": "USDC",
    "networkFrom": "ethereum",
    "networkTo": "tron",
    "status": "PENDING",
    "rejectMessage": "null",
    "amountFrom": "200",
    "amountTo": "200",
    "price": "1",
    "serviceBlockchainFeeSource": "ADVANCE",
    "serviceBlockchainFee": "2",
    "serviceBlockchainFeeUSD": "2",
    "providerBlockchainFeeSource": "AMOUNT",
    "providerBlockchainFee": "2",
    "providerBlockchainFeeUSD": "2",
    "serviceFeeSource": "ADVANCE",
    "serviceFee": "2",
    "serviceFeeUSD": "2",
    "webhookUrl": "https://merchant.domain/webhooks/swap",
    "createdAt": "2025-07-15T10:50:46.082Z"
  }
}

Last updated