POST
/
v1
/
swap
Execute Swap
curl --request POST \
  --url https://api.amm.flashnet.xyz/v1/swap \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "amountIn": "100000000",
  "assetInAddress": "03bitcoinassetpubkey0000000000000000000000000000000000000000000000",
  "assetInSparkTransferId": "spark-transfer-uuid-or-hash-for-asset-in",
  "assetOutAddress": "03usdstablecoinpubkey111111111111111111111111111111111111111111111",
  "integratorPublicKey": "03aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899",
  "maxSlippageBps": "50",
  "nonce": "unique-swap-nonce-123",
  "poolId": "03aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899",
  "signature": "3045022100a7e5d4f8b2c9a1e6f0d5b8c4a9e7f2d1c8b5a4e9f0d6c5b3a2e1d0c9b8a7f02201f2e3d4c5b6a7980e9f0a1b2c3d4e5f67889a0b1c2d3e4f5a6b7c8d9e0f1a2b3",
  "totalIntegratorFeeRateBps": "100",
  "userPublicKey": "02abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567"
}'
{
"accepted": false,
"error": "Insufficient liquidity in pool",
"refundTransferId": "spark-transfer-refund-456",
"refundedAmount": 100000000,
"refundedAssetPublicKey": "03bitcoinassetpubkey0000000000000000000000000000000000000000000000",
"requestId": "01HJZKFABCDEFGHJKLMNPQRSTVW"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Swap execution details including assets, amounts, and authentication

Request body for executing a swap on an AMM pool.

Swaps allow users to exchange one asset for another through a liquidity pool. The swap is executed atomically and the result is returned immediately.

Response

200
application/json

Swap executed successfully

Clean response for a successfully executed swap operation