Logo
New RPC users get 35% off their first monthView the offer
Infura
Infura5 min read

Infura API Key: How to Get, Use, and Secure It

A practical guide to Infura API keys: creation, usage, security, and integration with Ethereum and IPFS.

TL;DR

This guide explains what an Infura API key is, how to obtain one, how to use it with RPC endpoints for Ethereum and other networks, and best practices for keeping it secure. It also clarifies the relationship between API keys and project IDs.

What Is an Infura API Key?

An Infura API key is a credential that authenticates your requests to Infura's infrastructure services. Infura provides access to Ethereum and other blockchain networks via RPC endpoints, as well as IPFS and other services. The API key identifies your project and is required for most API calls.

In many contexts, the API key is also referred to as a project ID. When you create a project in the Infura dashboard, you receive a project ID that functions as your API key for RPC and IPFS endpoints.

  • API keys authenticate your requests and help Infura track usage.
  • The key is often used as a path parameter in RPC URLs.
  • Keep your API key confidential to prevent unauthorized use.

How to Get an Infura API Key

To obtain an Infura API key, you need to create an account on the Infura website. After signing up and logging in, you can create a new project. The project dashboard will display your project ID, which serves as your API key.

The process typically involves verifying your email, setting up a project name, and selecting the services you need (e.g., Ethereum, IPFS). Once created, you can view and manage your API keys in the project settings.

  • Sign up or log in at infura.io.
  • Create a new project from the dashboard.
  • Locate your project ID/API key in the project settings.
  • Optionally, generate additional keys or restrict them by domain.

Using Your Infura API Key with RPC Endpoints

Infura RPC endpoints require your API key to be included in the URL. The standard format for Ethereum mainnet is:

For other networks, replace 'mainnet' with the appropriate network name (e.g., 'goerli', 'sepolia'). For IPFS, the endpoint is typically https://ipfs.infura.io:5001/api/v0 with authentication via API key and secret.

  • Always use HTTPS to protect your key in transit.
  • Do not expose your API key in client-side code or public repositories.
  • Consider using environment variables to store keys securely.
https://mainnet.infura.io/v3/YOUR_API_KEY

Infura API Key vs. Project ID

In Infura's terminology, the project ID is the primary identifier used in API requests. It is effectively your API key for RPC and IPFS services. Some documentation may use 'API key' and 'project ID' interchangeably.

If you need separate keys for different applications, you can create multiple projects, each with its own project ID/API key.

  • Project ID = API key for most Infura services.
  • You can create multiple projects to isolate usage.
  • Project secrets are used for IPFS authentication in addition to the project ID.

Security Best Practices for Infura API Keys

API keys grant access to your Infura project and can incur usage costs. Treat them like passwords. Avoid committing them to version control, and use server-side proxies or environment variables when building applications.

Infura offers security features such as key restrictions by domain or IP address. Enable these where possible to limit the impact of a leaked key.

  • Never expose API keys in client-side code.
  • Use environment variables or secret managers.
  • Restrict keys by domain or IP when available.
  • Rotate keys periodically and revoke compromised keys immediately.

Common Use Cases and Considerations

Infura API keys are used for a variety of blockchain interactions: querying Ethereum data, sending transactions, deploying smart contracts, and interacting with IPFS. The same key can often be used across multiple networks, but usage limits and pricing may vary.

For pricing details, refer to Infura's official pricing page as plans and limits may change. Always monitor your usage to avoid unexpected charges.

  • Ethereum RPC access (mainnet and testnets)
  • IPFS storage and retrieval
  • Layer 2 networks and other supported chains
  • Development and production environments

Never Worry about Infrastructure Again

OnFinality takes away the heavy lifting of DevOps so you can build smarter and faster.

Get Started