WhatsApp Gateway
API referenceContacts

List a session's contacts (found users)

Returns the people this session has seen, one page at a time. Served entirely from the gateway's **stored** WhatsApp data, so it works even when the session is currently disconnected — no live WhatsApp connection is required. **Filters** (all optional, combinable): - `source=dm` — keep only people you have a direct chat with. - `source=group` — keep only people seen in a group. - `group={jid}` — keep only members of the given group JID. - `q=` — case-insensitive substring search over each contact's name or number. **Pagination:** results are cursor-paged. Use `limit` (1–200, default 50) to size the page and pass the response's `nextCursor` back as `cursor` to fetch the next page. An empty `nextCursor` means there are no more pages. **Auth:** requires the `read` capability. **Errors:** `404` (`not_found`) if the session does not exist or is not owned by the caller's organization; `400` (`validation_error`) if a query parameter is malformed.

GET
/api/v1/sessions/{session}/contacts

Authorization

AuthorizationBearer <token>

Send Authorization: Bearer <token>. The router accepts two kinds of token and tries each in turn: a frontend-minted login JWT (verified against the frontend JWKS; the person's org + role are read from it), or an api-key for a script/service (carrying a fixed set of gateway permissions). The bearerFormat: JWT label describes the person-login case.

In: header

Path Parameters

session*string

The WhatsApp session id (a session is one attached WhatsApp number) whose contacts are listed.

Query Parameters

source?string

Optional source filter. dm keeps only people you have a direct chat with; group keeps only people seen in a group. Omit to return contacts from both sources.

Value in

  • "dm"
  • "group"
group?string

Optional group filter. Pass a group JID (e.g. "12345-67890@g.us") to keep only members of that one group. Has no effect unless the contacts were seen in that group.

q?string

Optional free-text search over each contact's name or phone number. Case-insensitive substring match.

limit?integer

Maximum number of contacts to return on one page. Clamped server-side to the range 1–200; values outside the range are coerced to the nearest bound. Defaults to 50 when omitted or 0.

Formatint64
cursor?string

Opaque pagination cursor. Pass the "nextCursor" value from the previous response to fetch the next page; omit on the first request. Treat the value as a token — do not parse, construct, or modify it. An empty "nextCursor" in the response means the last page was reached.

Response Body

application/json

application/json

curl -X GET "https://example.com/api/v1/sessions/sess_01HZX/contacts"
{  "data": [    {      "businessName": "Acme Corp",      "lid": "205227043110953@lid",      "name": "Alice",      "phoneNumber": "6281234567890",      "source": "dm"    }  ],  "nextCursor": "string"}
{  "error": {    "code": "not_found",    "details": {      "property1": null,      "property2": null    },    "message": "session not found"  }}