Create Swap
curl --request POST \
--url https://app.digitalsurge.com.au/api/private/swaps/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"src_asset": "<string>",
"dst_asset": "<string>"
}
'import requests
url = "https://app.digitalsurge.com.au/api/private/swaps/"
payload = {
"src_asset": "<string>",
"dst_asset": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({src_asset: '<string>', dst_asset: '<string>'})
};
fetch('https://app.digitalsurge.com.au/api/private/swaps/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": 123,
"status": 5,
"src_asset": "<string>",
"dst_asset": "<string>",
"bought_amount": "<string>",
"sold_amount": "<string>",
"src_fee": "<string>",
"dst_fee": "<string>",
"req_get_amount": "<string>",
"req_spend_amount": "<string>",
"expected_price": "<string>"
}{
"message": "<string>"
}Private
Create Swap
Execute a previously estimated swap.
Required flow:
- Call
estimatefirst — never skip this step. - Call this endpoint with the same
src_asset,dst_asset, and the same one ofreq_spend_amountorreq_get_amountused inestimate. Also passexpected_priceset to theestimated_price_exactvalue returned byestimate— this provides slippage protection; if the market has moved beyond tolerance the swap is rejected, in which case re-estimate and retry. - On success, the response includes the swap
idand an initialstatusofprocessing. Check the retrieve operation with thatidroughly once per second for up to 10 seconds until processing completes.
POST
/
api
/
private
/
swaps
/
Create Swap
curl --request POST \
--url https://app.digitalsurge.com.au/api/private/swaps/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"src_asset": "<string>",
"dst_asset": "<string>"
}
'import requests
url = "https://app.digitalsurge.com.au/api/private/swaps/"
payload = {
"src_asset": "<string>",
"dst_asset": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({src_asset: '<string>', dst_asset: '<string>'})
};
fetch('https://app.digitalsurge.com.au/api/private/swaps/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": 123,
"status": 5,
"src_asset": "<string>",
"dst_asset": "<string>",
"bought_amount": "<string>",
"sold_amount": "<string>",
"src_fee": "<string>",
"dst_fee": "<string>",
"req_get_amount": "<string>",
"req_spend_amount": "<string>",
"expected_price": "<string>"
}{
"message": "<string>"
}Authorizations
Personal API key, created in the Digital Surge app under Account Settings → API Keys. Send it with every request as Authorization: Bearer <your-api-key>.
Body
application/jsonapplication/x-www-form-urlencodedmultipart/form-data
A swap: a market-price trade of one asset directly for another (AUD → crypto is a buy, crypto → AUD a sell).
Response
A swap: a market-price trade of one asset directly for another (AUD → crypto is a buy, crypto → AUD a sell).
5- quote10- pending12- estimated15- processing20- error40- rejected60- processed
Available options:
5, 10, 12, 15, 20, 40, 60 Final amount bought by the customer
Final amount sold by the customer
Net amount, after subtracting the fee
Total amount, incl. the fee