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

Create a swap

Execute a swap from a previously obtained estimate. The source amount is immediately reserved from the asset’s available balance, and the swap starts processing asynchronously. Track its progress with

Endpoint POST /2.0/swap/create

Request body

{
  "estimateId": "{estimateId}"
}
Field
Type
Required
Description

estimateId

string

yes

UUID returned by Estimate a swap. Valid for 30 minutes, single-use.

cURL

curl -X POST "/2.0/swap/create" \
  -H "Content-Type: application/json" \
  -H "apiKey: <yourApiKey>" \
  -d '{"estimateId":"{estimateId}"}'

Response (200 OK)

{
  "id": "{swap-uuid}",                                   // Swap ID
  "amountFrom": "100000000",                             // Source amount in base units
  "amountFromInUsd": "100.00",                           // Source amount in USD (or null)
  "amountTo": null,                                      // Received amount in base units (null until finished)
  "amountToInUsd": null,                                 // Received amount in USD (or null)
  "assetIdFrom": "{assetIdFrom}",                        // Source merchant asset ID
  "assetIdTo": "{assetIdTo}",                            // Target merchant asset ID
  "cryptoIdFrom": "{cryptoIdFrom}",                      // Source cryptocurrency ID
  "cryptoIdTo": "{cryptoIdTo}",                          // Target cryptocurrency ID
  "hashFrom": null,                                      // Source transaction hash (null until available)
  "hashTo": null,                                        // Target transaction hash (null until available)
  "status": "new",                                       // new | in_progress | finished | rejected
  "createdAt": "2025-03-11T14:30:16+00:00"               // RFC3339, UTC+0
}

See Swaps → Swap statuses for the full status lifecycle.

Validation errors

400 Bad Request returns the standard validation envelope (see Error format). Common messages:

  • Estimate not found — the estimate is unknown, expired (older than 30 minutes), already used, or does not belong to your merchant.

  • Balance not enough — your available balance for the source asset is lower than the swap amount.

Last updated