Running a production Ethereum dApp without a reliable node provider is a short path to pager duty. Self-hosted Geth nodes lag, miss reorgs, and choke the moment your app catches traction. The Alchemy API fixes that by giving you a hardened node layer plus a set of enhanced APIs that the raw JSON-RPC spec never defined, like getting every NFT in a wallet with one call instead of scanning every block since genesis.
This guide walks through the full Alchemy API surface: creating an app, authenticating, calling standard JSON-RPC methods, using enhanced endpoints, subscribing to pending transactions over WebSocket, and shipping smart accounts with gas sponsorship through Account Kit. You will see curl and Node examples for every major flow, and you will understand how compute units (CU) map to your monthly bill before you ship.
If you are evaluating wallet and web3 infrastructure more broadly, Apidog helps you test every endpoint in one place. Also see our guide to the best crypto wallet API for a wider market view before you commit to a provider.
TL;DR
- Alchemy covers Ethereum, Polygon, Arbitrum, Optimism, Base, Solana, zkSync, Starknet, and more from one dashboard.
- Every app gets HTTPS and WebSocket endpoints for standard JSON-RPC plus enhanced APIs like
alchemy_getAssetTransfers,alchemy_getTokenBalances, andgetNFTs. - The Alchemy SDK for JavaScript (
alchemy-sdk) wraps ethers.js and adds typed helpers for every enhanced endpoint. - Account Kit ships ERC-4337 smart accounts with gas sponsorship, session keys, and passkey auth through Gas Manager.
- Usage is metered in compute units; the free tier gives you 300M CU per month, Growth is 400M CU plus overage, Scale is custom.
- Rate limits are per-app and per-method; batch requests and the SDK’s built-in backoff keep you under throttle caps.
What is the Alchemy API?
Alchemy is a web3 developer platform that operates managed blockchain nodes and layers a data indexing engine on top. You get three things you cannot easily build yourself: high-availability JSON-RPC nodes across 40+ chains, enhanced APIs that pre-index transfers and NFT metadata, and an account abstraction stack (Account Kit) for gasless UX.
Where Infura gives you mostly raw node access, Alchemy adds the indexing layer. Fetching every ERC-20 transfer for an address takes one alchemy_getAssetTransfers call; the same query on a plain node means iterating through every block. That is why most production wallets, DeFi dashboards, and NFT marketplaces use Alchemy for read-heavy paths.
Authentication and setup
Create an account at the Alchemy dashboard, then click Create new app. Pick a chain (Ethereum Mainnet, Polygon, Base, etc.) and a network (mainnet or a testnet like Sepolia). Each app gets a unique API key that forms the last path segment of your URL.
Your HTTPS endpoint looks like:
https://eth-mainnet.g.alchemy.com/v2/YOUR_API_KEY
Your WebSocket endpoint:
wss://eth-mainnet.g.alchemy.com/v2/YOUR_API_KEY
Treat the API key like a secret. Put it in an environment variable, never in client-side code. For browser dApps, use allowlists (referer restrictions) in the Alchemy dashboard so a leaked key cannot drain your quota from an attacker’s domain.
Install the SDK:
npm install alchemy-sdk
Then initialize a client:
import { Alchemy, Network } from "alchemy-sdk";
const alchemy = new Alchemy({
apiKey: process.env.ALCHEMY_API_KEY,
network: Network.ETH_MAINNET,
});
const block = await alchemy.core.getBlockNumber();
console.log("Latest block:", block);
Core endpoints
Standard JSON-RPC over HTTPS
Any standard Ethereum JSON-RPC method works. Here is eth_getBalance with curl:
curl https://eth-mainnet.g.alchemy.com/v2/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc":"2.0",
"method":"eth_getBalance",
"params":["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045","latest"],
"id":1
}'
The response returns the balance in wei as a hex string. The same pattern works for eth_call, eth_sendRawTransaction, eth_getLogs, and every other standard method.
Enhanced API: getAssetTransfers
alchemy_getAssetTransfers returns every ETH, ERC-20, ERC-721, ERC-1155, internal, and external transfer for an address across a block range. One call replaces thousands of eth_getLogs queries.
import { Alchemy, Network, AssetTransfersCategory } from "alchemy-sdk";
const alchemy = new Alchemy({
apiKey: process.env.ALCHEMY_API_KEY,
network: Network.ETH_MAINNET,
});
const transfers = await alchemy.core.getAssetTransfers({
fromBlock: "0x0",
toAddress: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
category: [
AssetTransfersCategory.EXTERNAL,
AssetTransfersCategory.ERC20,
AssetTransfersCategory.ERC721,
],
maxCount: 100,
});
for (const t of transfers.transfers) {
console.log(`${t.asset} ${t.value} from ${t.from} to ${t.to}`);
}
Enhanced API: getTokenBalances and getNFTs
Getting every token a wallet holds, without knowing the contract addresses up front, takes one call:
const balances = await alchemy.core.getTokenBalances(
"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
);
for (const token of balances.tokenBalances) {
const meta = await alchemy.core.getTokenMetadata(token.contractAddress);
console.log(`${meta.symbol}: ${token.tokenBalance}`);
}
For NFTs, use the NFT namespace:
const nfts = await alchemy.nft.getNftsForOwner(
"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
);
console.log(`Owns ${nfts.totalCount} NFTs`);
Subscription API over WebSocket
The Subscription API pushes updates instead of making you poll. Subscribe to pending transactions or address activity:
import { Alchemy, Network, AlchemySubscription } from "alchemy-sdk";
const alchemy = new Alchemy({
apiKey: process.env.ALCHEMY_API_KEY,
network: Network.ETH_MAINNET,
});
alchemy.ws.on(
{
method: AlchemySubscription.PENDING_TRANSACTIONS,
toAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
},
(tx) => console.log("Pending USDC tx:", tx.hash)
);
This is how mempool bots, MEV watchers, and real-time portfolio UIs stay current without burning CU on eth_blockNumber polls.
Account Kit and Gas Manager
Account Kit is Alchemy’s smart account stack. It ships a React SDK, a smart contract account implementation (Light Account and Modular Account), and Gas Manager for sponsoring user operations. Users sign up with a passkey or email, get a smart wallet, and never touch a seed phrase or gas token.
import { createLightAccountClient } from "@account-kit/smart-contracts";
import { alchemy, sepolia } from "@account-kit/infra";
const client = createLightAccountClient({
transport: alchemy({ apiKey: process.env.ALCHEMY_API_KEY }),
chain: sepolia,
signer: yourSigner,
});
const { hash } = await client.sendUserOperation({
uo: { target: "0x...", data: "0x", value: 0n },
});
For onboarding flows that pair smart accounts with embedded wallets, see our guide to the Privy API, which complements Account Kit nicely for consumer dApps.
Common errors and rate limits
Alchemy meters usage in compute units (CU). Each method has a CU cost: eth_call is 26 CU, eth_getLogs is 75, alchemy_getAssetTransfers is 150, and eth_getBlockByNumber is 16. The free tier gives you 300M CU per month and a per-second throughput cap.
The errors you will see most often:
- 429 Too Many Requests: you hit the per-second CU cap. Back off and retry; the SDK handles this automatically.
- 403 Forbidden: your API key’s allowlist does not match the referer, or the key is disabled.
- -32600 Invalid Request: malformed JSON-RPC body. Check method name and params array.
- -32000 execution reverted: the contract call reverted. Decode the revert reason with
eth_calland a simulation tool.
Batch requests are your friend. Send up to 1000 JSON-RPC calls in one HTTP POST, which amortizes network overhead and often costs fewer total CU. For broader testing workflows, api testing without Postman in 2026 covers how to manage batched JSON-RPC calls in a collection.
Alchemy pricing
Alchemy has four public tiers:
- Free: 300M CU per month, 1 app, community support. Good for prototypes and small personal projects.
- Growth: $49/month base, 400M CU included, overage billed per CU, advanced analytics.
- Scale: $289/month, 1.5B CU, dedicated throughput, priority support.
- Enterprise: custom pricing, SLAs, private nodes, dedicated solutions engineering.
CU resets monthly. If you go over on Growth or Scale, you pay overage; on Free, requests start failing with 429 until the next cycle. Monitor usage daily in the dashboard during your first month so you can size the right tier.
Testing the Alchemy API with Apidog
Debugging JSON-RPC by hand is painful. Every request is a POST with a nested params array, responses are hex-encoded, and WebSocket subscriptions are hard to inspect in a plain terminal. Apidog gives you a unified workspace for REST, GraphQL, and WebSocket traffic, so you can hit Alchemy HTTPS endpoints, open a WebSocket to wss://eth-mainnet.g.alchemy.com/v2/..., and watch pending transaction subscriptions stream in side by side.
Save your API key as an environment variable in Apidog and reuse it across collections for mainnet, Sepolia, Polygon, and Base. Script assertions on response fields to catch regressions when Alchemy rolls out new enhanced endpoints. Download Apidog and import the Alchemy OpenAPI spec to scaffold your collection in under a minute.
FAQ
Is Alchemy free for production use?Yes, within 300M CU per month. Many small dApps stay on Free indefinitely. Once you cross that ceiling or need higher throughput, Growth at $49 is the usual next step.
Does Alchemy support Solana?Yes. Alchemy supports Solana mainnet and devnet with standard Solana RPC methods plus enhanced endpoints for token and NFT data. Create a Solana app in the dashboard to get a dedicated endpoint.
Can I use the Alchemy API without the SDK?Absolutely. Every endpoint is callable over HTTPS with curl, fetch, or any HTTP client. The SDK is a convenience wrapper; it adds typed helpers, automatic retries, and WebSocket reconnection, but it is optional.
What is the difference between Alchemy and MetaMask’s developer APIs?MetaMask focuses on wallet UX and signing; Alchemy focuses on node infrastructure and data. They solve different problems. See our guide to the MetaMask API for the wallet side.
How do I rotate an Alchemy API key?Create a new app in the dashboard, update your environment, deploy, then delete the old app. There is no in-place rotation, so plan a brief overlap window.
Does Account Kit work on any EVM chain?Account Kit supports Ethereum, Optimism, Arbitrum, Base, Polygon, and their testnets. Gas Manager sponsorship policies are chain-specific, so set them up per network.



