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
Header parameters
x-api-public-keystringOptional
Public API-key
x-api-signaturestringOptional
Signing the request body with a private API-key
Content-typestringOptionalExample:
Request content type
application/json
Body
clientIdstringOptionalExample:
Unique exchange identifier in the merchant system (to prevent duplicate requests)
merchant_unique_id
addressFromIdstringRequiredExample:
Identifier of the outgoing address from which the specified amount will be debited
3632eaf6-402b-4479-9b3d-a54c9eba4c95
addressToIdstringRequiredExample:
Identifier of the destination address where the coins will be credited after the swap
3dc3182e-315e-4f93-9fa2-848bc125805b
feeTokenstringRequiredExample:
Commission Token
U2FsdGVkX18GQLL8vm3k8nPzBoxIp0NJ4M1+46VtZC4/mkAR/BJ6cVXGOdtUumCK4jbe8O71XZW9AIbMmtKkVqrmP7UbND2VVNc7C7ObMa9V1+XbNJmJtBF6YueGXuvgaBl6j4ypUpyRqgBkK5qoDeTqWv3P54ul9lKlFxLRpfG1P0IgcJtY6XxEfjaEHXbx1zFwjqhn7PGzfMw5TCjVNg==
webhookUrlstringOptionalExample:
URL address for notifying about the change in the status of the swap operation
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": "3632eaf6-402b-4479-9b3d-a54c9eba4c95",
"addressToId": "3dc3182e-315e-4f93-9fa2-848bc125805b",
"feeToken": "U2FsdGVkX18GQLL8vm3k8nPzBoxIp0NJ4M1+46VtZC4/mkAR/BJ6cVXGOdtUumCK4jbe8O71XZW9AIbMmtKkVqrmP7UbND2VVNc7C7ObMa9V1+XbNJmJtBF6YueGXuvgaBl6j4ypUpyRqgBkK5qoDeTqWv3P54ul9lKlFxLRpfG1P0IgcJtY6XxEfjaEHXbx1zFwjqhn7PGzfMw5TCjVNg==",
"webhookUrl": "https://merchant.domain/webhooks/swap"
}
200Success
{
"success": true,
"response": {
"id": "6bcc7475-e3f5-4251-bbc9-fe113cf82af5",
"clientId": "merchant_unique_id",
"addressFromId": "3632eaf6-402b-4479-9b3d-a54c9eba4c95",
"addressToId": "3dc3182e-315e-4f93-9fa2-848bc125805b",
"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-06-09T11:38:26.571Z"
}
}
Last updated