Get All Groups
Retrieve a list of all WhatsApp groups for a session
Get All Groups
Retrieve a list of all WhatsApp groups associated with a session. This endpoint supports pagination, sorting, and filtering.
Endpoint
GET /{sessionId}/groups
Headers
Name | Type | Required | Description |
---|---|---|---|
Authorization | string | Yes | Bearer token for authentication |
Path Parameters
Parameter | Type | Required | Description |
---|---|---|---|
sessionId | string | Yes | The session ID |
Query Parameters
Parameter | Type | Required | Description |
---|---|---|---|
sortBy | string | No | Field to sort by (e.g., name , createdAt , participantsCount ) |
sortOrder | string | No | Sort order (asc or desc ) |
limit | number | No | Maximum number of results (default: 50) |
offset | number | No | Number of results to skip (default: 0) |
exclude | string[] | No | Fields to exclude from response (e.g., participants , description ) |
status | string | No | Filter by status (active , archived , deleted ) |
search | string | No | Search by group name or description |
tags | string[] | No | Filter by tags |
Response
{
"groups": [
{
"jid": "string",
"name": "string",
"ownerJid": "string",
"ownerPn": "string",
"participants": [
{
"jid": "string",
"phoneNumber": "string",
"isAdmin": boolean,
"displayName": "string"
}
],
"description": "string",
"isAnnounce": boolean,
"isLocked": boolean,
"createdAt": "string",
"settings": {
"infoAdminOnly": boolean,
"messagesAdminOnly": boolean
}
}
],
"pagination": {
"total": number,
"limit": number,
"offset": number,
"hasMore": boolean
}
}
Examples
curl -X GET "https://api.wasend.dev/{sessionId}/groups?limit=10&offset=0&sortBy=name&sortOrder=asc" \
-H "Authorization: Bearer YOUR_API_KEY"
Response Fields
Field | Type | Description |
---|---|---|
groups | array | List of Group objects |
pagination.total | number | Total number of groups matching the query |
pagination.limit | number | Number of results per page |
pagination.offset | number | Current offset |
pagination.hasMore | boolean | Whether there are more results to fetch |
Group Object Fields
Field | Type | Description |
---|---|---|
jid | string | Unique identifier for the group |
name | string | Group name |
ownerJid | string | Owner's ID |
ownerPn | string | Owner's phone number |
participants | array | List of participant objects |
description | string | Group description |
isAnnounce | boolean | Whether the group is an announcement group |
isLocked | boolean | Whether the group is locked |
createdAt | string | When the group was created |
settings | object | Group settings (infoAdminOnly , messagesAdminOnly ) |
Error Codes
Code | Description |
---|---|
400 | Bad Request - Invalid parameters |
401 | Unauthorized - Invalid API key |
404 | Not Found - Session not found |
429 | Too Many Requests - Rate limit exceeded |
500 | Internal Server Error |
Notes
- Default limit is 50 groups per request.
- Maximum limit is 100 groups per request.
- Results are sorted by
createdAt
in descending order by default ifsortBy
is not specified. - The
exclude
parameter can be used to reduce response size (e.g.,exclude=participants
). - Search is case-insensitive and applies to group
name
anddescription
. - Tags are matched exactly.
- The
status
filter can be combined with other filters. - All timestamps are in ISO 8601 format.