Revoke a workspace API key

Revoke a workspace's API key with an organisation key. Every integration using it stops within seconds; this cannot be undone.

DELETE /v3/organisation/workspaces/{id}/keys/{key_id}

Response (200)

json
{
  "message": "API key revoked"
}

Responses

StatusDescription
200OK. { "message": "API key revoked" }.
401Missing or invalid organisation key — workspace keys (afn_live_ / afn_test_) are refused here by design.
403insufficient_scope — the key lacks keys:write — or ip_not_allowed.
404No such workspace or key in your organisation.

Code examples

cURL
curl -X DELETE https://api.wemail.io/v3/organisation/workspaces/9d2f6c1e-4b3a-4e7d-8a1f-0c5b7e9d2a64/keys/3f6b2a9e-1c4d-4e8f-9a0b-5c6d7e8f9a0b \
  -H "Authorization: Bearer afn_org_…"
Node.js
const res = await fetch("https://api.wemail.io/v3/organisation/workspaces/9d2f6c1e-4b3a-4e7d-8a1f-0c5b7e9d2a64/keys/3f6b2a9e-1c4d-4e8f-9a0b-5c6d7e8f9a0b", {
  method: "DELETE",
  headers: { Authorization: "Bearer " + process.env.WEMAIL_ORG_KEY },
});
console.log(await res.json());
Python
import os, requests

res = requests.delete(
    "https://api.wemail.io/v3/organisation/workspaces/9d2f6c1e-4b3a-4e7d-8a1f-0c5b7e9d2a64/keys/3f6b2a9e-1c4d-4e8f-9a0b-5c6d7e8f9a0b",
    headers={"Authorization": "Bearer " + os.environ["WEMAIL_ORG_KEY"]},
)
print(res.json())
ResponseExample response
{
  "message": "API key revoked"
}