Swap
Confirm Swap
API reference for confirming and executing a currency swap
POST
/
swaps
Copy
curl --request POST \
--url https://api-staging.stablestack.xyz/api/swaps \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '{
"customer_id": "85b148ab-3f6b-4d55-917f-3c8de668a48e",
"from_currency": "USDT",
"to_currency": "USDC",
"amount": "1"
}'
Copy
{
"status": "success",
"data": {
"debitTransaction": {
"id": "552e8bb6-e9bf-4956-ab3b-9e56cad65a04",
"sender_wallet_id": "7c1c1825-75c2-4031-86ff-9c46ece29f6c",
"receiver_wallet_id": "a0d8df69-5cb4-43e7-8746-5652576d7b8b",
"transaction_id": "ICNZ1RG2VM",
"asset_code": "usdt",
"amount": "0.13000000",
"reference_id": "e60637ec-e5d0-4c68-9bc8-a12658e5735e",
"status": "PENDING",
"created_at": "2025-05-21T13:25:08.478Z",
"updated_at": "2025-05-21T13:25:08.478Z",
"network": null,
"crypto_transaction_id": null,
"transaction_type": "INTERNAL TRANSFER",
"transaction_mode": "DEBIT",
"exchange_rate": "0.98",
"fee": null,
"withdrawal_recipient_name": null,
"balance": "1.16240000",
"reason": null,
"customer_id": null
},
"creditTransaction": {
"id": "0ea5afd1-3a83-4f54-8116-062fe4680666",
"sender_wallet_id": "7c1c1825-75c2-4031-86ff-9c46ece29f6c",
"receiver_wallet_id": "a0d8df69-5cb4-43e7-8746-5652576d7b8b",
"transaction_id": "8OXM5O9NPM",
"asset_code": "usdc",
"amount": "0.12000000",
"reference_id": "e60637ec-e5d0-4c68-9bc8-a12658e5735e",
"status": "PENDING",
"created_at": "2025-05-21T13:25:08.478Z",
"updated_at": "2025-05-21T13:25:08.478Z",
"network": null,
"crypto_transaction_id": null,
"transaction_type": "INTERNAL TRANSFER",
"transaction_mode": "CREDIT",
"exchange_rate": "0.98",
"fee": null,
"withdrawal_recipient_name": null,
"balance": "1.10000000",
"reason": null,
"customer_id": null
},
"swapId": "e60637ec-e5d0-4c68-9bc8-a12658e5735e"
},
"message": "Swap transaction successful"
}
Executes a previously quoted currency swap transaction. This endpoint debits the from_currency amount and credits the to_currency amount.
Key Features:
- Executes the actual currency conversion
- Processes both debit and credit transactions automically
- Supports both customer and merchant swaps
- Returns detailed transaction records for both legs
- Maintains transaction linkage through reference_id
Request Body:
Customer Swap:
Copy
{
"customer_id": "85b148ab-3f6b-4d55-917f-3c8de668a48e",
"from_currency": "USDT",
"to_currency": "USDC",
"amount": "1"
}
Merchant Swap:
Copy
{
"from_currency": "USDT",
"to_currency": "USDC",
"amount": "1"
}
Headers
Body
application/json
Response
200
application/json
Swap executed successfully
The response is of type object
.
Copy
curl --request POST \
--url https://api-staging.stablestack.xyz/api/swaps \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '{
"customer_id": "85b148ab-3f6b-4d55-917f-3c8de668a48e",
"from_currency": "USDT",
"to_currency": "USDC",
"amount": "1"
}'
Copy
{
"status": "success",
"data": {
"debitTransaction": {
"id": "552e8bb6-e9bf-4956-ab3b-9e56cad65a04",
"sender_wallet_id": "7c1c1825-75c2-4031-86ff-9c46ece29f6c",
"receiver_wallet_id": "a0d8df69-5cb4-43e7-8746-5652576d7b8b",
"transaction_id": "ICNZ1RG2VM",
"asset_code": "usdt",
"amount": "0.13000000",
"reference_id": "e60637ec-e5d0-4c68-9bc8-a12658e5735e",
"status": "PENDING",
"created_at": "2025-05-21T13:25:08.478Z",
"updated_at": "2025-05-21T13:25:08.478Z",
"network": null,
"crypto_transaction_id": null,
"transaction_type": "INTERNAL TRANSFER",
"transaction_mode": "DEBIT",
"exchange_rate": "0.98",
"fee": null,
"withdrawal_recipient_name": null,
"balance": "1.16240000",
"reason": null,
"customer_id": null
},
"creditTransaction": {
"id": "0ea5afd1-3a83-4f54-8116-062fe4680666",
"sender_wallet_id": "7c1c1825-75c2-4031-86ff-9c46ece29f6c",
"receiver_wallet_id": "a0d8df69-5cb4-43e7-8746-5652576d7b8b",
"transaction_id": "8OXM5O9NPM",
"asset_code": "usdc",
"amount": "0.12000000",
"reference_id": "e60637ec-e5d0-4c68-9bc8-a12658e5735e",
"status": "PENDING",
"created_at": "2025-05-21T13:25:08.478Z",
"updated_at": "2025-05-21T13:25:08.478Z",
"network": null,
"crypto_transaction_id": null,
"transaction_type": "INTERNAL TRANSFER",
"transaction_mode": "CREDIT",
"exchange_rate": "0.98",
"fee": null,
"withdrawal_recipient_name": null,
"balance": "1.10000000",
"reason": null,
"customer_id": null
},
"swapId": "e60637ec-e5d0-4c68-9bc8-a12658e5735e"
},
"message": "Swap transaction successful"
}
Assistant
Responses are generated using AI and may contain mistakes.