Manage WhatsApp groups
Create groups, read their metadata and participant lists, add or remove members, change admins, edit the subject and description, share invite links, and leave — all through one session's REST API.
- A session that is started and connected. See Sessions and Connect your first session.
- An API key with the operator role for any write (create, modify, leave, revoke) and for the invite-code read. Every other read route accepts any valid key, except one restricted with
allowedChats(v0.23.6+), which reaches only the few routes listed under How group routes work. See Authentication. - A group id in WhatsApp's
@g.usformat, for example120363021234567890@g.us.
Examples use the local base URL http://localhost:2785/api, a session id of 8f3c2b1a-9d4e-4c7a-8b2f-1e6d5a4c3b2a, and the header X-API-Key: YOUR_API_KEY. Replace YOUR_API_KEY with a key from your dashboard. In production, swap the base URL for your domain over TLS.
How group routes work
Every group route is nested under a session, so the session id is always in the path. There are 23 in all — listing and reading, joining, participant management, membership requests, subject, description and member label, the group picture, group settings, invite links, and leaving:
GET /api/sessions/{sessionId}/groups
POST /api/sessions/{sessionId}/groups
GET /api/sessions/{sessionId}/groups/{groupId}
POST /api/sessions/{sessionId}/groups/{groupId}/participants
DELETE /api/sessions/{sessionId}/groups/{groupId}/participants
POST /api/sessions/{sessionId}/groups/{groupId}/participants/promote
POST /api/sessions/{sessionId}/groups/{groupId}/participants/demote
PUT /api/sessions/{sessionId}/groups/{groupId}/subject
PUT /api/sessions/{sessionId}/groups/{groupId}/description
PUT /api/sessions/{sessionId}/groups/{groupId}/member-label
GET /api/sessions/{sessionId}/groups/{groupId}/invite-code
POST /api/sessions/{sessionId}/groups/{groupId}/invite-code/revoke
POST /api/sessions/{sessionId}/groups/{groupId}/leave
GET /api/sessions/{sessionId}/groups/{groupId}/membership-requests
POST /api/sessions/{sessionId}/groups/{groupId}/membership-requests/approve
POST /api/sessions/{sessionId}/groups/{groupId}/membership-requests/reject
POST /api/sessions/{sessionId}/groups/join
GET /api/sessions/{sessionId}/groups/join-info
GET /api/sessions/{sessionId}/groups/{groupId}/picture
PUT /api/sessions/{sessionId}/groups/{groupId}/picture
DELETE /api/sessions/{sessionId}/groups/{groupId}/picture
GET /api/sessions/{sessionId}/groups/{groupId}/settings
PUT /api/sessions/{sessionId}/groups/{groupId}/settings
The seven at the end of that list — joining by invite code, previewing an invite before joining, the group picture, and the group settings — are covered per-field in the API reference rather than on this page.
Three rules apply to all of them:
- Identifiers. A group is addressed by its
@g.usjid; an individual member by their@c.usjid (the phone number in international format without+, for example628123456789@c.us). Since v0.28.0 every route that takes{groupId}refuses an id that does not name a group (such as a contact, privacy id, channel, or two-@id) with400before looking up the engine. - Roles.
GETroutes need a plain API key, exceptGET .../invite-code, which since v0.23.5 requires an operator-role key: an invite code is a bearer join capability, not read data, and it keeps working outside OpenWA and after the key that fetched it is revoked. Every non-GETroute — create, join, participant changes, subject, description, member label, the group picture, group settings, membership-request approve and reject, leave, and revoke — requires an operator-role key and returns403otherwise. - Chat-scoped keys. A key restricted with
allowedChats(v0.23.6+) can change the subject and description of an allowed group, read, change or remove its picture, and leave it (all v0.23.6+). Since v0.24.0 group lists filter allowed groups before pagination. Since v0.25.0 the key can also read group detail and settings and change settings, and since v0.27.0 it can set or clear the session's member label (PUT .../member-label) in an allowed group. Create, join, previewing an invite by code, participant changes, membership requests and invite-code routes still answer403. See Scope a key to chats.
The session must be started. Any group route on a session that is not started returns 400.
List groups
GET /api/sessions/{sessionId}/groups returns the groups the session belongs to as a raw array (no envelope). Page with the limit (1–1000, default 1000) and offset (default 0) query parameters.
curl "http://localhost:2785/api/sessions/8f3c2b1a-9d4e-4c7a-8b2f-1e6d5a4c3b2a/groups?limit=50&offset=0" \
-H "X-API-Key: YOUR_API_KEY"
[
{
"id": "120363021234567890@g.us",
"name": "Project Team",
"linkedParentJID": null
}
]
Those three fields are the whole projection: the list is deliberately cheap, so it carries no participant data and no admin flag. linkedParentJID is set when the group is linked to a community, otherwise null. On whatsapp-web.js, when WhatsApp Web fails an invariant while refreshing a group's metadata during this list call, the gateway lists that group from the metadata already held in the browser instead of failing the whole list with 500 (v0.27.0+).
To learn whether this session's account is a group admin, read the group with GET /groups/{groupId} and find your own id in participants, where each entry carries isAdmin and isSuperAdmin. Do that before a write that needs group-admin rights on WhatsApp's side.
Read group metadata
GET /api/sessions/{sessionId}/groups/{groupId} returns full details, including the participant list. It returns 404 if the group is not found in this session.
curl "http://localhost:2785/api/sessions/8f3c2b1a-9d4e-4c7a-8b2f-1e6d5a4c3b2a/groups/120363021234567890@g.us" \
-H "X-API-Key: YOUR_API_KEY"
{
"id": "120363021234567890@g.us",
"name": "Project Team",
"description": "Internal coordination group.",
"owner": "628123456789@c.us",
"createdAt": 1718900000,
"isReadOnly": false,
"isAnnounce": false,
"linkedParentJID": null,
"participants": [
{
"id": "628123456789@c.us",
"number": "628123456789",
"name": "Alice",
"isAdmin": true,
"isSuperAdmin": true
}
]
}
Each participant carries isAdmin (group admin) and isSuperAdmin (the group owner). For a <phone>@c.us participant number is the phone's digits; for a <lid>@lid participant number is the LID's digits (not a phone number) on both engines. On whatsapp-web.js, owner on GET /groups/{groupId} and GET /groups/join-info, and actor/participant ids on group events, can be <lid>@lid on a LID-addressed group even when participants lists the phone form; Baileys reports the phone form whenever known. isAnnounce is true when only admins can post: the group setting. isReadOnly answers for the calling account (since v0.22.0): true means this account cannot post. An admin of an announce-only group therefore reads false there, and the two fields no longer always agree.
Create a group
POST /api/sessions/{sessionId}/groups creates a group from a name and a non-empty list of participant jids. The session's own account becomes the owner. Both fields are required; an empty participants array fails validation with 400, as does one over 256 entries. The name is capped at 100 characters.
curl -X POST "http://localhost:2785/api/sessions/8f3c2b1a-9d4e-4c7a-8b2f-1e6d5a4c3b2a/groups" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Project Team",
"participants": ["628123456789@c.us", "628987654321@c.us"]
}'
The response is the created group (status 201). Use the returned id as the groupId in every later call.
{
"id": "120363021234567890@g.us",
"name": "Project Team",
"participantsCount": 3,
"isAdmin": true,
"linkedParentJID": null
}
With send pacing enabled, every participant the account has no history with draws on the day's cold-reachout allowance. Since v0.24.0 a create that names more of them than the whole day's allowance answers 400, with a message giving the size to split the request into, because no retry can fit it. One that fits a day but not today's remainder answers 429 with code: "SEND_PACING_LIMITED" and retryAfterSeconds.
501Since v0.16.0 this route refuses outright on the whatsapp-web.js engine, which is the default (ENGINE_TYPE unset). The library still declares createGroup, but its page code reaches a WhatsApp Web internal that no longer exists, so every call already failed — as an opaque 500 rather than a stated refusal. Bare and @c.us-qualified participant ids fail identically.
Run the gateway with ENGINE_TYPE=baileys to create groups. The setting applies to every session on the instance. Baileys keeps its own auth directory, so a session must be linked again unless it still holds a Baileys link from an earlier run. The route, its body, and its Baileys behaviour are unchanged. Every other route on this page works on both engines, with two exceptions: PUT .../member-label (v0.27.0+) and PUT .../settings when the patch carries ephemeralSeconds both answer 501 on whatsapp-web.js. On PUT .../settings, ephemeralSeconds is applied first for this reason, so the refusal arrives before any other setting in the same patch has been written.
Manage participants
The four participant routes all take the same body — a non-empty participants array of @c.us jids, at most 256 per call (more returns 400).
{ "participants": ["628123456789@c.us"] }
An entry can also be a bare phone number, the same number as <phone>@s.whatsapp.net, or a <lid>@lid id, with at least five digits before any @. Anything that does not name an individual, a group id included, is a 400. Since v0.23.6 each entry is reduced to its neutral form (<phone>@c.us or <lid>@lid, lower-cased, without a :device suffix) before it reaches the engine, so on whatsapp-web.js a mixed-case or device-suffixed id of a real member is no longer reported as not a member. A remove, promote or demote on whatsapp-web.js now reports each results[].id in that neutral form rather than as sent (earlier releases returned any entry that was not a bare number unchanged), so match results to your request by the normalized id. Baileys already reported neutral ids, taken from the engine's reply.
The response carries the acknowledgement message plus a results array with one entry per requested participant:
| Action | Method + path | Acknowledgement message |
|---|---|---|
| Add | POST .../participants | Participants added |
| Remove | DELETE .../participants | Participants removed |
| Promote to admin | POST .../participants/promote | Participants promoted to admin |
| Demote from admin | POST .../participants/demote | Participants demoted from admin |
Each results entry reports success, the engine-reported status code, and a message when the engine gave one. A partial refusal does not fail the request — the response stays 200 and the refused entries say why. On whatsapp-web.js an entry can fail with, for example, 403 (invite-only, or the account is not a group admin), 404 (not registered on WhatsApp), or 409 (already a member). Only a total refusal — every participant refused, or the operation itself rejected — returns 403.
{
"success": true,
"message": "Participants added",
"results": [
{ "id": "628123456789@c.us", "success": true, "status": 200 },
{ "id": "628999888777@c.us", "success": false, "status": 404 }
]
}
Two whatsapp-web.js specifics:
- On an add, a
403entry can still be a success onwhatsapp-web.js. When a recipient's privacy setting refuses a direct add,whatsapp-web.jsdelivers a private group invite instead when allowed; the entry reportssuccess: true,status: 403, and an invite-sentmessage— so an all-invite batch resolves (200) rather than reading as a total refusal. On Baileys, no private invite is sent and the entry reportssuccess: false,status: 403, so an all-invite batch answers403. Since v0.31.0, on a WhatsApp Web build where the library's invite sender has moved,whatsapp-web.jssends no invitation either: that participant's entry is a403withsuccess: falseand the other participants keep their outcome (the whole add answered500before). - On remove, promote, and demote, whatsapp-web.js confirms only the batch as a whole. An entry that names a member of the group carries the batch status with a
messagesaying so (it startsconfirmed with the batchand notes that wwebjs reports no per-participant outcome), not an individually confirmed outcome. An entry that names no member of the group comes back withsuccess: false,status: 404and amessagestartingnot a member of this group, and WhatsApp is not asked to act on it. When no entry names a member, the call answers403.
Add participants
curl -X POST "http://localhost:2785/api/sessions/8f3c2b1a-9d4e-4c7a-8b2f-1e6d5a4c3b2a/groups/120363021234567890@g.us/participants" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "participants": ["628123456789@c.us"] }'
{
"success": true,
"message": "Participants added",
"results": [{ "id": "628123456789@c.us", "success": true, "status": 200 }]
}
An add draws on the same cold-reachout allowance as a create, with the same answers: 400 for more new contacts than a whole day's allowance (since v0.24.0), 429 when only today's remainder is short. See Create a group.
Remove participants
Removal is a DELETE that carries a JSON body — set the Content-Type header so the body is parsed.
curl -X DELETE "http://localhost:2785/api/sessions/8f3c2b1a-9d4e-4c7a-8b2f-1e6d5a4c3b2a/groups/120363021234567890@g.us/participants" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "participants": ["628123456789@c.us"] }'
{
"success": true,
"message": "Participants removed",
"results": [{ "id": "628123456789@c.us", "success": true, "status": 200 }]
}
Promote and demote admins
promote grants group-admin rights; demote revokes them. The session's account must itself be a group admin for either to take effect.
curl -X POST "http://localhost:2785/api/sessions/8f3c2b1a-9d4e-4c7a-8b2f-1e6d5a4c3b2a/groups/120363021234567890@g.us/participants/promote" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "participants": ["628123456789@c.us"] }'
{
"success": true,
"message": "Participants promoted to admin",
"results": [{ "id": "628123456789@c.us", "success": true, "status": 200 }]
}
Change the subject and description
The subject is the group name. PUT .../subject requires a non-empty subject (capped at 100 characters).
curl -X PUT "http://localhost:2785/api/sessions/8f3c2b1a-9d4e-4c7a-8b2f-1e6d5a4c3b2a/groups/120363021234567890@g.us/subject" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "subject": "New Team Name" }'
{ "success": true, "message": "Group subject updated" }
PUT .../description requires a description field (capped at 1024 characters). Unlike the subject, an empty string is valid and clears the description.
curl -X PUT "http://localhost:2785/api/sessions/8f3c2b1a-9d4e-4c7a-8b2f-1e6d5a4c3b2a/groups/120363021234567890@g.us/description" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "description": "Internal coordination group." }'
{ "success": true, "message": "Group description updated" }
On the Baileys engine, PUT .../member-label sets or clears the session account's own member tag in the group (v0.27.0+; whatsapp-web.js answers 501). label is capped at 30 UTF-16 code units, and an empty string "" clears the tag:
curl -X PUT "http://localhost:2785/api/sessions/8f3c2b1a-9d4e-4c7a-8b2f-1e6d5a4c3b2a/groups/120363021234567890@g.us/member-label" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "label": "On-call" }'
{ "success": true, "message": "Group member label updated" }
Share and rotate invite links
GET .../invite-code returns the current invite code and the full https://chat.whatsapp.com/<code> link. Unlike the other group reads, it needs an operator-role key since v0.23.5, the same rule the session QR endpoint follows: the code is a transferable join capability, so a viewer key gets 403.
curl "http://localhost:2785/api/sessions/8f3c2b1a-9d4e-4c7a-8b2f-1e6d5a4c3b2a/groups/120363021234567890@g.us/invite-code" \
-H "X-API-Key: YOUR_API_KEY"
{
"inviteCode": "AbCdEf123456",
"inviteLink": "https://chat.whatsapp.com/AbCdEf123456"
}
To invalidate the existing link and mint a fresh one, call POST .../invite-code/revoke with an empty body. The response contains the new code and link — anyone holding the old link can no longer join.
curl -X POST "http://localhost:2785/api/sessions/8f3c2b1a-9d4e-4c7a-8b2f-1e6d5a4c3b2a/groups/120363021234567890@g.us/invite-code/revoke" \
-H "X-API-Key: YOUR_API_KEY"
{
"inviteCode": "XyZ987654321",
"inviteLink": "https://chat.whatsapp.com/XyZ987654321",
"message": "Invite code revoked and new one generated"
}
Leave a group
POST .../leave removes the session's own account from the group. Send an empty body.
curl -X POST "http://localhost:2785/api/sessions/8f3c2b1a-9d4e-4c7a-8b2f-1e6d5a4c3b2a/groups/120363021234567890@g.us/leave" \
-H "X-API-Key: YOUR_API_KEY"
{ "success": true, "message": "Left the group" }
Membership requests (join approval)
When a group has the admin-approval setting enabled, users who tap the invite link do not join immediately — they land in a pending queue. Since v0.15.0 you can list, approve, and reject those requests over the API, and receive a group.join_request webhook event when someone asks to join.
All three routes require the session's WhatsApp account to be a group admin.
List pending requests
curl "http://localhost:2785/api/sessions/8f3c2b1a-9d4e-4c7a-8b2f-1e6d5a4c3b2a/groups/120363021234567890@g.us/membership-requests" \
-H "X-API-Key: YOUR_API_KEY"
[
{
"participantId": "628123456789@c.us",
"addedById": "628987654321@c.us",
"method": "invite_link",
"requestedAt": 1754700000
}
]
An empty array means no one is waiting.
| Field | Type | Meaning |
|---|---|---|
participantId | string | Neutral id of the user asking to join. Always present — this is the value you pass back to approve or reject. |
addedById | string | Who created the request. Differs from the requester on a non-admin add. |
method | string | How the request was made: invite_link, non_admin_add, or linked_group_join. |
requestedAt | number | Unix seconds (not milliseconds, not an ISO string) the request was created. |
Only participantId is guaranteed. Fields the engine does not report are omitted rather than defaulted, so read them defensively.
Approve requests
curl -X POST "http://localhost:2785/api/sessions/8f3c2b1a-9d4e-4c7a-8b2f-1e6d5a4c3b2a/groups/120363021234567890@g.us/membership-requests/approve" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "participants": ["628123456789@c.us"] }'
Reject requests
curl -X POST "http://localhost:2785/api/sessions/8f3c2b1a-9d4e-4c7a-8b2f-1e6d5a4c3b2a/groups/120363021234567890@g.us/membership-requests/reject" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "participants": ["628123456789@c.us"] }'
Both approve and reject take the same participants body as the other participant routes and return a results array with per-participant outcomes. A partial refusal still answers 200 — read results for the per-entry outcome rather than relying on the status code.
participants acts on the whole queueUnlike the other participant routes, these two accept a body that names nobody — and that means every pending request. Approving an empty queue is a harmless no-op returning an empty results, but sending {} against a queue of forty approves all forty.
Go callers need one extra care: a nil slice means "every request", while an empty slice []string{} is a 400. Before v0.16.0 omitempty dropped the empty slice and it silently meant "every request" too.
Since v0.26.0 a body that was sent but not read can no longer pass for an absent one. A JSON list ([]), or a body in a content type other than application/json or application/x-www-form-urlencoded (a fetch with a string body and no headers sends text/plain), answers 400. Before, both acted on every pending request. To act on all of them, send {} or no body.
When someone requests to join a group the session administers, a group.join_request event fires on every active webhook that subscribes to it. See Webhooks — event catalog for the payload shape.
Do it with the SDK
The JavaScript SDK wraps every route above. Note the client baseUrl is the host root (http://localhost:2785), without the /api prefix.
import { OpenWAClient } from '@rmyndharis/openwa';
const client = new OpenWAClient({
baseUrl: 'http://localhost:2785',
apiKey: 'YOUR_API_KEY',
});
const group = await client.groups.create('8f3c2b1a-9d4e-4c7a-8b2f-1e6d5a4c3b2a', {
name: 'Project Team',
participants: ['628123456789@c.us', '628987654321@c.us'],
});
await client.groups.addParticipants('8f3c2b1a-9d4e-4c7a-8b2f-1e6d5a4c3b2a', group.id, ['628111222333@c.us']);
await client.groups.promoteParticipants('8f3c2b1a-9d4e-4c7a-8b2f-1e6d5a4c3b2a', group.id, ['628111222333@c.us']);
await client.groups.setSubject('8f3c2b1a-9d4e-4c7a-8b2f-1e6d5a4c3b2a', group.id, 'Project Team — Q3');
await client.groups.setMemberLabel('8f3c2b1a-9d4e-4c7a-8b2f-1e6d5a4c3b2a', group.id, 'Lead');
const { inviteLink } = await client.groups.inviteCode('8f3c2b1a-9d4e-4c7a-8b2f-1e6d5a4c3b2a', group.id);
console.log(inviteLink);
See SDK usage for client setup and typed error handling.
Troubleshooting
| Status | Cause | Fix |
|---|---|---|
400 | Validation failed (empty name, empty or over-256 participants, empty subject, missing description, or name/subject over 100 / description over 1024 characters), a {groupId} that does not name a group (such as a contact, privacy id, channel, or two-@ id; v0.28.0+), or the session is not started, or a group picture url that is not a URL. Since v0.23.6 also a picture url without an http:// or https:// scheme (v0.23.5 accepted a scheme-less or ftp:// URL), or one whose server answers a non-2xx status other than a redirect, whose download times out, or whose connection fails. When the fetch goes through the session's proxy, a timeout or failed connection before any response answers 503 instead. With send pacing enabled, since v0.24.0, also a create or participant add naming more new contacts than the whole day's cold-reachout allowance. A membership-request approve or reject whose body is a JSON list or is sent in a content type other than JSON or form encoding (v0.26.0+). Since v0.31.0 also a picture url that carries a user name or password (Media URL must not contain credentials (userinfo)), and a picture url whose host cannot be resolved, that points at or resolves to a blocked internal address, or whose server answers with a redirect (3xx; Destination address is not allowed), all of which answered 500 before; and, on whatsapp-web.js, POST .../groups/join for a group that has an admin approve new members: the invite is good and a request to join was sent, but the account has not joined (it answered the 400 of an invalid invite code before). | Send a complete body within the length limits and a @g.us group id; start the session first (see Sessions); pass the picture as a reachable http:// or https:// URL on a public host that serves it without a redirect (a trusted internal host can be named in SSRF_ALLOWED_HOSTS, which does not lift a redirect), or as base64; split a large create or add into batches of at most the allowance named in the message; to approve or reject every pending request, send {} or no body. |
401 | Missing or invalid X-API-Key. | Send a valid key in the X-API-Key header. |
403 | The key's role is below operator on a write route or on GET .../invite-code — or a participant write was refused for every requested participant (a total refusal), for example because the session's account is not a group admin; a subject, description or picture change is also refused when the group restricts its info to admins and the account is not one. On Baileys, also a write to a group the account has left. Since v0.31.0, on whatsapp-web.js, also a PUT .../settings for announce or locked that WhatsApp refuses, or that the page refuses because the account may not change it (a refused write answered 200 before, and a bare 500 when the account may not set them), and an invite code read when WhatsApp gives no code (a bare 500 before). Since v0.23.6, a key restricted with allowedChats outside its open routes or its allowlist. | Use an operator-role key (see Authentication); for a total refusal, read the per-participant detail in the error message and confirm the account's group-admin rights. |
404 | The group jid is not found in this session. Since v0.23.6, on Baileys, a write to a group that no longer exists answers 404 too, where it answered 403 before, and so do the invite-code and membership-request reads. Since v0.26.0, on whatsapp-web.js, a group read or invite preview cut short by a WhatsApp Web page reload answers 409 instead of a false 404. | Confirm the @g.us id, and that this session is a member. |
409 | The session is started but its engine is not connected. Since v0.26.0, on whatsapp-web.js, also a group read or invite preview cut short by a WhatsApp Web page reload, and a request that races a session stop. Since v0.31.0 the page-reload 409 carries code: "ENGINE_PAGE_RELOADING" and retryAfterSeconds, and on whatsapp-web.js the group writes, the invite code read and revoke, the join, the invite preview and the group picture delete answer it too when they reach a page that has not finished loading. | Wait for the session to reach ready, then retry. For ENGINE_PAGE_RELOADING, ask again every retryAfterSeconds: a reload takes seconds on most pages and can take a few minutes, and no event marks its end. |
429 | With send pacing enabled, a create or participant add reaches more new contacts than today's remaining cold-reachout allowance, or the send breaker is open: the body carries code: "SEND_PACING_LIMITED" and retryAfterSeconds. Otherwise the request rate limiter (RATE_LIMIT_*) shed the request, with a plain Retry-After header since v0.23.6. | For a pacing refusal wait retryAfterSeconds; for the rate limiter wait for Retry-After. |
413 | On PUT .../groups/{groupId}/picture, the decoded image exceeds the media byte cap (MEDIA_DOWNLOAD_MAX_BYTES, 50 MiB by default). The route has always answered this; v0.23.4 declared it in the contract. Since v0.23.6 an image fetched from url over the cap answers 413 as well, instead of 500. | Compress the image, or raise the cap. |
501 | POST .../groups, PUT .../member-label (v0.27.0+), or PUT .../settings with ephemeralSeconds on a whatsapp-web.js session. Since v0.31.0, on whatsapp-web.js, also the subject, description and picture writes, the picture delete, the invite code read and revoke, the join, the invite preview and PUT .../settings for announce, locked or memberAddMode, when the WhatsApp Web build the session runs has no job to send them: nothing was asked of WhatsApp (the group is unchanged, or the invite code is not judged), and that depends on the build, not on the engine. | Run the session on baileys for group creation, member labels, and disappearing-message timers. A Baileys session also serves the build-dependent routes. |
503 | WhatsApp did not answer within the request budget. The change may or may not have applied. Since v0.23.6 this also covers a whatsapp-web.js browser command that timed out on a group read, an invite preview or a join, which used to answer a false 404 or 400 (a join may still land), and, since v0.26.0, an invite acceptance that a page reload cut short (the join may have landed), and, on either engine, a picture url fetch that the session's egress proxy failed before any response. Since v0.31.0, on whatsapp-web.js, a group subject, description, picture or settings write, an invite code read or revoke, a join, an invite preview or a group picture delete also answers 503 when WhatsApp itself answers with a rate limit, a timeout or a server error (408, 423, 429 or 5xx), which means nothing was changed (for memberAddMode the change can have been applied in part, and the message names any setting of the request already applied). Also since v0.31.0, on whatsapp-web.js, a group setting write, the invite code read and the membership requests read answer 503 when WhatsApp Web does not answer within the protocol timeout, where they answered 500. The invite revoke call itself is the exception for a protocol timeout or a page that died mid-call (the group lookup in front of it still answers 503): it answers 500, because the revoke may already have rotated the code. | Read the group back before retrying, rather than replaying blindly. After a 503 that quotes a status from WhatsApp, retry after a pause; after a 500 on an invite revoke, read the current invite code first. A picture url that failed at the proxy changed nothing: since v0.23.6 the image is fetched through the session's proxy, so check that proxy, set SESSION_PROXY_URL_FETCH=false to fetch directly when it cannot reach media hosts (see Configuration), or pass the picture as base64. |
An operator-role API key authorizes the request, but participant and invite changes still require the session's WhatsApp account to be a group admin, and so do the subject, description and picture unless the group's info is open to every member (the group is not locked in PUT .../settings), in which case any member may change them. Read the group with GET /groups/{groupId} and check isAdmin on your own entry in participants before attempting them; there is no top-level isAdmin, on either the list or the detail.
Next steps
- Send a message to a group using its
@g.usjid as the recipient. - Receive group events via webhooks — participant changes, new messages, and more.
- Full group endpoint reference — every field, query parameter, and status code.