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:
Name | Type | Required | Description |
---|---|---|---|
from | string | true | Payin currency code (in lowercase). |
to | string | true | Payout 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:
Name | Type | Description |
---|---|---|
id | string | Rate 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. |
result | string | Exchange 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 . |
from | string | Payin currency code. |
to | string | Payout currency code. |
networkFee | string | Commission 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. |
max | string | Maximum exchangeable amount. |
maxFrom | string | Maximum payin amount for which we would be able to perform the exchange. |
maxTo | string | Maximum payout amount for which we would be able to perform the exchange. |
min | string | Minimum exchangeable amount. |
minFrom | string | Minimum payin amount for which we would be able to perform the exchange. |
minTo | string | Minimum payout amount for which we would be able to perform the exchange. |
expiredAt | integer | Unix 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
Code | Message | Description |
---|---|---|
-32600 | Invalid amount: maximal amount is {max_amount} | The attempt to exchange more currency than a maximal amount. |
-32602 | Invalid currency: {currency} temporary disabled | This currency is currently disabled. |
-32602 | Invalid currency: {currency} temporary disabled for fix rate transactions | This currency is currently disabled for fix-rate transactions. |
-32602 | Invalid currency: {currency} is temporary disabled on API as output currency | This currency is currently disabled on API as an output currency. |
-32602 | Invalid currency: {currency} is temporary disabled on API as input currency | This currency is currently disabled on API as an input currency. |
-32602 | Invalid currency: {currency} not found | This currency is not listed on Changelly or the ticker is invalid. |
-32602 | Parameter {param} is invalid | You've specified an invalid parameter. |
-32603 | Internal Error or Error | Most likely, the problem is on our side. Further investigation is required. |