Skip to main content

Group metadata

Method#

/group-metadata#

GET https://api.z-api.io/instances/YOUR_INSTANCE/token/YOUR_TOKEN/group-metadata

Header#

KeyValue
Client-TokenACCOUNT SECURITY TOKEN

Concept#

This method returns the group metadata with all information about the group and its participants.

Attention

On November 4, 2021 whatsapp changed the format of creating new groups. before: "phone": "5511999999999-1623281429" now: "phone": "120363019502650977-group"


Attributes#

Required#

AttributesTypeDescription
groupIdstringGroups ID/phone

Optionals#

AttributesTypeDescription

Request Params#

URL#

POST https://api.z-api.io/instances/YOUR_INSTANCE/token/YOUR_TOKEN/group-metadata/{phone}


Response#

200#

AttributesTypeDescription
phonestringGroup ID/phone
descriptionstringGroup description
ownerstringGroup creators number
subjectstringGroup’s name
creationtimestampGroup creation date timestamp
invitationLinkurlGroup invitation link
communityIdstringCommunity ID
adminOnlyMessagebooleanOnly admins can send messages
adminOnlySettingsbooleanOnly admins can change settings
requireAdminApprovalbooleanAdmin approval required
isGroupAnnouncementbooleanCommunity announcement group
participantsarray stringwith participant data

Array String (participants)

AtributosTipoDescrição
phonestringParticipants phone
isAdminstringIndicates if the participant is the group’s admin
isSuperAdminstringIndicates whether you are the creator of the group

Example

Old way -
{
"phone": "5511999999999-1623281429",
"owner": "5511999999999",
"subject": "My group on WhatsApp",
"creation": 1588721491000,
"participants": [
{
"phone": "5511888888888",
"isAdmin": false,
"isSuperAdmin": false
},
{
"phone": "5511777777777",
"isAdmin": true,
"isSuperAdmin": false,
"short": "ZAPIs",
"name": "ZAPIs Boys"
}
],
"subjectTime": 1617805323000,
"subjectOwner": "554497050785"
}
------------------------------------
New way -
{
"phone": "120363019502650977-group",
"description": "Z-API group",
"owner": "5511999999999",
"subject": "My group in Z-API",
"creation": 1588721491000,
"invitationLink": "https://chat.whatsapp.com/40Aasd6af1",
"communityId": null,
"adminOnlyMessage": false,
"adminOnlySettings": false,
"requireAdminApproval": false,
"isGroupAnnouncement": false,
"participants": [
{
"phone": "5511888888888",
"isAdmin": false,
"isSuperAdmin": false
},
{
"phone": "5511777777777",
"isAdmin": true,
"isSuperAdmin": false,
"short": "ZAPIs",
"name": "ZAPIs Boys"
}
],
"subjectTime": 1617805323000,
"subjectOwner": "554497050785"
}

405#

In this case certify that you are sending the correct specification of the method. This means, verify if you sent a POST or GET as specified at the beginning of this topic.

415#

In case you receive 415 error, make sure to add the “Content-Type” of the object you are sending in the request headers, mostly “application/json”#

Code#