Skip to main content

Estimate exchange

POST getExchangeAmount

You need to provide the request with currency pair (from, to) and the amount user is going to exchange.

note

Estimated amountTo property includes Changelly plus partner extra fee. However, amountTo doesn't include the network fee. To calculate the estimated amount to show user, deduct networkFee value from amountTo.

HTTP request

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

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, getExchangeAmount 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 ticker (in lowercase).
tostringtruePayout currency ticker (in lowercase).
amountFromstringtrueAmount of currency that user is going to send.
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

Params as object with 1 pair
application/json
{
"jsonrpc": "2.0",
"id": "test",
"result": [
{
"from": "ltc",
"to": "eth",
"networkFee": "0.00180019",
"amountFrom": "3.99",
"amountTo": "0.1085994",
"max": "642.0361639",
"maxFrom": "642.0361639",
"maxTo": "17.5791",
"min": "0.19713669",
"minFrom": "0.19713669",
"minTo": "0.00540057",
"visibleAmount": "0.108871578947368421",
"rate": "0.0272861100",
"fee": "0.000272178947368421"
}
]
}
Params as array of 1 pair
application/json
{
"jsonrpc": "2.0",
"id": "test",
"result": [
{
"from": "ltc",
"to": "eth",
"networkFee": "0.0019658900000000000000",
"amountFrom": "3.99",
"amountTo": "0.16041285",
"max": "1300",
"maxFrom": "1300",
"maxTo": "52.46028908",
"min": "1.54648",
"minFrom": "1.54648",
"minTo": "0.06240676",
"visibleAmount": "0.16081488721804511278",
"rate": "0.04030448301204138164",
"fee": "0.00040203721804511278195"
}
]
}
Params as array of 2 pairs
application/json
{
"jsonrpc": "2.0",
"id": "test",
"result": [
{
"from": "ltc",
"to": "eth",
"networkFee": "0.0019658900000000000000",
"amountFrom": "3.99",
"amountTo": "0.16041285",
"max": "1300",
"maxFrom": "1300",
"maxTo": "52.46028908",
"min": "1.54648",
"minFrom": "1.54648",
"minTo": "0.06240676",
"visibleAmount": "0.16081488721804511278",
"rate": "0.04030448301204138164",
"fee": "0.00040203721804511278195"
},
{
"from": "btc",
"to": "ltc",
"networkFee": "0.0016150300000000000000",
"amountFrom": "1",
"amountTo": "417.98039400",
"max": "3.53734108",
"maxFrom": "3.53734108",
"maxTo": "1300",
"min": "0.00420803",
"minFrom": "0.00420803",
"minTo": "1.54648",
"visibleAmount": "419.65903012048192771084",
"rate": "419.65903012048192771084",
"fee": "1.67863612048192771084336"
}
]
}