# Enroll existing API key

`POST /v1/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`

## Body parameters

- `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

- `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

cURL:

```bash
curl -X POST "$OPENSEND_API_URL/v1/api-keys/enroll" \
  -H "Authorization: Bearer $OPENSEND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Billing service",
  "token": "re_full_access_sample_key"
}'
```

TypeScript:

```ts
await opensend.apiKeys.enroll({
  name: 'Billing service',
  token: 're_full_access_sample_key',
})
```

CLI:

```bash
opensend api-keys enroll \
  --name 'Billing service' \
  --token re_full_access_sample_key
```

MCP:

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

Answer:

```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"
}
```
