# API Keys

> **NOTE — unofficial library.** `@p4n/erc8004-ui` is an independent, community-built project. It is not affiliated with, maintained by, or endorsed by the authors of ERC-8004. It reads the standard's on-chain data through public subgraphs; it does not speak for the standard.

Components fetch agent data from The Graph, a blockchain indexing service. You need a free API key to authenticate your requests.

## How to Get One

1. Go to [thegraph.com/studio](https://thegraph.com/studio/) and create an account.
2. Create an API key in the dashboard.
3. Copy the key.
4. Pass it to `ERC8004Provider`.

```tsx
<ERC8004Provider apiKey="your-graph-api-key">
  {/* your components */}
</ERC8004Provider>
```

## Is It Safe to Use in Frontend Code?

Yes. Graph API keys are read-only query keys — they only authorise GraphQL reads against Subgraphs. They cannot modify any on-chain data, they cannot write to any database, and they cannot access anything outside your Subgraph queries. Their only purpose is usage tracking and rate limiting.

This is the same pattern used by every dApp that queries The Graph, including most major DeFi protocols. Exposing the key in frontend code is expected and safe.

## Free Tier

The Graph offers a free tier that's sufficient for development and moderate production use. Sign in to [the Graph Studio dashboard](https://thegraph.com/studio/) to view current limits and usage for your key.

## Custom Subgraph Endpoint

If you run your own Subgraph or use a different indexer, use the `subgraphOverrides` prop on `ERC8004Provider` to override the default endpoint for any chain:

```tsx
<ERC8004Provider
  apiKey="your-key"
  subgraphOverrides={{
    1: "https://your-custom-subgraph.com/ethereum",
    8453: "https://your-custom-subgraph.com/base",
  }}
>
```

Keys are chain IDs. Overrides apply per-chain — chains not listed fall back to the default Graph endpoints.

## Reference

- Live page: https://erc8004-ui.vercel.app/docs/api-keys
- Markdown source: https://erc8004-ui.vercel.app/docs/api-keys.md
