> For the complete documentation index, see [llms.txt](https://docs.fuul.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fuul.xyz/developer-guide/api-key-management.md).

# API Key Management

Fuul provides seven types of API keys, each designed for specific use cases. Using the right key type ensures your integration is secure and your data stays protected.

## Key types

| Key                         | Environment  | Permissions                                       | Use for                                                                                           |
| --------------------------- | ------------ | ------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| **Read-Only**               | Frontend     | Read data only                                    | Displaying leaderboards, rewards, and conversion info                                             |
| **send:tracking\_event**    | Frontend     | Read + send tracking events                       | Tracking `pageview`, `connect_wallet`, and custom frontend `sendEvent` calls                      |
| **send:trigger\_event**     | Backend only | Read + send trigger events                        | Sending custom offchain trigger events (e.g., social actions)                                     |
| **agreements:read**         | Frontend     | Read agreement acceptances                        | Checking whether a wallet accepted one of your [agreements](/developer-guide/terms-conditions.md) |
| **agreements:write**        | Backend only | Record and read agreement acceptances             | Recording that a wallet accepted one of your agreements                                           |
| **terms\_conditions:write** | Backend only | Record and read terms acceptances (legacy routes) | Integrations built before per-document agreements                                                 |
| **service\_role**           | Backend only | Full access                                       | Creating/updating audiences programmatically                                                      |

{% hint style="info" %}
`agreements:read`, `agreements:write`, and `terms_conditions:write` are narrow scopes: they grant only the endpoints in [Agreements & Terms Acceptance](/developer-guide/terms-conditions.md). Mint one when an external service or a teammate needs to read or record acceptances without holding a `service_role` key. New integrations should use the `agreements:*` scopes; `terms_conditions:write` only covers the legacy routes.
{% endhint %}

{% hint style="warning" %}
**Never expose `send:trigger_event` or `service_role` keys in the frontend.** A malicious user could send fake events or modify your program data.
{% endhint %}

## Creating an API key

1. Go to **Settings > API keys** in the Fuul dashboard and click **New API Key**
2. Select the key type you need
3. Name it and click **Create**
4. Copy the key from the modal — it won't be shown again

## Which key should I use?

Most frontend integrations only need a single `send:tracking_event` key. This covers both reading data (leaderboards, rewards) and sending the tracking events required for referral attribution.

| Scenario                                               | Recommended key          |
| ------------------------------------------------------ | ------------------------ |
| White-label hub with referral tracking                 | `send:tracking_event`    |
| Read-only dashboard or leaderboard widget              | `read-only`              |
| Backend sending custom events (Discord, Twitter, etc.) | `send:trigger_event`     |
| Backend recording terms acceptances only               | `terms_conditions:write` |
| Backend managing audiences via API                     | `service_role`           |

{% hint style="info" %}
For more details on audience management, see [Managing Audiences](/developer-guide/managing-audiences.md).
{% endhint %}
