Skip to main content

Estimate a float-rate exchange


posthttps://api.criptointercambio.com/v2/#getExchangeAmount

Retrieves a float-rate exchange estimation for the provided amount.

info

The estimated amountTo property includes Cripto InterCambio and partner extra fees, but not the network one. To calculate the exact estimated amount for users, deduct the networkFee value from the amountTo.


Request

Header parameters

Requires authentication headers.

Body parameters

Consists of a JSON-RPC 2.0 protocol request object.

How to set the params

The params has several setting options:

  • an object to get the result for one currency pair.
  • an array of one object to get the result, even if you request only one currency pair.
  • an array of objects to get the result for more than one currency pair.

If the params is an object without an array, getFixRateForAmount returns an error. If the params is an object in an array, getFixRateForAmount returns an array without an invalid currency pair or an empty array.

The params schema:

NameTypeRequiredDescription
amountFromstringtrueThe amount for sending.
fromstringtrueThe payin currency ticker. Enter in lowercase.
tostringtrueThe payout currency ticker. Enter in lowercase.
userMetadatastringfalseThe escaped JSON. Info
The userMetadata param can include any additional settings for customization.
To use this feature, contact us at [email protected].

Sample request

{
"jsonrpc": "2.0",
"id": "exampleCustomIdValue",
"method": "getExchangeAmount",
"params": {
"amountFrom": "56",
"from": "xrp",
"to": "atom",
"userMetadata": "{\"param1\": 50, \"param2\": \"string\", \"param3\": \"50.5189\"}"
}
}

Response

Successful response

Consists of a JSON-RPC 2.0 protocol response object.

The result schema:

NameTypeDescription
amountFromstringThe amount for exchange.
amountTostringThe estimated amount before withholding networkFee. Warning
To calculate the estimated amount, deduct the networkFee value from the amountTo.
feestringThe exchange fee in the payout currency.
fromstringThe payin currency ticker.
tostringThe payout currency ticker.
maxstringThe maximum exchangeable amount.
maxFromstringThe maximum exchangeable amount for payin.
maxTostringThe maximum exchangeable amount for payout.
minstringThe minimum exchangeable amount.
minFromstringThe minimum exchangeable amount for payin.
minTostringThe minimum exchangeable amount for payout.
networkFeestringThe network commission from a sent amount. Displayed in the payout currency.
ratestringThe exchange rate before withholding any fees.
visibleAmountstringThe amount including partner extra fee.

Sample successful response

{
"jsonrpc": "2.0",
"id": "exampleCustomIdValue",
"result": [
{
"amountFrom": "56",
"amountTo": "46.460934",
"fee": "0.116443",
"from": "xrp",
"to": "atom",
"max": "23661.302649",
"maxFrom": "23661.302649",
"maxTo": "19738.270532",
"min": "2.9154",
"minFrom": "2.9154",
"minTo": "2.432031",
"networkFee": "0.791365",
"rate": "0.831738875000000000",
"visibleAmount": "46.577377"
}
]
}

Error response

Consists of a JSON-RPC 2.0 protocol error response object.

Sample error response

{
"jsonrpc": "2.0",
"id": "exampleCustomIdValue",
"error": {
"code": -32602,
"message": "Invalid amount for pair btc->eth"
}
}

Error codes

CodeMessageDescription
-32600Error: You reached requests limit {limit} rpsRPS is out of the limit.
-32602Invalid amount for pair {from_currency}->{to_currency}The currency amount for exchange is above the maximum amount or below the minimum amount.
Invalid currency: {currency} temporary disabledCripto InterCambio temporarily disabled this currency.
Invalid currency: {currency} is temporary disabled on API as input currencyCripto InterCambio temporarily disabled this currency for payin.
Invalid currency: {currency} is temporary disabled on API as output currencyCripto InterCambio temporarily disabled this currency for payout.
Invalid currency: {currency} not found
  • Cripto InterCambio does not list this currency.
  • The currency ticker is invalid.
Parameter {param} is invalidThe specified request param is invalid.
-32603
  • Internal Error
  • Error
Mostly, this is a technical issue on our side. Requires further investigation.