# API Key Management

Fuul provides four 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)                |
| **service\_role**        | Backend only | Full access                 | Creating/updating audiences programmatically                                 |

{% 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 managing audiences via API                     | `service_role`        |

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fuul.xyz/developer-guide/api-key-management.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
