Wasend

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

NameTypeRequiredDescription
AuthorizationstringYesBearer token for authentication

Path Parameters

ParameterTypeRequiredDescription
sessionIdstringYesThe session ID

Query Parameters

ParameterTypeRequiredDescription
sortBystringNoField to sort by (e.g., name, createdAt, participantsCount)
sortOrderstringNoSort order (asc or desc)
limitnumberNoMaximum number of results (default: 50)
offsetnumberNoNumber of results to skip (default: 0)
excludestring[]NoFields to exclude from response (e.g., participants, description)
statusstringNoFilter by status (active, archived, deleted)
searchstringNoSearch by group name or description
tagsstring[]NoFilter 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

FieldTypeDescription
groupsarrayList of Group objects
pagination.totalnumberTotal number of groups matching the query
pagination.limitnumberNumber of results per page
pagination.offsetnumberCurrent offset
pagination.hasMorebooleanWhether there are more results to fetch

Group Object Fields

FieldTypeDescription
jidstringUnique identifier for the group
namestringGroup name
ownerJidstringOwner's ID
ownerPnstringOwner's phone number
participantsarrayList of participant objects
descriptionstringGroup description
isAnnouncebooleanWhether the group is an announcement group
isLockedbooleanWhether the group is locked
createdAtstringWhen the group was created
settingsobjectGroup settings (infoAdminOnly, messagesAdminOnly)

Error Codes

CodeDescription
400Bad Request - Invalid parameters
401Unauthorized - Invalid API key
404Not Found - Session not found
429Too Many Requests - Rate limit exceeded
500Internal 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 if sortBy 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 and description.
  • Tags are matched exactly.
  • The status filter can be combined with other filters.
  • All timestamps are in ISO 8601 format.