Skip to main content

Estimate fixed rate exchange

POST getFixRateForAmount

Method returns a fixed exchange estimation for the provided amount. It needs an additional parameter amountFrom or amountTo to estimate a fixed exchange result.

So, the main difference between getFixRateForAmount and getFixRate methods is that getFixRateForAmount fetches fixed amount based on the additional amountFrom or amountTo parameter.

info

Before getting the fixed rate for specific amount, you need to ensure that your amount is greater or equal than minimal amount and less or equal than maximal amount. For this, you need to call getPairsParams method for fetching minimal and maximal amount for a current pair.

If amount will not correspond with the minimal and maximal range for amount, the request will result in error: see the sample error response in the right section.

warning

Although amountFrom and amountTo are optional parameters, it is required to set one of them. If you provide none or both, the request will result in error.

HTTP request

https://api.changelly.com/v2/#getFixRateForAmount

Request

Header parameters
NameTypeRequiredDescription
X-Api-KeystringtrueYour API key (SHA256 from Public Key)
X-Api-SignaturestringtrueThe query's serialized body signed by your private key according to the RSA-SHA256 method.

Body parameters

NameTypeRequiredDescription
jsonrpcstringtrueJSON-RPC version.
idstringtrueClient's custom ID.
methodstringtrueAPI method name.
paramsobject or array of objectstrueRequest parameters.
You can set params as:
  • object to get result for 1 currency pair
  • array of 1 object to get result even if you request only 1 currency pair
  • array of objects when requesting more than 1 currency pair

If you set params as an object without an array, getFixRateForAmount will return an error.
If you set params as an object in an array, getExchangeAmount will return an array without an invalid currency pair or an empty array.

params object:

NameTypeRequiredDescription
fromstringtruePayin currency code (in lowercase).
tostringtruePayout currency code (in lowercase).
amountFromstringfalseAmount that user is going to exchange.
amountTostringfalseAmount that user is going to receive.
userMetadatastringfalseEscaped JSON.
You can use userMetadata to include any additional parameters for customization purposes.
To use this feature, please contact us at [email protected].

Response

Sample response

application/json
{
"jsonrpc": "2.0",
"id": "test",
"result": [
{
"id": "f4dd43106d63b65b88955a0b36******ffb7a8480dd32e799431177f",
"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",
"amountFrom": "5.2",
"amountTo": "0.34047438",
"expiredAt": 1664890979
}
]
}