# Enroll existing API key

`api_keys_enroll`

Makes a key you already use at Resend work here, so a program that holds it only needs a new address. The key is checked with Resend, kept as a hash like any other key, and gets the access it has there unless you narrow it.

Needs the scope: `api_keys:write`

## Arguments

- `name` (string, required): A name to recognise the key by, such as the app that holds it. Up to 120 characters.
- `token` (string, required): The key itself, as Resend gave it. It starts with `re_`. It is checked with Resend, kept as a hash and never shown again.
- `access` (string): What the key may do here: `full` or `sending`. Without it the key keeps what it may do at Resend. A key that only sends there cannot be given `full`. One of: `full`, `sending`.
- `domainId` (string): The id of the one domain the key may send from. Only for a key with `sending` access. Up to 64 characters.

## Returns

The answer comes back under `structuredContent`, with the same JSON as text in `content`. A call the API refuses comes back with `isError` set, and the code and the message under `structuredContent.error`. [MCP](https://opensend.sh/docs/mcp) shows how to connect a client.

- `object` ("api_key"): Always `api_key`.
- `id` (string): The id of the key.
- `name` (string): The name you gave the key.
- `access` (string): What the key may do: `full` for everything, `sending` for sending email and nothing else. One of: `full`, `sending`.
- `mode` (string): `live` for a key that sends real email, `test` for a key whose emails are simulated and reach nobody. One of: `live`, `test`.
- `preview` (string): The start of the key, enough to recognise it.
- `domainId` (string | null): The id of the one domain a sending key may send from, or `null` when it may send from any.
- `domain` (string | null): The name of that domain, or `null`.
- `lastUsedAt` (string | null): When the key last made a request, or `null` if it never has.
- `createdAt` (string): When the key was made.

## Example

MCP:

```json
{
  "name": "api_keys_enroll",
  "arguments": {
    "name": "Billing service",
    "token": "re_full_access_sample_key"
  }
}
```

Answer, under structuredContent:

```json
{
  "object": "api_key",
  "id": "key_05",
  "name": "Billing service",
  "access": "full",
  "mode": "live",
  "preview": "re_..._key",
  "domainId": null,
  "domain": null,
  "lastUsedAt": null,
  "createdAt": "2026-11-27T09:30:00.000Z"
}
```
