> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mailofly.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create API key

> How to create and use API keys in Mailofly.

# Create API key

API keys let your app call the Mailofly REST API and SDKs.

<Warning>
  The secret is shown **once**. Copy it immediately — Mailofly only stores a hash.
</Warning>

***

## Create a key

1. Open **[API keys](https://www.mailofly.com/user/api-keys)**
2. Click **Create key** and give it a name (e.g. `production`)
3. Copy the value — it starts with `mf_live_`

Store it as an environment variable:

```bash theme={null}
export MAILOFLY_API_KEY=mf_live_…
```

***

## Use it

Every authenticated request needs:

```http theme={null}
Authorization: Bearer mf_live_…
```

**SDK example (Node.js):**

```ts theme={null}
import { Mailofly } from "mailofly";

const client = new Mailofly({ apiKey: process.env.MAILOFLY_API_KEY! });
```

**cURL:**

```bash theme={null}
curl https://api.mailofly.com/v1/accounts \
  -H "Authorization: Bearer $MAILOFLY_API_KEY"
```

***

## Tips

* One key per service (easier to rotate)
* Never commit keys to git
* Prefer short-lived keys for contractors / staging

***

## Next

* [Connect a sending account](sending-accounts.md) — you need an `acc_…` key to send
* [Node.js quickstart](nodejs.md) — send your first email from code
* [API Reference](https://docs.mailofly.com/api)


## Related topics

- [Manage API Keys](/guides/api-keys/manage-api-keys.md)
- [Leaked API Keys](/guides/api-keys/leaked-api-keys.md)
- [SDKs](/sdks/index.md)
- [AI onboarding](/getting-started/ai-onboarding.md)
- [API Key Security](/guides/api-keys/api-key-security.md)
