WhatsApp Gateway
API referenceSessions

Update session settings

PATCH
/api/v1/sessions/{session}

Change settings of a session. Only the fields you send change.

historySyncDays sets how many days of chat history are imported the next time the phone is linked or relinked. It does not re-import history for a device that is already linked.

Requires manage capability. Returns the updated session.

Errors: validation_error (400) for a value outside 0 and the deployment maximum, not_found (404), unauthorized (401), forbidden (403).

Authorization

AuthorizationBearer <token>

Send Authorization: Bearer <token>. The token can be a login JWT from the frontend or an api-key for a script. JWT access comes from the person's organization role. Api-key access comes from the permissions saved on the key.

In: header

Path Parameters

session*string

Session ID within your organization. Unknown or cross-organization sessions return not_found (404).

Example"sess_01HZX8K3M9"

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

historySyncDays?integer

How many days of chat history to import at the next link or relink (0 = off). Does not re-import history for an already linked device. Values above the deployment maximum are rejected.

Formatint64
Range0 <= value
Example90

Response Body

application/json

application/json

curl -X PATCH "https://example.com/api/v1/sessions/sess_01HZX8K3M9" \  -H "Content-Type: application/json" \  -d '{}'
{  "autoRead": false,  "createdAt": 1719662400000,  "createdByUserId": "user_01J9DEF...",  "gatewayId": "gw-sg-1",  "historySyncDays": 30,  "id": "01J9ZX8K2QHV0M3T6R7P4N5W8C",  "isAdminSession": false,  "label": "Support line",  "lastConnectedAt": 1719662400000,  "organizationId": "org_01J9ABC...",  "phoneNumber": "6281234567890",  "presenceTyping": true,  "ratePerHour": 600,  "ratePerMin": 20,  "status": "working",  "updatedAt": 1719662400000,  "waJid": "6281234567890@s.whatsapp.net",  "waLid": "205227043110953@lid"}
{  "error": {    "code": "not_found",    "details": {      "property1": null,      "property2": null    },    "message": "session not found"  }}