Get market price for a token pair
Supported on: Ethereum Base BNB Chain ZKsync Gnosis HyperEVM Arc Monad Optimism Polygon Linea Sonic Unichain Robinhood Arbitrum Avalanche Cronos
Parameters
chain
* number path makerAsset
* string queryAddress of "FROM" token
takerAsset
* string queryAddress of "TO" token
amount
number queryAmount to use for price calculation (will be clamped between min and max USD values). If not provided, minimum USD amount will be used
isReversed
boolean queryIf false, amount represents maker token amount. If true, amount represents taker token amount
source
string queryPartner source / track code (falls back to x-1inch-app-provider)
Request Body
This request doesn’t have any request body.
JavaScript
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const axios = require('axios');
async function httpCall() {
const url = 'https://api.1inch.com/orderbook/v4.1/{chain}/receive-quote';
const config = {
headers: {
Authorization: `Bearer ${API_KEY}`,
},
params: {
makerAsset: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
takerAsset: '0x6b175474e89094c44da98b954eedeac495271d0f',
amount: '100000',
isReversed: false,
},
paramsSerializer: {
indexes: null,
},
};
try {
const response = await axios.get(url, config);
console.log(response.data);
} catch (error) {
console.error(error);
}
}
Returns
200 response doesn’t have payload.