The Alchemy RPC API provides HTTP and WebSocket access to multiple blockchain networks through a unified interface. This guide explains how to construct endpoints, authenticate requests, choose networks, and integrate the API into applications. It includes example JSON-RPC calls and practical tips for development and production use.
What Is the Alchemy RPC API?
The Alchemy RPC API is a hosted blockchain access service that implements the JSON-RPC standard for supported networks. Developers use it to read chain data, submit transactions, and subscribe to real-time events without running their own nodes.
Alchemy exposes network-specific endpoints under a consistent URL structure, so applications can switch between chains with minimal code changes. The API supports both HTTP for request-response calls and WebSocket for subscriptions.
- JSON-RPC 2.0 compliant interface for supported blockchains.
- HTTP and WebSocket transports available.
- Network-specific endpoints for Ethereum, Polygon, Solana, and others.
- API key authentication required for all requests.
Alchemy RPC URL Structure and Authentication
Alchemy RPC URLs follow a predictable pattern that includes the network identifier and your API key. For HTTP access, the general form is https://<network>.g.alchemy.com/v2/<api-key>. For WebSocket access, use wss://<network>.g.alchemy.com/v2/<api-key>.
The API key is passed as part of the URL path. Keep it confidential and avoid exposing it in client-side code or public repositories. Alchemy provides dashboard tools to create, rotate, and restrict keys.
- HTTP endpoint pattern: https://<network>.g.alchemy.com/v2/<api-key>
- WebSocket endpoint pattern: wss://<network>.g.alchemy.com/v2/<api-key>
- Replace <network> with the target chain identifier (e.g., eth-mainnet, polygon-mainnet, solana-mainnet).
- Replace <api-key> with a key from your Alchemy dashboard.
https://eth-mainnet.g.alchemy.com/v2/YOUR_API_KEY
wss://eth-mainnet.g.alchemy.com/v2/YOUR_API_KEYSupported Networks and Endpoint Examples
Alchemy supports a range of networks, each with its own endpoint prefix. The exact list of supported networks and their identifiers can change over time, so consult the Alchemy documentation for the most current information.
Common network identifiers include eth-mainnet for Ethereum mainnet, polygon-mainnet for Polygon PoS, and solana-mainnet for Solana mainnet. Testnet identifiers such as eth-sepolia are also available for development.
- Ethereum mainnet: https://eth-mainnet.g.alchemy.com/v2/<api-key>
- Ethereum Sepolia testnet: https://eth-sepolia.g.alchemy.com/v2/<api-key>
- Polygon mainnet: https://polygon-mainnet.g.alchemy.com/v2/<api-key>
- Solana mainnet: https://solana-mainnet.g.alchemy.com/v2/<api-key>
https://eth-mainnet.g.alchemy.com/v2/YOUR_API_KEY
https://eth-sepolia.g.alchemy.com/v2/YOUR_API_KEY
https://polygon-mainnet.g.alchemy.com/v2/YOUR_API_KEY
https://solana-mainnet.g.alchemy.com/v2/YOUR_API_KEYMaking JSON-RPC Requests
Once you have an endpoint, you can send JSON-RPC requests using any HTTP client. The request body must include the jsonrpc version, a method name, parameters, and an id. The response contains the result or an error object.
For Ethereum-compatible networks, common methods include eth_blockNumber, eth_getBalance, and eth_sendRawTransaction. For Solana, methods follow the Solana JSON-RPC specification, such as getBalance and getSlot.
- Use POST requests with Content-Type: application/json.
- Include a unique id for each request to match responses.
- Handle error responses by checking the error field.
- For WebSocket subscriptions, use methods like eth_subscribe on Ethereum networks.
curl -X POST https://eth-mainnet.g.alchemy.com/v2/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'Using Alchemy with Solana and Polygon
Alchemy provides dedicated endpoints for Solana and Polygon, each following the respective network's RPC conventions. For Solana, the endpoint accepts Solana JSON-RPC methods and returns results in the Solana format. For Polygon, the endpoint behaves like an Ethereum-compatible JSON-RPC endpoint.
When working with Solana, note that some methods and parameters differ from Ethereum. For Polygon, you can reuse Ethereum tooling and libraries by pointing them to the Polygon endpoint.
- Solana endpoint: https://solana-mainnet.g.alchemy.com/v2/<api-key>
- Polygon endpoint: https://polygon-mainnet.g.alchemy.com/v2/<api-key>
- Use Solana-specific methods (e.g., getBalance) on the Solana endpoint.
- Use Ethereum-compatible methods (e.g., eth_getBalance) on the Polygon endpoint.
curl -X POST https://solana-mainnet.g.alchemy.com/v2/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"getBalance","params":["YOUR_SOLANA_ADDRESS"]}'Pricing and Usage Considerations
Alchemy offers tiered plans that include compute units, request limits, and features such as enhanced APIs and analytics. Pricing and plan details are subject to change, so refer to the Alchemy website for current information.
When estimating costs, consider the number and type of requests your application makes. Some methods consume more compute units than others. Monitoring usage through the dashboard helps avoid unexpected overages.
- Plans are based on compute units and may include rate limits.
- Enhanced APIs and debug methods may have different compute unit costs.
- Use the Alchemy dashboard to track usage and set alerts.
- For current pricing, consult the official Alchemy pricing page.
Best Practices for Integration
To build reliable applications with the Alchemy RPC API, implement retry logic with exponential backoff for transient errors, and use multiple API keys or endpoints for redundancy where appropriate. Cache immutable data to reduce request volume.
For production systems, consider using WebSocket subscriptions for real-time updates instead of polling. Always secure API keys and monitor for unusual activity.
- Implement retries for 429 and 5xx responses.
- Use environment variables to store API keys.
- Cache static data such as block hashes or contract ABIs.
- Prefer WebSocket subscriptions for event-driven workflows.
- Set up logging and alerting for failed requests.