Authentication & Scopes
Except for the public endpoints (Meta callbacks and health checks), every request must carry Authorization: Bearer <API_KEY>. Treat your API Key like a password: keep it out of front-end code, URLs, logs and ticket screenshots.
What an API Key's authorization scope covers
A customer API Key is bound to one customer entity and can access that entity’s current Business Portfolios, WABAs and phone numbers. One Key can therefore operate across multiple Business Portfolios owned by the same customer. Previously issued single-Portfolio Keys remain valid, but new single-Portfolio Keys are no longer issued.
- Reaching for a resource outside the authorization scope returns
403or404, without revealing whether the resource exists. - For
GET /v1/business-portfolios,GET /v1/wabasandGET /v1/phone-numbers, a customer Key must explicitly pass itscustomerEntityIdquery parameter. Get this ID fromGET /whoami. Other list endpoints that a customer Key must filter are marked in Endpoints a customer Key can call; every filter value must stay inside the current authorization scope. - An API Key's authorization scope is maintained server-side and cannot be widened through request parameters.
- To change the authorization scope, add phone numbers or have a Key reissued, contact BlueMedia support.
Endpoints a customer Key can call
A customer Key can call only the endpoints below. Any other endpoint — for example the GET /v1/messages list, /v1/credit-account/*, credit-line authorization and /v1/api-keys — returns 403 TENANT_FORBIDDEN (customer-level keys cannot call …) before the request is validated, whatever scopes the Key carries. The scope each endpoint requires still applies on top.
| Area | Endpoints | Ownership is checked against |
|---|---|---|
| Identity | GET /whoami | — |
| Customer entity and assets | GET /v1/customer-entities/{id}; GET /v1/business-portfolios, GET /v1/wabas, GET /v1/phone-numbers (each requires customerEntityId); GET /v1/business-portfolios/{id} and /token-scopes; GET /v1/wabas/{id}; GET /v1/phone-numbers/{id} and /registration-status; POST /v1/phone-numbers/{id}/register | The ID in the path, or customerEntityId |
| Self-service onboarding | POST /v1/business-portfolios; GET /v1/onboarding/config; POST /v1/onboarding/embedded-signup, /es-events and /invitations; GET /v1/onboarding/embedded-signup and /invitations; GET /v1/onboarding/embedded-signup/{operationId}; POST /v1/onboarding/embedded-signup/{operationId}/retry; DELETE /v1/onboarding/invitations/{id} | The Key’s customer entity, the submitted portfolioId, or the operation/invitation’s Portfolio; lists are filtered automatically |
| Messages and media | POST /v1/messages, POST /v1/messages/read, GET /v1/messages/{id}, POST /v1/media, GET /v1/media/{id} and /content | phoneNumberId, the message's phone number, or the media's phone number (the uploading number, or the number that received an inbound media message) |
| Templates and Flows | GET /v1/templates (requires wabaId), POST /v1/templates, GET / PATCH / DELETE /v1/templates/{id}, POST /v1/templates/media, POST /v1/templates/sync, GET /v1/templates/analytics, POST /v1/templates/analytics/enable, GET /v1/flows (requires wabaId), GET /v1/flows/{id} (requires wabaId) | wabaId, or the template's WABA |
| Broadcasts | POST /v1/broadcasts, GET /v1/broadcasts (requires phoneNumberId), GET /v1/broadcasts/{id} and /recipients, POST /v1/broadcasts/{id}/pause / resume / cancel | phoneNumberId, or the campaign's sending number |
| Inbox | GET /v1/conversations (requires phoneNumberId), GET /v1/conversations/{id}, POST /v1/conversations/{id}/read | phoneNumberId, or the conversation's business number |
| Webhooks | POST /v1/webhook-endpoints (requires customerId), GET /v1/webhook-endpoints (requires customerId), GET / PATCH / DELETE /v1/webhook-endpoints/{id}, POST /v1/webhook-endpoints/{id}/rotate-secret / enable / verify / test, GET /v1/webhook-endpoints/{id}/deliveries, POST /v1/webhook-endpoints/{id}/deliveries/{deliveryId}/redeliver | customerId (must equal the Key's own customer entity), or the customer entity the endpoint belongs to |
Every resource must belong to a Business Portfolio the customer entity currently owns; otherwise the call returns 403.
A customer Key creates webhook endpoints bound to its own customer entity: pass customerId with the customerEntityId from GET /whoami. One such endpoint receives events for every Business Portfolio the customer entity currently owns, including Portfolios added later, so there is no need for one endpoint per Portfolio. A customer Key cannot create account-level endpoints (no binding) or endpoints bound to a single Portfolio (projectId). Endpoints a customer Key created earlier with projectId keep receiving that Portfolio's events and can still be managed by ID, but GET /v1/webhook-endpoints?customerId= does not list them; to move to the customer-level binding, create an endpoint with customerId and then delete the old one, or the same events are delivered twice.
Scopes (fine-grained permissions)
An API Key may additionally carry fine-grained scopes. The scope each endpoint requires is stated in the "Authentication" note at the top of that endpoint's page; without it you get a 403. You cannot widen your own scopes — contact BlueMedia support for changes.
Every value, and the endpoints that actually check it:
| scope | Endpoints that check it |
|---|---|
messages:send | POST /v1/messages, POST /v1/messages/read, POST /v1/broadcasts and its pause/resume/cancel |
messages:read | GET /v1/conversations, GET /v1/conversations/{id}, POST /v1/conversations/{id}/read, the GET /v1/broadcasts family |
templates:manage | Creating/editing/deleting/syncing templates, template analytics and enabling it, uploading template media headers |
media:write | POST /v1/media |
phone_numbers:manage | POST /v1/phone-numbers/{id}/register |
phone_numbers:read | GET /v1/phone-numbers/{id}/registration-status |
onboarding:read | The GET /v1/onboarding/embedded-signup family, GET /v1/onboarding/invitations, GET /v1/business-portfolios/{id}/token-scopes |
onboarding:write | Creating/retrying onboarding operations, creating and revoking invitations, reporting ES events; creating a Portfolio with a customer Key |
Two things are easy to misread:
- An endpoint that lists no scope under "Authentication" checks no additional scope — a Key can call it when that operation and resource are within its authorization scope. Most read endpoints for assets and messages (
GET /v1/messages/{id},GET /v1/phone-numbers,GET /v1/templates) fall into this category. They are still confined by the API Key's authorization scope; they simply do not demand an extra scope on top. - Some Keys have a scope of
*(unrestricted) or an empty one (broad Keys issued historically). Both pass every scope check.
Per-number restrictions
An API Key may be further restricted to specific phone numbers. If a number that belongs to the current customer entity still returns 403, check whether it has been added to the current Key's authorization scope.
A portal account is not API authentication
The developer console uses a browser session. Always use Authorization: Bearer with an API Key for server-side integrations — do not copy browser session data and use it as a long-lived credential.
Confirming which account a credential belongs to
Calling GET /whoami confirms an API Key and returns the account identifier, service version and customerEntityId for customer Keys (null for other Keys). It does not return the full secret, the phone number allowlist, or any other sensitive authorization detail.
For first-time onboarding, create your own Portfolio with only name, then generate an invitation or submit a Meta authorization result. See Customer Onboarding. Customer Keys cannot prefill metaBmId, change Portfolio ownership, or call the separate Alipay configuration endpoint; an Alipay invitation remains available through mode: alipay.