Skip to main content

Get fixed rate (deprecated)

warning

The method is deprecated. Use getFixRateForAmount instead.

HTTP request

post
/v2/#getFixRate

Request

Header parameters

Requires authentification.

Body parameters

Requires JSON-RPC 2.0 protocol request body.

The params parameter schema:

NameTypeRequiredDescription
fromstringtruePayin currency code (in lowercase).
tostringtruePayout currency code (in lowercase).
Sample request payload
application/json
{
"jsonrpc": "2.0",
"id": "test",
"method": "getFixRate",
"params": [
{
"from": "eth",
"to": "btc"
},
{
"from": "eth",
"to": "ltc"
}
]
}
Sample cURL
curl --location --request POST 'https://api.changelly.com/v2' \
--header 'X-Api-Key: {{apiKey}}' \
--header 'X-Api-Signature: {{sign}}' \
--data-raw '{
"id": "test",
"jsonrpc": "2.0",
"method": "getFixRate",
"params": [
{
"from": "eth",
"to": "btc"
},
{
"from": "eth",
"to": "ltc"
}
]
}'

Response

Response parameters

Requires JSON-RPC 2.0 protocol response body.

The result parameter schema:

NameTypeDescription
idstringRate ID that can be used during 1 minute. This time should be enough for user to initiate the exchange. Expired rate id cannot be used for creation of the fixed rate transaction.
id has to be stored somewhere. It will be used as rateId value while calling.
resultstringExchange rate before withholding the network fee.
Important. To calculate the exact amount that the user will get, you need to multiply the amount that the user wants to send to the result and deduct the value of the networkFee.
fromstringPayin currency code.
tostringPayout currency code.
networkFeestringCommission taken by the network from the amount sent to the user. For one-step exchange, displayed in pay-out currency. For two-step exchanges, displayed in BTC or in USDT.
maxstringMaximum exchangeable amount.
maxFromstringMaximum payin amount for which we would be able to perform the exchange.
maxTostringMaximum payout amount for which we would be able to perform the exchange.
minstringMinimum exchangeable amount.
minFromstringMinimum payin amount for which we would be able to perform the exchange.
minTostringMinimum payout amount for which we would be able to perform the exchange.
expiredAtintegerUnix timestamp in seconds (10 digits) representing the expiration time of the fixed rate.
Sample response
application/json
{
"jsonrpc": "2.0",
"id": "test",
"result": [
{
"id": "f4dd43106d63b65b88955a0b362645ce960987c7ffb7a8480dd32e799431177f",
"result": "0.02556948",
"networkFee": "0.000175",
"from": "eth",
"to": "btc",
"max": "50.000000000000000000",
"maxFrom": "50.000000000000000000",
"maxTo": "1.27847400",
"min": "0.148414210000000000",
"minFrom": "0.148414210000000000",
"minTo": "0.00379488",
"expiredAt": 1664890979
},
{
"id": "f4dd43107876ad5b88955a0b362645ce960a87c0fdb7ab540ed635799230107e830d3f",
"result": "22.1818471906",
"networkFee": "0.00153797",
"from": "eth",
"to": "ltc",
"max": "58.60648073",
"maxFrom": "58.60648073",
"maxTo": "1299.99999994",
"min": "0.09280000",
"minFrom": "0.09280000",
"minTo": "2.05847542",
"expiredAt": 1664890978
}
]
}

Error response

Error response parameters

Check the error response schema.

Error codes

CodeMessageDescription
-32600Invalid amount: maximal amount is {max_amount}The attempt to exchange more currency than a maximal amount.
-32602Invalid currency: {currency} temporary disabledThis currency is currently disabled.
-32602Invalid currency: {currency} temporary disabled for fix rate transactionsThis currency is currently disabled for fix-rate transactions.
-32602Invalid currency: {currency} is temporary disabled on API as output currencyThis currency is currently disabled on API as an output currency.
-32602Invalid currency: {currency} is temporary disabled on API as input currencyThis currency is currently disabled on API as an input currency.
-32602Invalid currency: {currency} not foundThis currency is not listed on Changelly or the ticker is invalid.
-32602Parameter {param} is invalidYou've specified an invalid parameter.
-32603Internal Error or ErrorMost likely, the problem is on our side. Further investigation is required.