For the complete documentation index, see llms.txt. This page is also available as Markdown.

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: bd0b179d-6ae3-4516-bd85-243a82b2a87a
addressToIdstringRequired

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

Example: 1de0bedc-26e6-4b83-bd89-f307b6f80f7a
feeTokenstringRequired

Commission Token

Example: U2FsdGVkX1/YV+QnxA8TgLWJjfvQq84aWf0PEXGyftGjOa5MYop5FQ4p7D08CN6WL6p1pZMw2n6KZ5RxuTyzbC74vrUkewPBQFJIbZ3J5VpMb3j1qQDkdFVnF++C73c4K4trxS/hmtZRvgbEhPL+4HCast15E3waMCsu2Mfk3c0qnXa+NVYiG3g0fuoUjupWcdsgv4eJQA/M9qocf2O+wQ==
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

Successful response

successbooleanRequired

Request success indicator

post/api-gateway/swaps/create
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": "bd0b179d-6ae3-4516-bd85-243a82b2a87a",
  "addressToId": "1de0bedc-26e6-4b83-bd89-f307b6f80f7a",
  "feeToken": "U2FsdGVkX1/YV+QnxA8TgLWJjfvQq84aWf0PEXGyftGjOa5MYop5FQ4p7D08CN6WL6p1pZMw2n6KZ5RxuTyzbC74vrUkewPBQFJIbZ3J5VpMb3j1qQDkdFVnF++C73c4K4trxS/hmtZRvgbEhPL+4HCast15E3waMCsu2Mfk3c0qnXa+NVYiG3g0fuoUjupWcdsgv4eJQA/M9qocf2O+wQ==",
  "webhookUrl": "https://merchant.domain/webhooks/swap"
}
200Success
{
  "success": true,
  "response": {
    "id": "88d9e00d-a4fd-4a6f-b58a-11b1c9bc797e",
    "clientId": "merchant_unique_id",
    "addressFromId": "bd0b179d-6ae3-4516-bd85-243a82b2a87a",
    "addressToId": "1de0bedc-26e6-4b83-bd89-f307b6f80f7a",
    "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": "2026-01-29T11:14:13.709Z"
  }
}

Last updated