Fetch Active Groups

Fetch List of Active WhatsApp Groups API

This API retrieves a list of WhatsApp groups created under a specific app on Gupshup. It supports pagination using limit, after, and before query parameters.


Endpoint

GET {{API_FRONT_URL}}/app/{APP_ID}/group?limit={limit}&after={after}&before={before}

Headers

KeyDescriptionRequired
apikeyAPI key of the account where the app exists. Must be a valid Gupshup.io API key.✅ Yes
Content-TypeMust be application/json.✅ Yes

Query parameters

ParameterDescriptionRequiredConstraints
limitNumber of groups to return per page❌ NoMin: 1, Max: 1024, Default: 25
afterCursor to paginate forward❌ NoString cursor
beforeCursor to paginate backward❌ NoString cursor

Path parameters

ParameterDescriptionRequiredConstraints
APP_IDID of your WhatsApp app✅ YesMust be a valid Gupshup App ID

Request Body

Content-Type: application/json

{
  "messaging_product": "whatsapp",
  "participants": [
    { "user": "<PHONE_NUMBER> or <WA_ID>" },
    { "user": "<PHONE_NUMBER> or <WA_ID>" }
  ]
}

Body Parameters

KeyDescriptionRequiredConstraints
messaging_productMust be "whatsapp"✅ YesFixed value
participantsArray of objects with a user field (phone number or WhatsApp ID to remove)✅ YesMax 8 participants, not empty

Response

Success (HTTP 200)

{
  "data": [
    {
      "creation_timestamp": TS,
      "id": "GROUP ID",
      "subject": "GROUP SUBJECT"
    }
  ],
  "paging": {
    "cursors": {
      "after": "AFTER",
      "before": "BEFORE"
    },
    "next": "https://graph.facebook.com/v20.0/105406242200849/groups?limit=25&after=..."
  },
  "status": "success"
}

Error

If the request fails, the server will return a corresponding HTTP error status and message. Common causes include:

  1. Invalid APP_ID
  2. Missing or invalid API key
  3. Improper query parameter formatting

Response Parameters

KeyDescription
dataArray of group objects containing id, subject, and creation_timestamp
paging.cursors.afterCursor for fetching the next page
paging.cursors.beforeCursor for fetching the previous page
paging.nextFull URL to retrieve the next page
statusAPI request status (e.g., "success")

Example cURL

curl --location --globoff '{{API_FRONT_URL}}/app/{{APP_ID}}/group?limit=25&after=null&before=null' \
--header 'Content-Type: application/json' \
--header 'apikey: {{API_KEY}}'

Notes

  1. Pagination is cursor-based. Use the after and before cursors from the response to navigate pages.
  2. If no limit is specified, the API defaults to 25 groups per page.
  3. You can fetch up to a maximum of 1024 groups in a single request.