API reference

API keys

Manage the keys that authenticate your API requests. For how to use them and security guidance, see Authentication & API keys. Paths are relative to https://app.blacklistguard.com/api/v1.

List keys

GET /api-keys?search=&is_active=&page=1&limit=20
GET /api-keys/{id}

Lists your workspace's keys, active ones first, then newest. search matches part of the name, is_active is true or false, and limit goes up to 100. Leave is_active out to get active keys only, or add show_inactive=true to get all of them.

{ "api_keys": [{ "id", "name", "permissions", "is_active", "is_expired", "key_hint", "last_used_at", "expires_at", "created_at" }],
  "pagination": { "page", "limit", "total", "total_pages" } }

The secret itself is never returned after creation. key_hint shows its first 6 and last 3 characters, like efk_uE...gI=, so you can tell keys apart; keys made before November 13, 2026 have no hint until you regenerate them. is_expired is true once expires_at has passed, while is_active stays true.

Create a key

POST /api-keys
{ "name": "orders-service-prod", "permissions": ["campaigns:read", "campaigns:send"], "expires_at": "2026-12-31T00:00:00Z" }

Returns the new key's secret once: { "key": "efk_...", "key_hint": "efk_uE...gI=" }. Store it immediately. It can't be retrieved again.

name is required, up to 100 characters. expires_at is optional: an RFC 3339 time in the future, or leave it out for a key that doesn't expire. Send the key in the X-API-Key header.

permissions takes values from the permissions catalogue below. Grant only what the integration needs. A key that calls an endpoint outside its permissions is refused with 403 INSUFFICIENT_SCOPE, and the response names the permission it needs in required_scopes, an array with one value.

{ "success": false, "error": "This API key is missing the required permission.", "code": "INSUFFICIENT_SCOPE", "required_scopes": ["campaigns:send"] }

Available permissions

GET /api-keys/permissions

Returns the complete catalogue of permissions the API accepts. It is generated from the same definitions the API checks against, so it is always current. Read the values from here rather than hard-coding a list.

{
  "resources": [
    {
      "resource": "campaigns",
      "label": "Campaigns",
      "group": "Messaging",
      "wildcard": "campaigns:*",
      "covers": ["/campaigns"],
      "actions": [
        { "action": "read",  "label": "Read",  "value": "campaigns:read" },
        { "action": "write", "label": "Write", "value": "campaigns:write" },
        { "action": "send",  "label": "Send",  "value": "campaigns:send" }
      ]
    }
  ],
  "wildcards": [
    { "action": "*",    "label": "Full access to everything",     "value": "*:*" },
    { "action": "read", "label": "Read-only access to everything", "value": "*:read" }
  ],
  "presets": [
    { "preset": "full",      "label": "Full access", "values": ["*:*"] },
    { "preset": "read_only", "label": "Read-only",   "values": ["*:read"] }
  ]
}
  • value is the exact string to send in permissions. Use it verbatim rather than joining resource and action yourself.
  • wildcard grants every action on that resource; covers lists the API paths the resource governs.
  • presets are ready-made sets for the common cases.

For how an endpoint's required permission is determined, and the shape of a refusal, see Authentication → Permissions.

Update

PUT /api-keys/{id}
{ "name?": "...", "permissions?": ["campaigns:read"], "expires_at?": "..." }

Fields you leave out stay as they are. To change the expiry, send a time in the future; to remove it, send "expires_at": "". A time in the past is refused.

Rotate, deactivate & reactivate

POST   /api-keys/{id}/regenerate    → { "id", "key": "efk_...", "key_hint" }   (new secret, same key record)
DELETE /api-keys/{id}               (deactivate, reversible)
POST   /api-keys/{id}/reactivate
DELETE /api-keys/{id}/permanent     (delete for good)

Regenerating stops the old secret at once and keeps the name, permissions and expiry. Deactivating takes effect on the key's next request. A deactivated key still counts toward your plan's key limit until you delete it permanently. After a permanent delete, the emails it sent stay in your totals, but the key leaves GET /stats/api and you can no longer filter messages by it.

To rotate without downtime, create a new key, deploy it, confirm traffic on the new secret, then deactivate the old one.

Request limit

Your workspace's keys can make 10 requests a second between them. Every response carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset (the Unix second the window ends). Over the limit you get 429 with code RATE_LIMIT_EXCEEDED and Retry-After: 1. Requests from the console don't count.

A key that is unknown, deactivated or expired gets 401 with code INVALID_API_KEY. The response doesn't say which.

Who can manage keys, and errors

Creating, updating, rotating, deactivating and deleting keys only works from a signed-in console session. An API key can't manage keys, including itself. Every one of these changes also needs the admin role.

StatusCodeWhen
403FORBIDDENYou aren't an admin. The message is Administrator access required.
400BAD_REQUESTpermissions contains a value that isn't in the catalogue. The message is Unknown permission: <value>.
404NOT_FOUNDNo key with that ID. The message is API key not found.