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

# Create and manage EmailUX API keys

> Generate, copy and revoke EmailUX API keys for your domains and providers, and use them with the API client.

An API key authenticates your calls with the `x-api-key` header. The API client sends it for you.

## Create a key

**1. Open your domain or provider**

Go to **Emails, Providers and API Keys** and find the card for your domain or provider.

**2. Generate the key**

Select **Generate API key**. For a SendGrid domain, the domain must be verified first. The button is disabled while it is pending.

**3. Copy and store it**

Copy the key and keep it in a secret store or an environment variable such as `EMAILUX_API_KEY`.

```ts theme={null}
const client = new EmailUxApiClient({
  apiKey: process.env.EMAILUX_API_KEY!,
  sendgridDomain: 'yourdomain.com',
});
```

> [!WARNING]
>
> Never put an API key in client-side code or a public repository. Call EmailUX from your server.

## Revoke a key

Choose **Revoke** next to the key. Revocation is **immediate and cannot be undone**, and revoked keys are shown with a *revoked* badge. Create a new key and update your environment variable.

## Troubleshooting

A `401` response means the key is missing, wrong or revoked. See the [API client](https://docs.emailux.com/api/api-client.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.