GraphQL API

API Keys

Mint a scoped Org API key, list keys, and revoke one

These operations are dashboard-only: they need a login as an Owner or Admin of the org and cannot be called with an API key. That is deliberate - a leaked key must not be able to mint another, or widen its own scopes.

mintOrgApiKey

mintOrgApiKey(
  label: String
  scopes: [OrgApiKeyScope!]
  boundOrganisationId: ID
  dailySendCap: Int
  expiresAt: DateTime
  allowedCidrs: [String!]
): MintOrgApiKeyOutput!

Creates a key and returns its secret. The secret is shown once. Minting needs a plan with API access (Standard or higher); listing and revoking stay available after a downgrade.

Arguments

ArgumentTypeRequiredDescription
labelStringNoA human name, e.g. "CRM sync - prod". Shown in listings so you can tell keys apart.
scopes[OrgApiKeyScope!]NoThe scopes this key carries - 16 are available. See the scope table.
boundOrganisationIdIDNoLock the key to one managed client org. See bound keys.
dailySendCapIntNoSends per UTC day, 1 to 1,000,000.
expiresAtDateTimeNoMust be in the future.
allowedCidrs[String!]NoUp to 20 addresses or CIDR ranges.

Mint errors

MessageCause
boundOrganisationId must be a managed client organisation of this partnerNot your MANAGED child. One message for every failure, so it cannot be used to discover orgs.
A key bound to a client organisation cannot hold PARTNER_ADMINThose two are mutually exclusive by design.
dailySendCap must be an integer between 1 and 1000000Out of range.
expiresAt must be a date in the futureAlready past.
allowedCidrs accepts at most 20 entriesToo many.
allowedCidrs entry is not an IP address or CIDR range: <raw>Unparseable entry.
allowedCidrs entries cannot use prefix length 0 (it allows every address)/0 would allow everything.

Returns MintOrgApiKeyOutput!

FieldTypeDescription
idID!The key record's ID.
keyIdString!The public half. Use it to revoke.
plaintextString!The full credential, wx_<keyId>_<secret>. Returned only here, never again.
scopes[OrgApiKeyScope!]!The scopes actually granted.
boundOrganisationIdIDThe client org this key is locked to, or null.
dailySendCapIntThe cap, or null for none.
expiresAtDateTimeExpiry, or null.
allowedCidrs[String!]The allow-list, canonicalised, or null.

Example

mutation Mint {
  mintOrgApiKey(
    label: "CRM sync - prod"
    scopes: [MESSAGES_READ, MESSAGES_SEND, CONTACTS_READ, CONTACTS_MANAGE, PII_READ]
  ) {
    id
    keyId
    plaintext
    scopes
  }
}
{
  "data": {
    "mintOrgApiKey": {
      "id": "6716b3aa1c34d0012ab89f01",
      "keyId": "9f3c1a2b4d5e6f70",
      "plaintext": "wx_9f3c1a2b4d5e6f70_kQ8sN1pT4vR7wZ2yB5eH8jL0mQ3sV6x",
      "scopes": ["MESSAGES_READ", "MESSAGES_SEND", "CONTACTS_READ", "CONTACTS_MANAGE", "PII_READ"]
    }
  }
}

Store plaintext in your secret manager immediately. Later listings return only keyId and metadata. If you lose it, mint a new key and revoke the old one.

Think twice before including CONVERSATIONS_DELETE or CONTACTS_ERASE. Both are irreversible, neither is implied by the matching manage scope, and a key that only needs to read and reply needs neither.

Check what you actually got. Read scopes back from the response rather than assuming your request was granted verbatim - that is also the simplest way to confirm a key is as narrow as you intended.

orgApiKeys

orgApiKeys: [OrgApiKeyOutput!]!

Lists the org's keys with metadata. Never returns a secret. Takes no arguments.

Returns [OrgApiKeyOutput!]!

FieldTypeDescription
idID!The key record's ID.
keyIdString!The public half of the key.
labelStringThe name given at mint time.
scopes[OrgApiKeyScope!]!What this key can do.
statusPartnerApiKeyStatus!ACTIVE or REVOKED.
lastUsedAtDateTimeLast successful authentication. null if never used.
createdAtDateTimeWhen it was minted.
boundOrganisationIdIDThe client org this key is locked to, or null.
dailySendCapIntThe cap, or null.
expiresAtDateTimeExpiry, or null. An expired key still reads ACTIVE - it stops authenticating.
allowedCidrs[String!]The allow-list, or null.

The status field's type is named PartnerApiKeyStatus - a leftover from when keys were partner-only. Its values are ACTIVE and REVOKED, and it applies to every org key. Introspection will show that name.

Example

