Skip to content

API keys

Create an API key

Creates a key that expires after expires_in_days (365 by default, or never). The response is the only time the full key is shown; whatsappx.si stores only a SHA-256 hash of it.

POST/api/v1/keys
  • Console only: owner or admin
  • Workspace: X-Tenant-ID

Headers

  • Cookiestringrequired

    The whatsappx_session cookie the app sets when you sign in. Browsers send it automatically; API keys are not accepted on this endpoint.

    Example
    whatsappx_session=…
  • X-Tenant-IDuuidrequired

    Workspace id. Required for session requests. You can pass ?tenant=<id> instead.

    Example
    8d0f6c2e-3b1a-4c55-9a7e-2f4b6d1e9c30

Body

application/json
  • namestringrequired

    A name to recognise the key by.

    Constraints
    2–80 characters.
    Example
    CRM sync
  • scopeenumrequired

    read allows GET requests only; write allows every request an API key may make; admin is write plus the security and audit endpoints. full and full_access are accepted as write.

    Example
    write
  • allowed_ipsarray<string>optional

    IP addresses (203.0.113.10, 2001:db8::1) and CIDR ranges (198.51.100.0/24) the key may be used from. Requests from any other address get 403 with code: "ip_not_allowed". An empty array (or leaving it out) allows any address.

    Constraints
    At most 20 entries.
    Example
    ["203.0.113.10", "198.51.100.0/24"]
  • expires_in_daysintegeroptional

    How long the key works: 30, 90 or 365 days, or 0 for a key that never expires (expires_at: 0). Seven days before a key expires, an email reminder goes out.

    Constraints
    30, 90, 365 or 0.
    Default
    365
    Example
    90

Response

201 Createdapplication/json

  • iduuid

    Key id. Use it to delete the key.

  • namestring

    Name you gave the key.

  • prefixstring

    First 16 characters of the key (for example pk_live_3f9a1c0b), so you can recognise it.

  • scopeenum

    read (GET requests only), write (every request an API key may make) or admin (write plus the security and audit endpoints).

  • created_atinteger

    Creation time in Unix seconds.

  • expires_atinteger

    Expiry time in Unix seconds (30, 90 or 365 days after creation, as chosen); 0 when the key never expires.

  • revokedinteger

    1 once the key has been deleted (revoked), otherwise 0.

  • statusenum

    active, blocked_leaked (blocked because it may have been leaked), revoked or expired. A blocked key that was also revoked shows blocked_leaked.

  • blocked_atinteger

    When the key was blocked, in Unix seconds; 0 if it is not blocked.

  • blocked_reasonstring

    Why it was blocked, for example found in a public GitHub location https://github.com/…, reported as leaked or used from 3 countries within an hour (SI, US, BR); "" if it is not blocked.

  • blocked_byenum

    What blocked it: github (GitHub secret scanning), report (a public report), behaviour (unusual use) or admin; "" if it is not blocked.

  • replaced_byuuid

    Id of the key that replaced this one; "" if it was not replaced.

  • revoke_atinteger

    For a rotated key: when it stops working and is revoked automatically, in Unix seconds; 0 if nothing is scheduled.

  • allowed_ipsarray<string>

    IP addresses and CIDR ranges the key may be used from. An empty array means any address.

  • last_used_atinteger

    When the key was last used, in Unix seconds; 0 if it was never used. Updated at most once a minute, or sooner when the address changes.

  • last_used_ipstring

    IP address of the last request made with the key; "" if it was never used.

  • keystringmay be absent

    The full secret key. Returned only in the create and rotate responses.

Status codes

  • 201Created. The new key, including the secret key.
  • 400Bad request. name must be 2–80 characters, a scope other than read, write or admin, an allowed_ips entry that is not an IP address or CIDR range, more than 20 entries, an expires_in_days other than 30, 90, 365 or 0, or invalid body. The error says which.
  • 401Unauthorized. No signed-in session (unauthorized).
  • 403Forbidden. API keys can never call this endpoint (API keys cannot administer workspaces). A signed-in user who is not an owner or admin gets admin required; a user who is not a member of the workspace gets forbidden.