Create Instance
curl --request POST \
--url https://api.l2msg.com/whatsapp/instance/create \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"instanceName": "<string>",
"qrcode": true,
"number": "<string>",
"rejectCall": true,
"msgCall": "<string>",
"groupsIgnore": true,
"alwaysOnline": true,
"readMessages": true,
"readStatus": true,
"syncFullHistory": true,
"webhook": {
"url": "<string>",
"byEvents": true,
"base64": true,
"headers": {
"autorization": "<string>",
"Content-Type": "<string>"
},
"events": []
}
}
'import requests
url = "https://api.l2msg.com/whatsapp/instance/create"
payload = {
"instanceName": "<string>",
"qrcode": True,
"number": "<string>",
"rejectCall": True,
"msgCall": "<string>",
"groupsIgnore": True,
"alwaysOnline": True,
"readMessages": True,
"readStatus": True,
"syncFullHistory": True,
"webhook": {
"url": "<string>",
"byEvents": True,
"base64": True,
"headers": {
"autorization": "<string>",
"Content-Type": "<string>"
},
"events": []
}
}
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
instanceName: '<string>',
qrcode: true,
number: '<string>',
rejectCall: true,
msgCall: '<string>',
groupsIgnore: true,
alwaysOnline: true,
readMessages: true,
readStatus: true,
syncFullHistory: true,
webhook: {
url: '<string>',
byEvents: true,
base64: true,
headers: {autorization: '<string>', 'Content-Type': '<string>'},
events: []
}
})
};
fetch('https://api.l2msg.com/whatsapp/instance/create', 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://api.l2msg.com/whatsapp/instance/create",
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([
'instanceName' => '<string>',
'qrcode' => true,
'number' => '<string>',
'rejectCall' => true,
'msgCall' => '<string>',
'groupsIgnore' => true,
'alwaysOnline' => true,
'readMessages' => true,
'readStatus' => true,
'syncFullHistory' => true,
'webhook' => [
'url' => '<string>',
'byEvents' => true,
'base64' => true,
'headers' => [
'autorization' => '<string>',
'Content-Type' => '<string>'
],
'events' => [
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <api-key>"
],
]);
$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://api.l2msg.com/whatsapp/instance/create"
payload := strings.NewReader("{\n \"instanceName\": \"<string>\",\n \"qrcode\": true,\n \"number\": \"<string>\",\n \"rejectCall\": true,\n \"msgCall\": \"<string>\",\n \"groupsIgnore\": true,\n \"alwaysOnline\": true,\n \"readMessages\": true,\n \"readStatus\": true,\n \"syncFullHistory\": true,\n \"webhook\": {\n \"url\": \"<string>\",\n \"byEvents\": true,\n \"base64\": true,\n \"headers\": {\n \"autorization\": \"<string>\",\n \"Content-Type\": \"<string>\"\n },\n \"events\": []\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apikey", "<api-key>")
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://api.l2msg.com/whatsapp/instance/create")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"instanceName\": \"<string>\",\n \"qrcode\": true,\n \"number\": \"<string>\",\n \"rejectCall\": true,\n \"msgCall\": \"<string>\",\n \"groupsIgnore\": true,\n \"alwaysOnline\": true,\n \"readMessages\": true,\n \"readStatus\": true,\n \"syncFullHistory\": true,\n \"webhook\": {\n \"url\": \"<string>\",\n \"byEvents\": true,\n \"base64\": true,\n \"headers\": {\n \"autorization\": \"<string>\",\n \"Content-Type\": \"<string>\"\n },\n \"events\": []\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.l2msg.com/whatsapp/instance/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"instanceName\": \"<string>\",\n \"qrcode\": true,\n \"number\": \"<string>\",\n \"rejectCall\": true,\n \"msgCall\": \"<string>\",\n \"groupsIgnore\": true,\n \"alwaysOnline\": true,\n \"readMessages\": true,\n \"readStatus\": true,\n \"syncFullHistory\": true,\n \"webhook\": {\n \"url\": \"<string>\",\n \"byEvents\": true,\n \"base64\": true,\n \"headers\": {\n \"autorization\": \"<string>\",\n \"Content-Type\": \"<string>\"\n },\n \"events\": []\n }\n}"
response = http.request(request)
puts response.read_body{
"instance": {
"instanceName": "teste-docs",
"instanceId": "af6c5b7c-ee27-4f94-9ea8-192393746ddd",
"webhook_wa_business": null,
"access_token_wa_business": "",
"status": "created"
},
"hash": {
"apikey": "123456"
},
"settings": {
"reject_call": false,
"msg_call": "",
"groups_ignore": true,
"always_online": false,
"read_messages": false,
"read_status": false,
"sync_full_history": false
}
}{
"status": 403,
"error": "Forbidden",
"response": {
"message": [
"This name \"instance-example-name\" is already in use."
]
}
}Instances
Create Instance
POST
/
instance
/
create
Create Instance
curl --request POST \
--url https://api.l2msg.com/whatsapp/instance/create \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"instanceName": "<string>",
"qrcode": true,
"number": "<string>",
"rejectCall": true,
"msgCall": "<string>",
"groupsIgnore": true,
"alwaysOnline": true,
"readMessages": true,
"readStatus": true,
"syncFullHistory": true,
"webhook": {
"url": "<string>",
"byEvents": true,
"base64": true,
"headers": {
"autorization": "<string>",
"Content-Type": "<string>"
},
"events": []
}
}
'import requests
url = "https://api.l2msg.com/whatsapp/instance/create"
payload = {
"instanceName": "<string>",
"qrcode": True,
"number": "<string>",
"rejectCall": True,
"msgCall": "<string>",
"groupsIgnore": True,
"alwaysOnline": True,
"readMessages": True,
"readStatus": True,
"syncFullHistory": True,
"webhook": {
"url": "<string>",
"byEvents": True,
"base64": True,
"headers": {
"autorization": "<string>",
"Content-Type": "<string>"
},
"events": []
}
}
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
instanceName: '<string>',
qrcode: true,
number: '<string>',
rejectCall: true,
msgCall: '<string>',
groupsIgnore: true,
alwaysOnline: true,
readMessages: true,
readStatus: true,
syncFullHistory: true,
webhook: {
url: '<string>',
byEvents: true,
base64: true,
headers: {autorization: '<string>', 'Content-Type': '<string>'},
events: []
}
})
};
fetch('https://api.l2msg.com/whatsapp/instance/create', 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://api.l2msg.com/whatsapp/instance/create",
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([
'instanceName' => '<string>',
'qrcode' => true,
'number' => '<string>',
'rejectCall' => true,
'msgCall' => '<string>',
'groupsIgnore' => true,
'alwaysOnline' => true,
'readMessages' => true,
'readStatus' => true,
'syncFullHistory' => true,
'webhook' => [
'url' => '<string>',
'byEvents' => true,
'base64' => true,
'headers' => [
'autorization' => '<string>',
'Content-Type' => '<string>'
],
'events' => [
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <api-key>"
],
]);
$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://api.l2msg.com/whatsapp/instance/create"
payload := strings.NewReader("{\n \"instanceName\": \"<string>\",\n \"qrcode\": true,\n \"number\": \"<string>\",\n \"rejectCall\": true,\n \"msgCall\": \"<string>\",\n \"groupsIgnore\": true,\n \"alwaysOnline\": true,\n \"readMessages\": true,\n \"readStatus\": true,\n \"syncFullHistory\": true,\n \"webhook\": {\n \"url\": \"<string>\",\n \"byEvents\": true,\n \"base64\": true,\n \"headers\": {\n \"autorization\": \"<string>\",\n \"Content-Type\": \"<string>\"\n },\n \"events\": []\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apikey", "<api-key>")
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://api.l2msg.com/whatsapp/instance/create")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"instanceName\": \"<string>\",\n \"qrcode\": true,\n \"number\": \"<string>\",\n \"rejectCall\": true,\n \"msgCall\": \"<string>\",\n \"groupsIgnore\": true,\n \"alwaysOnline\": true,\n \"readMessages\": true,\n \"readStatus\": true,\n \"syncFullHistory\": true,\n \"webhook\": {\n \"url\": \"<string>\",\n \"byEvents\": true,\n \"base64\": true,\n \"headers\": {\n \"autorization\": \"<string>\",\n \"Content-Type\": \"<string>\"\n },\n \"events\": []\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.l2msg.com/whatsapp/instance/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"instanceName\": \"<string>\",\n \"qrcode\": true,\n \"number\": \"<string>\",\n \"rejectCall\": true,\n \"msgCall\": \"<string>\",\n \"groupsIgnore\": true,\n \"alwaysOnline\": true,\n \"readMessages\": true,\n \"readStatus\": true,\n \"syncFullHistory\": true,\n \"webhook\": {\n \"url\": \"<string>\",\n \"byEvents\": true,\n \"base64\": true,\n \"headers\": {\n \"autorization\": \"<string>\",\n \"Content-Type\": \"<string>\"\n },\n \"events\": []\n }\n}"
response = http.request(request)
puts response.read_body{
"instance": {
"instanceName": "teste-docs",
"instanceId": "af6c5b7c-ee27-4f94-9ea8-192393746ddd",
"webhook_wa_business": null,
"access_token_wa_business": "",
"status": "created"
},
"hash": {
"apikey": "123456"
},
"settings": {
"reject_call": false,
"msg_call": "",
"groups_ignore": true,
"always_online": false,
"read_messages": false,
"read_status": false,
"sync_full_history": false
}
}{
"status": 403,
"error": "Forbidden",
"response": {
"message": [
"This name \"instance-example-name\" is already in use."
]
}
}Authorizations
Your authorization key header
Body
application/json
instance (Instance name)
Create QR Code automatically after creation
559999999999 (Instance owner number with Country Code)
Reject WhatsApp calls automatically
Message to be sent when a call is rejected automatically
Ignore group messages
Keep WhatsApp always online
Send read receipts to received messages
Show sent messages read status
Syncronize full WhatsApp history
Webhook
Show child attributes
Show child attributes
⌘I