Skip to main content
GET
/
instances
/
{instanceId}
/
token
/
{token}
/
sdk-connector-token
Generate the SDK token
curl --request GET \
  --url https://api.z-api.io/instances/{instanceId}/token/{token}/sdk-connector-token \
  --header 'Client-Token: <api-key>'
{
  "token": "<string>"
}

Concept

This method generates a session token for the Connection SDK. Your backend calls this endpoint with your Client-Token and returns the resulting token to the frontend, which uses it in ZAPIConnector.open({ token }).
This call must be made by your backend. Never expose your Client-Token or the instance credentials (instanceId and token) in the frontend. The generated token is short-lived — generate it on demand, right when the customer is about to connect.
Full implementation guide: Connection SDK.

Attributes

instanceId
string
required
Your instance ID. Available in the Z-API panel under Instances.
token
string
required
Your Z-API instance token.

Response

200

token
string
Session token to use in ZAPIConnector.open({ token }) on the frontend
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

405

In this case, make sure you are sending the method specification correctly, i.e. check whether you sent POST or GET as specified at the beginning of this topic.

415

If you receive a 415 error, make sure to add the “Content-Type” of the object you are sending to the request headers — most often “application/json”.