Authentication

Org API keys, scopes, acting on a child org, and how PII is masked

Any Wexio organization on a qualifying plan can mint an Org API key and drive its own inbox from a backend. There is no separate partner credential - a partner is simply an org whose key may also act on the client orgs it manages.

The API needs Standard or higher, and MCP needs Pro.

SurfacePlan
GraphQL API with a keyStandard, Pro or Enterprise
MCP serverPro or Enterprise
WebhooksPro or Enterprise

This is checked on every call, not only when the key is minted. Downgrade and existing keys stop working; upgrade and they work again. Keys are never revoked for a plan change, so you do not have to re-issue them - see what a downgrade does.

Tech providers and their client organisations are not affected: they are billed by usage rather than a retail plan.

Request Headers

Authorization: Bearer wx_9f3c1a2b4d5e6f70_kQ8sN1pT4vR7wZ2yB5eH8jL0mQ3sV6x
HeaderRequiredValue
AuthorizationYesBearer followed by the key, wx_<keyId>_<secret>.
X-Wexio-OrgNoA managed child org to act on instead of your own. Only a tech provider's key may use it.

A key always acts on its own org unless X-Wexio-Org names a child the caller actually manages.

The raw X-Wexio-Org header is never trusted on its own. The server checks that the key's org is a TECH_PROVIDER and that the named org is one of its managed children. If it is not, the request fails - a key cannot reach sideways into an unrelated org by guessing an ID.

Scopes

Every key carries an explicit list of scopes, chosen at mint time. A call is rejected unless the key holds the scope the operation requires.

ScopeUnlocks
MESSAGES_READReading conversations, messages, search, media and media counts
MESSAGES_SENDSending, editing and deleting messages; reactions; media upload. Replies only - see below
CONVERSATIONS_STARTStarting a conversation that does not exist yet. Needed in addition to MESSAGES_SEND
CONVERSATIONS_MANAGEInbox state: read/unread, close/reopen, assign, block, labels, collections, AI toggle, custom fields
CONTACTS_READReading and searching contacts; reading people-field definitions and values
CONTACTS_MANAGECreating and updating contacts; managing field definitions and values
CONTACTS_ERASEPermanently erasing a contact (GDPR right to erasure)
CONVERSATIONS_DELETEPermanently deleting chats and conversations, with their messages and media
CHANNELS_MANAGEConnecting and disconnecting channels; listing them; syncing WhatsApp templates
NOTES_WRITEInternal team notes - both writing them and seeing them at all
PII_READUnmasked customer identity: names, phones, emails, avatars, author, location, field values
TEAM_READListing org members
TEAM_MANAGEAdding, re-roling and removing members
CONTENT_READReading Help articles, News posts, their folders, categories and tags, and AI knowledge documents
CONTENT_MANAGECreating, editing, publishing and deleting that content; creating, changing, publishing, restoring, deleting and attaching knowledge documents
PARTNER_ADMINTech providers only: provisioning client orgs, the fan-out webhook, the usage rollup

Scopes are independent. A key with MESSAGES_SEND but not MESSAGES_READ can send and never read.

Reply-Only Keys

MESSAGES_SEND on its own is reply-only: the key can answer a chat that already exists, and cannot open a new one. Starting a conversation needs CONVERSATIONS_START as well.

Scopes heldCan answer an existing chatCan start a new conversation
MESSAGES_SENDYesNo
MESSAGES_SEND + CONVERSATIONS_STARTYesYes

In MCP terms, send_message needs MESSAGES_SEND; trigger_conversation needs both, and a reply-only key is refused with the ordinary scope error.

This is the split worth using when you connect an AI agent. An agent that answers customers needs to reply, not to reach out - and a reply-only key cannot cold-message anyone even if the model is talked into trying. See connecting an external AI agent securely.

Keys minted before this scope existed were migrated with it, so nothing that could start conversations stopped being able to.

The two destructive scopes are deliberately separate from the manage scopes they sit next to:

  • CONTACTS_ERASE is not part of CONTACTS_MANAGE - a key that maintains contacts day to day should not be able to destroy them.
  • CONVERSATIONS_DELETE is not part of CONVERSATIONS_MANAGE - triaging the inbox and deleting it permanently are different jobs.

Grant each only to the integration that actually needs it. Both are irreversible, and some operations need both: deleting a conversation with removePeople: true is a GDPR erase and requires CONVERSATIONS_DELETE and CONTACTS_ERASE.

PARTNER_ADMIN is the one scope that only means something on a tech provider org (kind TECH_PROVIDER) - it gates provisioning client orgs, managing the fan-out webhook, and reading the usage rollup. On any other org's key it unlocks nothing, including on a PARTNERSHIP distribution partner.

Members are not scoped. A human logged into the dashboard holds every scope implicitly - their authority comes from their role. Scopes exist to constrain machines.

