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
| Argument | Type | Required | Description |
|---|---|---|---|
label | String | No | A human name, e.g. "CRM sync - prod". Shown in listings so you can tell keys apart. |
scopes | [OrgApiKeyScope!] | No | The scopes this key carries - 16 are available. See the scope table. |
boundOrganisationId | ID | No | Lock the key to one managed client org. See bound keys. |
dailySendCap | Int | No | Sends per UTC day, 1 to 1,000,000. |
expiresAt | DateTime | No | Must be in the future. |
allowedCidrs | [String!] | No | Up to 20 addresses or CIDR ranges. |
Mint errors
| Message | Cause |
|---|---|
boundOrganisationId must be a managed client organisation of this partner | Not 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_ADMIN | Those two are mutually exclusive by design. |
dailySendCap must be an integer between 1 and 1000000 | Out of range. |
expiresAt must be a date in the future | Already past. |
allowedCidrs accepts at most 20 entries | Too 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!
| Field | Type | Description |
|---|---|---|
id | ID! | The key record's ID. |
keyId | String! | The public half. Use it to revoke. |
plaintext | String! | The full credential, wx_<keyId>_<secret>. Returned only here, never again. |
scopes | [OrgApiKeyScope!]! | The scopes actually granted. |
boundOrganisationId | ID | The client org this key is locked to, or null. |
dailySendCap | Int | The cap, or null for none. |
expiresAt | DateTime | Expiry, 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!]!
| Field | Type | Description |
|---|---|---|
id | ID! | The key record's ID. |
keyId | String! | The public half of the key. |
label | String | The name given at mint time. |
scopes | [OrgApiKeyScope!]! | What this key can do. |
status | PartnerApiKeyStatus! | ACTIVE or REVOKED. |
lastUsedAt | DateTime | Last successful authentication. null if never used. |
createdAt | DateTime | When it was minted. |
boundOrganisationId | ID | The client org this key is locked to, or null. |
dailySendCap | Int | The cap, or null. |
expiresAt | DateTime | Expiry, 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 send | Result |
|---|---|
| Nothing | Unchanged |
null | Cleared |
| A value | Set |
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
| Argument | Type | Required | Description |
|---|---|---|---|
keyId | String! | Yes | The 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:
| Field | Type | Description |
|---|---|---|
id | ID! | Entry id. |
keyId | String! | Which key acted. |
targetOrganisationId | ID | Which org it acted on. |
transport | ApiKeyAuditTransport! | GRAPHQL or MCP. |
operation | String! | GraphQL root field, or MCP tool name. |
kind | ApiKeyAuditKind! | READ or WRITE. |
outcome | ApiKeyAuditOutcome! | ALLOWED or DENIED. |
denyReason | ApiKeyDenyReason | SCOPE, BOUND_ORG, SEND_CAP, CIDR, EXPIRED, REVOKED, BAD_SECRET, RATE_LIMITED, ORG_SUSPENDED. |
ip | String | Caller address, when known. |
createdAt | DateTime! | 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
| What | Kept |
|---|---|
| Key audit entries | 90 days |
| Partner webhook delivery history | 7 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:
mintOrgApiKeywith the same scopes as the old key.- Deploy the new secret and confirm traffic on the new
keyId(watchlastUsedAt). revokeOrgApiKeyon the oldkeyId.
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.