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

# Sign-in and tokens

> How the hosted Email Love SDK signs in: secret keys on your server, 10-minute tokens for each user, test keys and allowed domains.

> [!NOTE]
>
> The hosted SDK is in early access. Details on this page may change before it's generally available.

The editor runs in your users' browsers, so anything in it is public. That's why there are two parts:

* **Secret keys** stay on your server.
* **Tokens** go to the browser. Each one names one of your users and lasts 10 minutes.

## Secret keys

| Key | Starts with | Works from | Counts as users |
| - | - | - | - |
| Test key | `els_sk_test_` | `localhost` and your allowed domains | No |
| Live key | `els_sk_live_` | Your allowed domains | Yes |

Test keys have low limits for test emails, AI and image storage. Use them while you build.

If a secret key gets out, make a new one and delete the old one. Tokens made with the old key stop working when they run out.

## Allowed domains

Tokens only work on the domains you list, for example `app.yourcompany.com`. The editor sends the page's address with each call, and Email Love refuses calls from anywhere else.

## Make a token

```http theme={null}
POST https://app.emaillove.com/api/sdk/v1/tokens
Authorization: Bearer els_sk_live_…
Content-Type: application/json
```

| Field | Required | What it is |
| - | - | - |
| `user` | Yes | Your id for the person using the editor. Each different id in a month is one user. |
| `name` | No | The person's name, shown to others when co-editing. |
| `role` | No | `user` (the default) or `admin`. Admins can change parts of the design system that are locked for other people. |

The response:

```json theme={null}
{ "token": "eyJhbGciOi…", "expiresAt": "2026-12-03T18:10:00Z" }
```

| Status | Meaning |
| - | - |
| `200` | The token is in the response. |
| `401` | The secret key is missing or wrong. |
| `402` | The plan has ended or payment failed. |
| `422` | `user` is missing. |

## Give the editor its token

Pass `hosted.getToken`. The editor calls it when it starts and again before each token runs out. Return the token, or the response from your token endpoint as it is.

```js theme={null}
hosted: {
  getToken: () => fetch('/email-editor-token', { method: 'POST' }).then(r => r.json()),
}
```

If `getToken` fails, the editor keeps working for editing and saving. Uploads, test emails and AI wait until it gets a token again.


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