Skip to main content
POST
/
instances
/
{instanceId}
/
token
/
{token}
/
create-group
Creating groups
curl --request POST \
  --url https://api.z-api.io/instances/{instanceId}/token/{token}/create-group \
  --header 'Client-Token: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "autoInvite": true,
  "groupName": "<string>",
  "phones": [
    {}
  ]
}
'
{
  "phone": "<string>",
  "invitationLink": "<string>"
}

Overview

This method is responsible for creating a group with its respective participants.
It’s not possible to add an image during creation, but you can add it afterwards using the update group image method.
You should not include the connected number in the participants list. At least one contact is required to create the group, just like on WhatsApp Web.

Attributes

instanceId
string
required
Your instance ID. Available in the Z-API panel under Instances.
token
string
required
Your Z-API instance token.

Required

autoInvite
boolean
required
Whether to send a private invite to participants who can’t be added directly
groupName
string
required
Group name
phones
array
required
List of participants’ phone numbers

Request Body

{
  "autoInvite": true,
  "groupName": "Z-API Group",
  "phones": ["5544999999999", "5544888888888"]
}

Response

200

phone
string
Created group ID/Phone
Group invitation link
{
  "phone": "120363019502650977-group",
  "invitationLink": "https://chat.whatsapp.com/GONwbGGDkLe8BifUWwLgct"
}

405

Make sure you are correctly sending the method specification, that is, verify that you sent POST or GET as specified at the beginning of this topic.

415

If you receive a 415 error, make sure to add the “Content-Type” header to your request, which in most cases is “application/json”.