Create an API key
POST/v1/api-keys
Creates a key for the same project as the key making the call. The new key can only have permissions that the calling key has itself, so this can never be used to gain more access. The secret is shown once. No key has the api_keys:manage scope by default; grant it deliberately.
Required scope: api_keys:manage
Request body
| Field | Type |
|---|---|
namerequired | string |
scopesoptional | "emails:send" | "emails:read" | "domains:manage" | "webhooks:manage" | "templates:manage" | "suppressions:manage" | "api_keys:manage" | "contacts:manage" | "broadcasts:manage" | "inbound:manage" | "emails:verify"[] |
permissionoptional | "full_access" | "sending_access" |
domain_idoptional | string |
expires_in_daysoptional | integer |
Unknown fields are rejected, so a typo never silently does nothing.
Example
curl -X POST 'https://api.sendsend.email/v1/api-keys' \
-H "Authorization: Bearer $SENDSEND_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"name": "ci",
"scopes": [
"emails:send"
]
}'Response 201
{
"id": "key_9Fq…",
"object": "api_key",
"name": "ci",
"scopes": [
"emails:send"
],
"secret": "ss_live_ab12cd34_…",
"note": "Copy this key now. It will not be shown again."
}Errors
| Status | Code | When |
|---|---|---|
| 400 | validation_error | The request body or parameters are invalid. The message says which field. |
| 403 | forbidden | The key lacks api_keys:manage, or you asked for a permission it does not have. |
| 401 | unauthorized | The API key is missing, invalid or revoked. |
Every error has the same shape. See Errors.