query Keys {
  orgApiKeys { keyId label scopes status lastUsedAt createdAt }
}

Use lastUsedAt to find keys nobody is using any more - an unused ACTIVE key is pure exposure.

updateOrgApiKey

updateOrgApiKey(keyId: String!, input: UpdateOrgApiKeyInput!): OrgApiKeyOutput!

Changes a key's limits without reissuing it. Owner or Admin login. Active keys only - a revoked or foreign key matches nothing.

UpdateOrgApiKeyInput { dailySendCap: Int, expiresAt: DateTime, allowedCidrs: [String!] }

Each field independently:

You sendResult
NothingUnchanged
nullCleared
A valueSet
mutation Edit {
  updateOrgApiKey(
    keyId: "9f3c1a2b4d5e6f70"
    input: { dailySendCap: 1000, expiresAt: null }
  ) { keyId dailySendCap expiresAt allowedCidrs }
}

allowedCidrs: [] is a 400, not a clear. Use null. An empty array is the shape a buggy client sends by accident, and it would silently remove the restriction.

Scopes and the bound org cannot be changed. Mint a new key instead - the guarantee behind handing a key out is that it cannot grow new powers later.

Changes propagate to other instances within the key cache's TTL, a few seconds.

Clearing expiresAt revives an expired key, which is why expiry is a safe limit to set. Revoke is the irreversible one.

revokeOrgApiKey

revokeOrgApiKey(keyId: String!): Boolean!

Revokes a key. It stops working immediately: the next request with it gets 401.

Arguments

ArgumentTypeRequiredDescription
keyIdString!YesThe keyId, not the record's id.

Returns Boolean! - true when revoked.

mutation Revoke {
  revokeOrgApiKey(keyId: "9f3c1a2b4d5e6f70")
}

orgApiKeyAudit

orgApiKeyAudit(
  pagination: GetCursorPaginatedInput
  filter: ApiKeyAuditFilterInput
): ApiKeyAuditPage!

Every write and every denial made with your org's keys, kept 90 days. Owner or Admin login.

ApiKeyAuditFilterInput { keyId: String, outcome: ApiKeyAuditOutcome, from: DateTime, to: DateTime } - from inclusive, to exclusive.

Returns ApiKeyAuditPage! - data, nextCursor, hasNext, and totalCount on the first page only.

ApiKeyAuditEntry:

FieldTypeDescription
idID!Entry id.
keyIdString!Which key acted.
targetOrganisationIdIDWhich org it acted on.
transportApiKeyAuditTransport!GRAPHQL or MCP.
operationString!GraphQL root field, or MCP tool name.
kindApiKeyAuditKind!READ or WRITE.
outcomeApiKeyAuditOutcome!ALLOWED or DENIED.
denyReasonApiKeyDenyReasonSCOPE, BOUND_ORG, SEND_CAP, CIDR, EXPIRED, REVOKED, BAD_SECRET, RATE_LIMITED, ORG_SUSPENDED.
ipStringCaller address, when known.
createdAtDateTime!When it happened.
query Denials {
  orgApiKeyAudit(pagination: { limit: 50 }, filter: { outcome: DENIED }) {
    totalCount
    data { keyId operation denyReason ip createdAt }
  }
}

Allowed reads are not recorded - only writes and denials. Nor are failures from an unknown key or a malformed credential, since there is no key to attribute them to. So the audit log answers "what did this key do and what was it refused", not "everything that ever touched my inbox".

partnerApiKeyAudit

partnerApiKeyAudit(
  pagination: GetCursorPaginatedInput
  filter: ApiKeyAuditFilterInput
): ApiKeyAuditPage!

The same page, for every key your provider org owns, across all your client orgs. Use targetOrganisationId to see which client each entry acted on.

Unlike orgApiKeyAudit, this one is callable with a key - it needs PARTNER_ADMIN and a tech provider org. So a provider's own integration can pull its audit trail on a schedule rather than someone opening the dashboard, which is what you want given the 90-day ceiling.

Retention

WhatKept
Key audit entries90 days
Partner webhook delivery history7 days

Neither is exportable after the fact. If you need a longer trail, copy entries out on your own schedule.

Rotating a Key

There is no rotate operation - do it in this order so you never have a gap:

  1. mintOrgApiKey with the same scopes as the old key.
  2. Deploy the new secret and confirm traffic on the new keyId (watch lastUsedAt).
  3. revokeOrgApiKey on the old keyId.

Changing Scopes

Scopes are fixed at mint time - there is no "edit scopes" operation. To widen or narrow a key, mint a replacement with the scope set you want and revoke the old one. That is intentional: a key's authority cannot drift after it has been handed out.

Was this page helpful?

On this page