An Alchemy RPC API key authenticates your application to Alchemy's blockchain node infrastructure. This guide explains how to create a key, construct RPC URLs for supported networks like Ethereum, Polygon, Solana, and Sepolia, and manage the key securely. It also covers common use cases and considerations for developers integrating Alchemy into their projects.
What Is an Alchemy RPC API Key?
An Alchemy RPC API key is a unique identifier that authenticates your requests to Alchemy's remote procedure call (RPC) endpoints. It acts as a credential, allowing you to access blockchain nodes without running your own infrastructure.
When you sign up for an Alchemy account, you can create one or more API keys. Each key is tied to your account and can be used across multiple networks, such as Ethereum, Polygon, Solana, and testnets like Sepolia. The key is typically included in the RPC URL or passed as a header, depending on the endpoint format.
Alchemy's platform provides enhanced APIs, developer tools, and monitoring, but the API key is the fundamental element for making standard JSON-RPC calls to supported chains.
- Authenticates your application to Alchemy's node service.
- Enables access to multiple blockchain networks from a single key.
- Can be restricted or rotated for security.
- Required for both free and paid usage tiers.
How to Get an Alchemy RPC API Key
To obtain an Alchemy RPC API key, you need to create an account on the Alchemy dashboard. The process is straightforward and typically involves signing up with an email address or GitHub account.
After registration, you can create a new app or project. During app creation, you select the blockchain network you want to interact with. Alchemy then generates an API key and provides a corresponding RPC URL.
You can view and manage your API keys in the dashboard under the app's settings. Alchemy may also offer separate keys for different environments (e.g., development, production) or allow you to create multiple keys for different applications.
- Sign up at alchemy.com.
- Create a new app and select a network (e.g., Ethereum Mainnet, Polygon, Solana).
- Copy the generated API key from the app's dashboard.
- Use the key in your RPC requests.
Alchemy RPC URL Formats and Examples
Alchemy RPC URLs follow a consistent pattern that includes your API key. The exact URL depends on the network you are targeting. Below are common formats for several networks.
For Ethereum mainnet, the URL typically looks like:
For Polygon mainnet:
For Solana mainnet:
For Sepolia testnet:
Note that Alchemy may update URL structures or introduce new endpoints. Always refer to the official documentation for the most current URLs.
https://eth-mainnet.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_KEY
https://eth-sepolia.g.alchemy.com/v2/YOUR_API_KEYSupported Networks and Use Cases
Alchemy supports a wide range of blockchain networks, including Ethereum, Polygon, Solana, Arbitrum, Optimism, and several testnets. The API key works across these networks, but you need to use the correct base URL for each.
Common use cases for an Alchemy RPC API key include:
For Solana, Alchemy provides RPC endpoints that support Solana's JSON-RPC API. Similarly, for Polygon, you can use the key to interact with the Polygon PoS chain. Testnets like Sepolia are useful for development and testing without spending real assets.
Alchemy also offers enhanced APIs (e.g., NFT API, Token API) that may use the same API key but have different endpoint paths.
- Building decentralized applications (dApps) that read and write to blockchains.
- Indexing blockchain data for analytics or display.
- Running automated scripts for trading, monitoring, or testing.
- Developing and testing smart contracts on testnets.
Security Best Practices for Your API Key
Your Alchemy RPC API key should be treated as a secret. Exposing it in client-side code or public repositories can lead to unauthorized use, potentially consuming your quota or incurring charges.
Alchemy provides features to help manage key security, such as allowlists and usage limits. You can restrict which origins or IP addresses can use the key, and set spending limits to prevent abuse.
If a key is compromised, you can rotate it in the dashboard. Rotating generates a new key and invalidates the old one, so you must update your applications accordingly.
- Never commit API keys to version control.
- Use environment variables or secret managers.
- Restrict keys by domain or IP where possible.
- Monitor usage for unexpected spikes.
- Rotate keys periodically or if compromised.
Alchemy RPC Pricing and Key Tiers
Alchemy offers a free tier that includes a certain number of compute units per month. Paid plans provide higher limits and additional features. Pricing details are subject to change, so it's best to check Alchemy's official pricing page for current information.
Your API key is associated with your account's plan. If you exceed your plan's limits, requests may be throttled or you may be prompted to upgrade. Alchemy provides usage analytics in the dashboard to help you track consumption.
For developers exploring Alchemy, the free tier is often sufficient for testing and small projects. As your application scales, you can upgrade to a paid plan to accommodate higher traffic.
- Free tier available with monthly compute unit limits.
- Paid plans offer higher throughput and additional features.
- Usage is tracked per API key.
- Check official pricing for current rates and limits.
Troubleshooting Common API Key Issues
If your RPC requests fail, the issue may be related to your API key. Common problems include using an incorrect key, exceeding rate limits, or using the wrong endpoint for the network.
Ensure that the API key is correctly copied and that the URL matches the network you intend to use. For example, using an Ethereum mainnet key with a Polygon URL will not work.
If you receive authentication errors, verify that the key is active and not restricted by allowlists. Check the Alchemy dashboard for any alerts or usage limit notifications.
- Double-check the API key for typos.
- Confirm the endpoint URL matches the network.
- Review usage limits and upgrade if necessary.
- Check allowlist settings if requests are blocked.
Alternatives and Considerations
While Alchemy is a popular choice, some developers may consider other RPC providers based on specific needs such as geographic distribution, pricing, or network support. OnFinality is one such provider that offers RPC services for multiple networks, though its focus and feature set may differ.
When evaluating alternatives, consider factors like supported chains, latency, reliability, and developer tools. The choice often depends on your project's requirements and budget.
For those already using Alchemy, the API key system is well-documented and integrates with many popular web3 libraries like ethers.js, web3.js, and Solana's web3.js.
- Compare network coverage and performance.
- Evaluate pricing models and free tiers.
- Consider developer experience and available tooling.
- Test multiple providers for your specific use case.