Changelly API Integration
Changelly is an aggregator of crypto exchangers. Integration allows you to embed instant cryptocurrency exchange into your application without needing to hold liquidity. Changelly itself routes deals through partner exchanges.
API Connection
Changelly provides REST API v2 with API-key authentication. Base URL: https://api.changelly.com/v2.
import crypto from 'crypto';
class ChangellyClient {
private apiKey: string;
private apiSecret: string;
constructor(apiKey: string, apiSecret: string) {
this.apiKey = apiKey;
this.apiSecret = apiSecret;
}
private signRequest(body: object): string {
const message = JSON.stringify(body);
return crypto.createHmac('sha512', this.apiSecret).update(message).digest('hex');
}
async getExchangeAmount(from: string, to: string, amount: string) {
const body = {
jsonrpc: '2.0',
id: Date.now().toString(),
method: 'getExchangeAmount',
params: { from, to, amount },
};
const response = await fetch('https://api.changelly.com/v2', {
method: 'POST',
headers: {
'api-key': this.apiKey,
'sign': this.signRequest(body),
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
});
return response.json();
}
}
Main API Calls
// Get minimum amount for exchange
const minAmount = await changelly.request('getMinAmount', { from: 'btc', to: 'eth' });
// Get exchange rate
const rate = await changelly.request('getExchangeAmount', {
from: 'btc', to: 'eth', amount: '0.1'
});
// Create exchange transaction
const transaction = await changelly.request('createTransaction', {
from: 'btc',
to: 'eth',
amount: '0.1',
address: userEthAddress, // receiving address
refundAddress: userBtcAddress, // refund address on error
});
// Track status
const status = await changelly.request('getTransactions', {
id: transaction.result.id
});
Exchange Workflow
- Get rate → show to user
- User confirms →
createTransaction→ get deposit address - User sends cryptocurrency to deposit address
- Poll status every 30–60 sec:
waiting → confirming → exchanging → sending → finished - On
failed→ show refund information
Changelly API integration into existing application: 1 week including UI for pair selection and status display.







