Skip to content

Delete an API key

Revoke a key. Any call using it stops working immediately.

http
DELETE /v1/api-keys/{id}

Requires a Full access API key.

Path parameters

ParameterTypeRequiredDescription
idstringYesThe API key id.

Example

bash
curl -X DELETE "https://api.sendgrail.com/v1/api-keys/$API_KEY_ID" \
  -H "Authorization: Bearer $SENDGRAIL_API_KEY"
js
await fetch(`https://api.sendgrail.com/v1/api-keys/${id}`, {
  method: 'DELETE',
  headers: { Authorization: `Bearer ${process.env.SENDGRAIL_API_KEY}` },
});

Response

json
{
  "object": "api_key",
  "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e",
  "deleted": true
}

Deleting is how you rotate: create the replacement, move your integration onto it, then delete the old key. The order matters — the moment a key is deleted, every request still using it fails with 401.

You cannot delete the key you are using

Deleting the key in the Authorization header of the very request doing the deleting is refused with 409:

json
{
  "message": "You cannot delete the API key you are authenticating with.",
  "code": "api_key_in_use",
  "request_id": "8f2c1e64-1b17-4f8c-9f0e-3b6c1e0f5c31"
}

It would technically succeed — the request is already authenticated — but your next call would fail with a key that no longer exists, which is rarely what a script that just deleted "a key" intended. Delete it with a different key, or from the dashboard.

Transactional email on your own domain.