Overview

1inch is a decentralized exchange (DEX) aggregator that finds the best swap routes across protocols like Uniswap, SushiSwap, and Curve. The API lets you query optimal swap paths, get token prices, and fetch liquidity pool data across multiple EVM-compatible chains including Ethereum, BSC, and Polygon. No API key is required for basic queries, making it one of the easiest DeFi APIs to start with.

Beginner Tip

Start with the `/price` endpoint to get token prices in USD without needing any wallet connection or signing. All amounts in the 1inch API are expressed in the token's smallest unit (wei for ETH), so divide by 10^18 to get human-readable ETH values.

Available Data

The kind of data this API exposes, based on its documentation. We could not call the endpoint to confirm the exact field names.

coin price in USD/EUR
market capitalization
24h price change
trading volume
circulating supply

Example Response

Illustrative shape only — we were not able to call this endpoint (it requires credentials or exposes no public sample URL), so the fields below show the kind of data this API returns rather than a recorded response.

JSON Response · Illustrative
{
  "id": "bitcoin",
  "symbol": "btc",
  "current_price": 65432.1,
  "market_cap": 1280000000000,
  "price_change_24h": 1250.5,
  "price_change_percentage_24h": 1.95,
  "total_volume": 28500000000
}

Field Reference

0x...address The queried token contract address as the key, with its USD price as the value.
toAmount Amount of destination token you would receive in the token's smallest unit (divide by 10^decimals for human-readable value).
fromToken.symbol Ticker symbol of the source token (e.g., "ETH", "USDC").
toToken.symbol Ticker symbol of the destination token.
protocols List of DEX protocols and the route through them that 1inch selected to achieve the best swap rate.

Implementation Example

Calls a real endpoint of this API. Replace any placeholder credentials with your own key.

Request
const url = "https://1inch.io/api/";
const response = await fetch(url);
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

Generated guidance based on this API's documentation, not observed by us. Treat it as a starting point and check against the provider's own error reference.

400 Bad Request — "insufficient liquidity" The swap amount is too large for available on-chain liquidity, or you are querying a very low-liquidity token pair.
Reduce the swap amount or try a different token pair. Use the `/quote` endpoint to check liquidity before attempting a swap.
Token address returns no results Using the token symbol (e.g., "ETH") instead of the contract address.
Always use the full lowercase checksum contract address — for ETH use the special address `0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee`.
429 Too Many Requests The public API has rate limits; burst traffic without backoff triggers throttling.
Add a 1-second delay between requests or sign up for the 1inch Developer Portal to get a higher-rate API key.

Metadata Score Breakdown

Estimated from metadata — endpoint not independently tested

This score is estimated from observable metadata — HTTPS support, authentication model, declared CORS, and documentation reachability — because the API requires authentication or exposes no publicly testable endpoint. The five-signal breakdown is only shown for live-tested APIs.

Metadata estimate · endpoint not independently tested

Technical Specifications

Auth No Auth
HTTPS REQUIRED
CORS UNKNOWN
Category Cryptocurrency
Difficulty Beginner
Listing details not endpoint-verified

Related Tags

Similar APIs

View All →