Revoke an API key

Revoke an API key immediately.

Revokes the key so new requests fail with 401. Because authentication results are cached briefly, a revoked key can keep authenticating for up to a few minutes — treat revocation as fast, not instantaneous, and rotate leaked keys immediately. Revocations are recorded in the audit log and the account owner is notified by email.

DELETE /v3/keys/{id}

Responses

StatusDescription
200Revoked. { message: "API key revoked" }.
401Missing or invalid API key.
404No such key on your account, or it has already been revoked.

Code examples

cURL
curl -X DELETE https://api.wemail.io/v3/keys/{id} \
  -H "Authorization: Bearer afn_live_…"
Node.js
const res = await fetch("https://api.wemail.io/v3/keys/{id}", {
  method: "DELETE",
  headers: {
    Authorization: `Bearer ${process.env.WEMAIL_API_KEY}`,
  },
});
const data = await res.json();
Python
import os, requests

r = requests.delete(
    "https://api.wemail.io/v3/keys/{id}",
    headers={"Authorization": f"Bearer {os.environ['WEMAIL_API_KEY']}"},
)
data = r.json()