Both clients accept a team key or a project credential:
A key only reaches what its permissions allow. Each task page lists the
permissions its methods need. See API keys for how to
create keys.
The examples in these guides use three clients named
platform, project, and
messaging, created as shown below.
Create a team client
projectId argument.
Work inside one project
Callproject(projectId) to get a client bound to one project:
events, webhooks,
webhookDeliveries, operations, flows, sipTrunks, calls,
quickLinkSettings, sessionConfiguration, usage, and callRetention.
Team resources such as projects, members, billing, customers, and
campaigns stay on the team client.
With a project credential, create the project client directly:
Create a messaging client
{ type: "projectToken", value } for a project credential. Messaging
methods take the Number as their first argument, for example
messaging.messages.send("<number-id>", ...).
Client options
Both clients accept these options:Set the API version
apiVersion is the API contract date, in YYYY-MM-DD format. It is separate
from the package version. Pin it so a new API version cannot change response
shapes under you. Read API versioning for supported dates.
You can override it for one request:
Set request options
Every method takes an optional last argument with per-request options:Read a response
Methods that return one result resolve to{ data, metadata }:
datais the parsed response body. Most bodies wrap the result in their owndatafield, so you readresponse.data.data. The return type tells you which shape each method has.metadataholds the HTTPstatus, therequestId, the resolvedapiVersion, the number ofattempts, and the responseheaders.
requestId when you contact support.
Lists of events, webhooks, deliveries, operations, call records, and call
opt-outs return a page object instead. See
Read every page.
Give a browser a client token
Browser and mobile code must not hold a team key or project credential. Mint a short-lived client token on your server and send it to the browser:clientTokens.retrieveRules and
clientTokens.updateRules. Minting needs all of these permissions:
sessions:manage, messages:write, contacts:read, presence:read,
presence:observe, and mcp. See Client tokens.
Call an endpoint without an SDK method
raw.request sends an authenticated request to any API path. It uses the
client’s credential, API version, timeout, and retry settings:
raw.request to its own project.
Check API status
SystemClient needs no credential. Use it in health checks:
status(), health(), and ping().
Resources on each client
Client (team):
MessagingClient:
The API reference documents every endpoint behind these
methods.