Swap
Last updated
Last updated
Request parameters | Type | Description |
---|---|---|
A valid response body is structured as follows:
For more information regarding the fields returned in the response body, reference the table below. In cases where a non 2xx
HTTP status code is returned, reference the Error Response
tab of this section to identify root causes.
Field Name | Type | Description |
---|---|---|
HTTP Status Code | Error Message | Description |
---|---|---|
bid_asset
String
The asset being offered in the swap.
bid_amount
Number
The amount of the bid asset being offered.
bid_address
String
The address from which the bid asset is being sent.
bid_address_pubkey
String (optional)
The public key associated with the bid address, if available.
ask_address
String
The address to which the ask asset is being sent.
ask_amount
Number
The amount of the ask asset being requested.
fee_address
String
The address to which any fees are being sent.
fee_address_pubkey
String (optional)
The public key associated with the fee address, if available.
rate
Number
The exchange rate for the swap.
slippage
Number
The allowed slippage percentage for the swap.
slippage_tolerance
Boolean
Indicates whether slippage tolerance is enabled.
request_id
String
A unique identifier for the liquidity change request.
pair_id
Number
The identifier of the trading pair involved in the liquidity change.
pair
String
The name of the trading pair, typically in the format "base/quote".
base_address
String
The address associated with the base asset in the liquidity change.
quote_address
String
The address associated with the quote asset in the liquidity change.
base_amount
Number
The amount of the base asset involved in the liquidity change.
quote_amount
Number
The amount of the quote asset involved in the liquidity change.
btc_tx_fee
Number
The transaction fee in satoshis for the Bitcoin transaction.
psbt
String
The Partially Signed Bitcoin Transaction (PSBT) in base64 format.
raw_tx
String
The raw Bitcoin transaction in hexadecimal format.
base_inputs
List[Number]
A list of input indices for the base asset in the transaction.
quote_inputs
List[Number]
A list of input indices for the quote asset in the transaction.
400 Bad Request
"pool_address in invalid"
Returned when the pool address is invalid.
400 Bad Request
"tx params are invalid"
Returned when transaction parameters are invalid.
400 Bad Request
"can't verify rate"
Returned when the swap rate cannot be verified.
400 Bad Request
"don't have balance for operation"
Returned when the user does not have sufficient balance for the operation.
401 Unauthorized
Returned when the partner API key does not exist.
500 Internal Server Error
"can't create signer"
Returned when there is an error creating a signer.
500 Internal Server Error
"failed to sign swap tx"
Returned when there is an error signing the swap transaction.
500 Internal Server Error
"can't save request"
Returned when there is an error saving the liquidity change request.
500 Internal Server Error
"can't fetch btc price"
Returned when there is an error fetching the BTC price.
500 Internal Server Error
"can't fetch pool fees"
Returned when there is an error fetching the pool fees.