Create group
curl --request POST \
--url https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/create-group \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"autoInvite": true,
"groupName": "Grupo Z-API",
"phones": [
"5544999999999",
"5544888888888"
]
}
'import requests
url = "https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/create-group"
payload = {
"autoInvite": True,
"groupName": "Grupo Z-API",
"phones": ["5544999999999", "5544888888888"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
autoInvite: true,
groupName: 'Grupo Z-API',
phones: ['5544999999999', '5544888888888']
})
};
fetch('https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/create-group', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/create-group",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'autoInvite' => true,
'groupName' => 'Grupo Z-API',
'phones' => [
'5544999999999',
'5544888888888'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/create-group"
payload := strings.NewReader("{\n \"autoInvite\": true,\n \"groupName\": \"Grupo Z-API\",\n \"phones\": [\n \"5544999999999\",\n \"5544888888888\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/create-group")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"autoInvite\": true,\n \"groupName\": \"Grupo Z-API\",\n \"phones\": [\n \"5544999999999\",\n \"5544888888888\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/create-group")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"autoInvite\": true,\n \"groupName\": \"Grupo Z-API\",\n \"phones\": [\n \"5544999999999\",\n \"5544888888888\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"phone": "120363019502650977-group",
"phonesNotAdded": [
"2111897971174599@lid",
"5544777777777"
],
"invitationLink": "https://chat.whatsapp.com/GONwbGGDkLe8BifUWwLgct"
}{
"error": "invalid path parameter"
}{
"error": "instance subscription is not active"
}{
"error": "internal server error"
}{
"error": "failed to reach the META_WHATSAPP channel"
}{
"error": "<string>"
}Create and edit
Create group
Creates a group with the given participants
POST
/
create-group
Create group
curl --request POST \
--url https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/create-group \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"autoInvite": true,
"groupName": "Grupo Z-API",
"phones": [
"5544999999999",
"5544888888888"
]
}
'import requests
url = "https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/create-group"
payload = {
"autoInvite": True,
"groupName": "Grupo Z-API",
"phones": ["5544999999999", "5544888888888"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
autoInvite: true,
groupName: 'Grupo Z-API',
phones: ['5544999999999', '5544888888888']
})
};
fetch('https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/create-group', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/create-group",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'autoInvite' => true,
'groupName' => 'Grupo Z-API',
'phones' => [
'5544999999999',
'5544888888888'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/create-group"
payload := strings.NewReader("{\n \"autoInvite\": true,\n \"groupName\": \"Grupo Z-API\",\n \"phones\": [\n \"5544999999999\",\n \"5544888888888\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/create-group")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"autoInvite\": true,\n \"groupName\": \"Grupo Z-API\",\n \"phones\": [\n \"5544999999999\",\n \"5544888888888\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/create-group")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"autoInvite\": true,\n \"groupName\": \"Grupo Z-API\",\n \"phones\": [\n \"5544999999999\",\n \"5544888888888\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"phone": "120363019502650977-group",
"phonesNotAdded": [
"2111897971174599@lid",
"5544777777777"
],
"invitationLink": "https://chat.whatsapp.com/GONwbGGDkLe8BifUWwLgct"
}{
"error": "invalid path parameter"
}{
"error": "instance subscription is not active"
}{
"error": "internal server error"
}{
"error": "failed to reach the META_WHATSAPP channel"
}{
"error": "<string>"
}Overview
Method that creates a group with its participants. You cannot send the image when creating the group: add it afterwards with Update group photo. Do not include the connected number in the participants list. As on WhatsApp Web, at least one contact is required to create the group. Use phone numbers only. The@lid identifier is not supported for group creation: if sent, the group is created, but the participant with @lid is not added and the identifier comes back in phonesNotAdded.
On WhatsApp Official, nobody is added at creation: the numbers in
phones come back in phonesNotAdded, because Meta does not allow adding participants manually, and entry is only through the invitationLink. The group has at most 8 participants. To require join approval, send requireAdminApproval true.Authorizations
Body
application/json