Pick the Narrowest Set

A key is a long-lived credential on a live customer inbox. Mint one key per job:

The integration…Scopes
Mirrors conversations into your product, read-onlyMESSAGES_READ
Mirrors and repliesMESSAGES_READ, MESSAGES_SEND
Replies and triages the inboxadd CONVERSATIONS_MANAGE
Syncs a CRM both waysadd CONTACTS_READ, CONTACTS_MANAGE, PII_READ
Handles data-deletion requestsadd CONTACTS_ERASE
Deletes conversations permanentlyadd CONVERSATIONS_DELETE
Manages the web widget or connects client channelsadd CHANNELS_MANAGE
Publishes Help or News content, or feeds the AI knowledge documentsadd CONTENT_READ, CONTENT_MANAGE
Provisions client orgs (tech providers)add PARTNER_ADMIN

PII Masking

Customer identity is withheld from any key that does not hold PII_READ. The request still succeeds - the fields simply come back null, and participant lists come back empty.

What PII_READ gates:

  • Names, phone numbers, email addresses, avatars
  • Chat participants and message authors
  • Location payloads
  • People-field values

Masking is not an error, and a masked read is indistinguishable from an unset value. If identity fields are unexpectedly null, check the key's scopes before assuming the data is missing.

Filters Are Refused, Not Just Masked

A masked key cannot use identity as a filter either - otherwise the filter itself would be an oracle on the data the masking hides.

Attempt without PII_READResult
A rule on contact name, assignee, or a person profile field403
Free-text contact search403
Reading a collection's rule values for those fields, or for message textReturned as null
ChatCollection.createdBynull

This is why a masked key sees a collection it cannot reconstruct: the collection still works and still filters, but the values inside its rules come back empty. The filtering happens server-side on data the key may not read.

Internal Notes

Internal notes are team-only messages that never reach the customer. They are invisible to a key without NOTES_WRITE - not redacted, absent: excluded from reads, from previews, and their media attachments are hidden too.

With NOTES_WRITE, a key can read notes and post them by sending a message with internal: true, or by adding a note to a conversation.

There is no separate notes-read scope - NOTES_WRITE gates both directions. Without it:

  • notes, system rows and internal actions are absent from reads;
  • a message-text rule never matches a note;
  • storing a collection with message-level rules is 403;
  • labelling a note answers not-found.

How Requests Are Checked

In order:

  1. Key valid? Missing, malformed, revoked or expired → 401. A revoked key stops working immediately.
  2. Target org allowed? X-Wexio-Org naming an org you don't manage → 403.
  3. Scope held? The operation's required scope missing from the key → 403, naming the scope.
  4. PII? Masked in the response when PII_READ is absent, rather than refused.

When the Workspace Is Paused

A key belongs to the workspace that created it. If that workspace has an unpaid invoice past the 7-day grace period, it is paused and every call is refused with 403 PAYMENT_OUTSTANDING, on GraphQL and on MCP. The check is on the key's owner, and a provider's client organisations are not checked on their own. Keys are kept and nothing is revoked, and calls work again within seconds after the invoice is paid. The audit log records the refusal with denyReason ORG_SUSPENDED. See Workspace Paused for Payment.

What Happens on a Downgrade

Nothing is deleted, and nothing needs re-issuing. Access simply stops until the plan is restored.

KeysKept. Every call returns PLAN_FEATURE_NOT_ALLOWED with the feature that is missing: apiAccess, mcp or webhooks.
MCP403 with {"error":"plan_feature_not_allowed","feature":"mcp"}.
Webhook deliveryPaused automatically. The connections themselves are kept.
Inbound webhooksRejected with 400 WEBHOOK_UNAVAILABLE.
Still available on any planListing, viewing, pausing and deleting connections, and reading delivery history.
Needs ProCreating, editing or reactivating a connection.

Upgrading restores everything, with webhook delivery resuming within about a minute.

Because keys survive, a lapsed subscription is a pause rather than a migration. Your integration starts working again on its own once the plan is back - there is no key rotation or reconfiguration to redo.

Managing Keys

Minting, listing and revoking keys is dashboard-only - a login as an Owner or Admin of the org, under Settings → Webhooks and API → API keys. See API Keys in the Dashboard for the screens. These operations cannot be called with a key, so a leaked key can never mint another. See API keys.

Store the secret at mint time. The full wx_... value is returned once and never again. Later listings show only keyId, label, scopes, status and last-used time.

To rotate: mint a new key, deploy it, confirm traffic on the new keyId, then revoke the old one.

Narrowing a Key

Beyond scopes, four optional limits can be set at mint time. All are null by default, and null means the limit is not applied.

