List API keys
List the API keys of your wemail account: redacted prefixes, scopes, environment and last use. Full secrets are returned only when a key is created or rotated.
Manage API keys programmatically — useful for CI rotation or onboarding scripts. This endpoint lists every key with a redacted prefix; the full secret is returned only on creation.
How API keys work
An API key is the only credential the API and the SMTP relay accept. Each key has a scope — full_access, send_only or read_only — fixed at creation and changeable with PATCH /v3/keys/{id}, and an environment: afn_live_ keys send real mail, afn_test_ keys run the full pipeline in simulation. The secret is returned exactly once, on creation and on rotation. Revocation and scope changes propagate platform-wide within seconds, including to open SMTP sessions. Rate limits are per account, not per key — 10 requests per second on Free, 100 on Professional — so splitting traffic across keys does not raise the ceiling.
Endpoints in this section
GET /v3/keys lists keys with redacted prefixes (this page). POST /v3/keys creates one and returns the full secret. PATCH /v3/keys/{id} renames a key or changes its scope. POST /v3/keys/{id}/rotate issues a new secret and retires the old one after a grace period. DELETE /v3/keys/{id} revokes immediately. GET /v3/whoami tells you which key and account a credential resolves to — useful in CI before a deploy.
GET /v3/keys
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
page | integer | Optional | Page number, starting at 1. Default 1. |
per_page | integer | Optional | Keys per page, 1–100. Default 25. |
Responses
| Status | Description |
|---|---|
200 | OK. Your active API keys (id, name, prefix, scope, env, last_used_at) — the secret is never returned and revoked keys are excluded. |
401 | Missing or invalid API key. |
Code examples
curl https://api.wemail.io/v3/keys \
-H "Authorization: Bearer afn_live_…"const res = await fetch("https://api.wemail.io/v3/keys", {
headers: {
Authorization: `Bearer ${process.env.WEMAIL_API_KEY}`,
},
});
const data = await res.json();import os, requests
r = requests.get(
"https://api.wemail.io/v3/keys",
headers={"Authorization": f"Bearer {os.environ['WEMAIL_API_KEY']}"},
)
data = r.json()