Get fixed rate (deprecated)
POST getFixRate
note
The method is deprecated. Use getFixRateForAmount instead.
HTTP request
https://api.changelly.com/v2/#getFixRate
Request
- Request
- Payload
- cURL
Header parameters
Name | Type | Required | Description |
---|---|---|---|
X-Api-Key | string | true | Your API key (SHA256 from Public Key) |
X-Api-Signature | string | true | The query's serialized body signed by your private key according to the RSA-SHA256 method. |
Body parameters
Name | Type | Required | Description |
---|---|---|---|
jsonrpc | string | true | JSON-RPC version. |
id | string | true | Client's custom ID. |
method | string | true | API method name. |
params | object or array of objects | true | Request parameters. |
params
object:
Name | Type | Required | Description |
---|---|---|---|
from | string | true | Payin currency code (in lowercase). |
to | string | true | Payout currency code (in lowercase). |
application/json
{
"jsonrpc": "2.0",
"id": "test",
"method": "getFixRate",
"params": [
{
"from": "eth",
"to": "btc"
},
{
"from": "eth",
"to": "ltc"
}
]
}
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
- Example
- Success
- Errors
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
}
]
}
Response params
Name | Type | Description |
---|---|---|
jsonrpc | string | JSON-RPC version. |
id | string | Client's custom ID. |
result | array of objects | Result. |
result
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. |
Error schema
Name | Type | Description |
---|---|---|
jsonrpc | string | JSON-RPC version. |
id | string | Client's custom ID. |
error | object | Possible errors. |
»code | integer | Error code. |
»message | string | Error message. |
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. |