OptionWhat it does
boundOrganisationIdLocks the key to one managed client org. See below.
dailySendCapMaximum sends per UTC day, 1 to 1,000,000.
expiresAtA future date after which the key stops working.
allowedCidrsUp to 20 IPv4/IPv6 addresses or ranges the key may be used from.
mutation Mint {
  mintOrgApiKey(
    label: "Support agent, client Acme"
    scopes: [MESSAGES_READ, MESSAGES_SEND]
    boundOrganisationId: "<managed client org id>"
    dailySendCap: 500
    expiresAt: "2027-01-01T00:00:00Z"
    allowedCidrs: ["203.0.113.0/24"]
  ) { keyId plaintext scopes boundOrganisationId dailySendCap expiresAt allowedCidrs }
}

updateOrgApiKey changes dailySendCap, expiresAt and allowedCidrs on an active key. Per field: omit to leave unchanged, send null to clear, send a value to set. An empty allowedCidrs: [] is a 400 - clear it with null, so widening is never an accident.

Scopes and the bound org are not editable. Changing either means minting a new key, because the point of both is that the key you handed out cannot grow new powers.

Bound Keys

A bound key can act on its one client org and nothing else.

  • Omit x-wexio-org (GraphQL) or orgId (MCP) and the call goes to the bound org. You do not have to pass it.
  • Pass any other id - a sibling client, your own provider org, a detached child, a stranger - and the call is 403 Not a managed client organisation. The error is identical for all of them, so it cannot be used to discover which orgs exist.
  • A bound key cannot hold PARTNER_ADMIN and cannot reach partner-only endpoints, including hosted connect. Those need an unbound provider key.

This is what lets you give one client's integration a credential that is useless against another client, instead of one provider key that can reach everything.

Daily Send Cap

A counter per key, reset at UTC midnight. On the cap the call fails with 429 and API_KEY_SEND_CAP_EXCEEDED; the error carries retryAfterMs, the milliseconds until the next reset.

CountedNot counted
sendMessage, retryFailedMessage, sendWhatsAppTemplateMessageReactions, updateMessage, sendConversationNote
MCP send_message, trigger_conversation, retry_message, add_conversation_note, start_flowEverything that reads

A call refused for any reason - missing scope, wrong org, bad secret - burns no units.

The cap fails closed: if the counter store is unreachable, sends are refused rather than let through uncounted. Pick a cap you are comfortable being the ceiling during an incident, not a number you expect to hit daily.

Expiry

An expired key is still ACTIVE, it simply stops authenticating. The owner can extend or clear expiresAt to bring it back, which makes expiry a safe default for a contractor or a trial rather than a destructive one. Revoke remains the kill switch, and a revoked key never comes back.

IP Allow-List

allowedCidrs restricts where a key may be used from. The address is checked before the key is looked up, so a call from a disallowed address costs nothing and is refused with 403 API key not allowed from this address.

Rules: at most 20 entries; each an IPv4/IPv6 address or CIDR range; prefix /0 is refused because it allows everything; entries are canonicalised to the network base, so 10.1.2.3/24 is stored as 10.1.2.0/24 and duplicates collapse.

The client address is taken from Wexio's edge proxy, which is the only thing in front of the hosted API, so a caller cannot set it themselves with a forwarded-for header.

Audit Log

Every write and every denial is recorded per key, for 90 days. Allowed reads are not recorded, and neither are failures from an unknown key or a malformed credential - those never identify a key to attribute them to.

query Audit {
  orgApiKeyAudit(
    pagination: { limit: 50 }
    filter: { keyId: "<keyId>", outcome: DENIED }
  ) {
    totalCount nextCursor hasNext
    data { keyId targetOrganisationId transport operation kind outcome denyReason ip createdAt }
  }
}

orgApiKeyAudit covers your own org's keys and needs a member login. Tech providers also have partnerApiKeyAudit, covering every key the provider owns, and that one is callable with a PARTNER_ADMIN key - so a provider can export its own trail automatically. Both are cursor-paginated, and totalCount is returned on the first page only.

Field
transportGRAPHQL or MCP
operationThe GraphQL root field, or the MCP tool name
kindREAD or WRITE
outcomeALLOWED or DENIED
denyReasonSCOPE, BOUND_ORG, SEND_CAP, CIDR, EXPIRED, REVOKED, BAD_SECRET, RATE_LIMITED, ORG_SUSPENDED

denyReason is the only place the real cause of a 401 appears. A caller sees Invalid API key whether the key expired, was revoked or the secret was wrong - on purpose, so probing tells an attacker nothing. When your own integration breaks, read the audit log rather than guessing from the error.

Outbound messages carry apiKeyId, the public key id that sent them, including when the key acted as an operator. It is null for messages from members, from the AI and for anything inbound - which makes it the field to reconcile against when several agents share one inbox.

Realtime Is Webhooks

An API key cannot open a GraphQL subscription. For live updates, register an outbound webhook and receive signed events over HTTP.

Was this page helpful?

On this page