Skip to content

Get started

API keys: create, rotate and protect

Workspace owners and admins create API keys in the app. Each key belongs to one workspace, has a read, write or admin scope, can be limited to IP addresses, is shown only once and expires after 30, 90 or 365 days, or never. A key that looks leaked is blocked automatically.

How do I create a key?

  1. Open API keys in the app

    Sign in as an owner or admin of the workspace and open API keys.

  2. Name it, pick a scope and an expiry

    Use a name that says where the key is used (2–80 characters), and pick read for read-only integrations, write to send messages and change data, or admin to also read the security and audit log. Choose when it expires: 30 days, 90 days, 1 year (the default) or never.

  3. Copy the key

    The full key (pk_live_, 32 letters and digits, _ and a 6-character checksum) is shown once. whatsappx.si stores only a SHA-256 hash, so a lost key cannot be recovered; create a new one instead.

What does a key look like after creation?

Lists show the key’s metadata, never the secret:

FieldMeaning
idKey id, used to revoke it.
nameThe name you chose.
prefixThe first 16 characters (for example pk_live_3f9a1c0b), to recognise the key.
scoperead, write or admin.
created_at, expires_atUnix seconds. expires_at is 30, 90 or 365 days after creation, or 0 for a key that never expires.
revoked1 after the key was revoked, otherwise 0.
statusactive, blocked_leaked, revoked or expired.
blocked_at, blocked_reason, blocked_byWhen (Unix seconds, 0 if not blocked), why and by what (github, report, behaviour or admin) the key was blocked.
replaced_by, revoke_atThe key that replaced this one ("" if none), and when a rotated key stops working (0 if not scheduled).
allowed_ipsIP addresses and CIDR ranges the key works from; [] means any address.
last_used_at, last_used_ipWhen (Unix seconds, 0 if never) and from which address the key was last used.
keyThe secret, only in the create and rotate responses.

How do I limit a key to my servers?

Give the key an IP allowlist: up to 20 IP addresses or CIDR ranges (for example 203.0.113.10 or 198.51.100.0/24), when you create it or later with Update a key’s IP allowlist. A request from any other address gets:

{ "error": "this API key is not allowed from your IP address", "code": "ip_not_allowed" }

with status 403, and is recorded in the audit log as api_key.ip_denied. An empty list allows any address. With or without a list, a key used from an address it has not used before can raise an api_key_new_ip security alert. A key with an allowlist is never blocked by the unusual-use rules.

How long should a key last?

Pick the shortest expiry that fits: 30 or 90 days for tests and short projects, 1 year for an integration you look after. Never suits a key on fixed servers with an IP allowlist; rotate it now and then anyway. An email reminder goes out 7 days before a key expires. After expires_at, requests fail with 401 and invalid or expired API key.

How do I rotate a key?

Click Rotate next to the key in the app, or call Rotate an API key:

  1. Choose how long the old key keeps working: immediately, 1, 24 (the default), 48 or 72 hours.
  2. Copy the new key, which has the same name, scope and IP allowlist, and deploy it to your integration.
  3. Until then the old key shows Stops with a date (revoke_at), and is revoked automatically when the time is up. Requests with it then fail with 401 and invalid or expired API key.

Each key can be rotated once; rotate the new key next time. Rotations are recorded in the audit log as api_key.rotated.

Leaked key protection

A key that may have leaked is blocked: it stops working at once, but stays in the list so you can see what happened.

How are leaked keys found?

  • GitHub secret scanning. The key format is made for secret scanners. A key that GitHub's secret scanning reports to us (found in a public place on GitHub) is blocked (blocked_by: "github", with the location in blocked_reason).
  • Public reports. Anyone who finds a key can report it with Report a leaked key. No account is needed.
  • Unusual use (only keys without an IP allowlist). By default a key is blocked when it is used from 3 or more countries within an hour; from 20 or more IP addresses within 10 minutes (IPv6 counted per /64 network); or when a key in steady use (7 days or more, from at most 2 networks) is suddenly used from a new country and reads an unusually large amount of data in the same hour (over 2,000 messages or 500 conversations).

A single new IP address or country does not block a key; it only raises an api_key_new_ip security alert.

What happens when a key is blocked?

  • Every request with it gets 401:
{ "error": "This API key was blocked because it may have been leaked. Create a new key in Settings → API keys.", "code": "api_key_blocked" }
  • The workspace’s owners and admins, and the person who created the key, get one email with a link to API keys.
  • An api_key_leaked security alert and an api_key.blocked_leak audit log entry are recorded.
  • API keys in the app shows a red banner with Create replacement, which rotates the key with no grace period: a new key with the same name, scope and IP allowlist. Put it in your integration, then look for where the old key leaked and remove it.

If you are sure the key did not leak (a false alarm), an owner or admin can Unblock it (Unblock an API key). Unblocking is recorded as api_key.unblocked, and the unusual-use rules leave the key alone for 7 days.

What does a key look like?

Keys are 47 characters: pk_live_, 32 random base62 characters (0-9, A-Z, a-z), _ and a 6-character checksum. A scanner can find keys with this regular expression:

pk_live_[0-9A-Za-z]{32}_[0-9A-Za-z]{6}

The checksum is the CRC-32 (IEEE) of the first 40 characters (pk_live_ and the random part), written in base62 (digits, then A-Z, then a-z) and padded with 0 on the left to 6 characters. It lets a scanner tell a real key from a look-alike without calling the API:

import { crc32 } from 'node:zlib'; // Node 20.15+ or 22.2+

const B62 = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';

function hasValidChecksum(key) {
  const m = /^(pk_live_[0-9A-Za-z]{32})_([0-9A-Za-z]{6})$/.exec(key);
  if (!m) return false;
  let n = crc32(m[1]) >>> 0;
  let sum = '';
  for (let i = 0; i < 6; i++) {
    sum = B62[n % 62] + sum;
    n = Math.floor(n / 62);
  }
  return sum === m[2];
}

Keys created before 10 October 2026 (pk_live_ and 48 lowercase hex characters) keep working unchanged. Rotate them to get the new format.

How should I store keys?

  • Keep keys on your server, in a secret manager or environment variable. Never ship them in browser or mobile code.
  • Use one key per integration, so you can revoke one without breaking the others.
  • Prefer read keys for anything that only reads, and give the admin scope only to tools that need the audit log.
  • Limit keys that run on fixed servers to those IP addresses, and check last_used_at to find keys nobody uses any more.
  • Never commit keys to a repository, paste them in tickets or chats, or log them. If one gets out, rotate it at once.

Can I manage keys through the API?

The key endpoints exist, but they are Console only: they work with a signed-in owner or admin session, and API keys get 403 with API keys cannot administer workspaces.

Key endpoints