> 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 five 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)                |
| **terms\_conditions:write** | Backend only | Record and read terms acceptances | Recording that a wallet accepted your terms document                         |
| **service\_role**           | Backend only | Full access                       | Creating/updating audiences programmatically                                 |

{% hint style="info" %}
`terms_conditions:write` is a narrow scope: it grants the two endpoints in [Terms & Conditions](/developer-guide/terms-conditions.md) and nothing else. Mint one when an external service or a teammate needs to record acceptances without holding a `service_role` key.
{% 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 %}
