> For the complete documentation index, see [llms.txt](https://docs.mailofly.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mailofly.com/product-guides/api-keys.md).

# API keys

API keys authenticate requests to Mailofly’s public `/api/v1` routes. Each key is tied to your user, can have a label and optional expiry, and uses the `mf_live_` prefix so you can spot secrets in config files.

## What it is

When you create a key, the full secret is shown once. The app stores only a hash server-side. Send the key as `Authorization: Bearer <key>`. Your deployment must have the service role credential configured so Mailofly can validate keys.

## How it helps

* **Automation** — scripts and backends can manage contacts, campaigns, and sends without browser login.
* **Rotation** — create multiple keys, retire old ones, set expiries for contractors.
* **Least privilege mindset** — keys act as the owning user; combine with your own policies for who can create them.

## How to use it

Visit [API keys](https://www.mailofly.com/user/api-keys), create a key, copy it into your environment or secret manager, then call the API from your stack. Use `GET /api/v1` without a key to discover routes.

## Vs only using Supabase keys

Direct database keys would bypass Mailofly’s business rules. The Mailofly API key maps to your user through the app’s validation layer so quotas, RLS-backed data access, and campaign logic stay consistent.

## Related

* [REST API overview](/rest-api/api.md)
* [REST API: Accounts](/rest-api/accounts.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.mailofly.com/product-guides/api-keys.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
