Skip to main content
POST
/
instances
Criar instância
curl --request POST \
  --url https://api.ezapi.com.br/instances \
  --header 'Client-Token: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "Minha Instância",
  "receivedCallbackUrl": "https://webhook.site/seu-id",
  "deliveryCallbackUrl": "https://webhook.site/seu-id",
  "disconnectedCallbackUrl": "https://webhook.site/seu-id",
  "connectedCallbackUrl": "https://webhook.site/seu-id",
  "antiBanEnabled": false
}
'
import requests

url = "https://api.ezapi.com.br/instances"

payload = {
"name": "Minha Instância",
"receivedCallbackUrl": "https://webhook.site/seu-id",
"deliveryCallbackUrl": "https://webhook.site/seu-id",
"disconnectedCallbackUrl": "https://webhook.site/seu-id",
"connectedCallbackUrl": "https://webhook.site/seu-id",
"antiBanEnabled": False
}
headers = {
"Client-Token": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Client-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Minha Instância',
receivedCallbackUrl: 'https://webhook.site/seu-id',
deliveryCallbackUrl: 'https://webhook.site/seu-id',
disconnectedCallbackUrl: 'https://webhook.site/seu-id',
connectedCallbackUrl: 'https://webhook.site/seu-id',
antiBanEnabled: false
})
};

fetch('https://api.ezapi.com.br/instances', 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.ezapi.com.br/instances",
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([
'name' => 'Minha Instância',
'receivedCallbackUrl' => 'https://webhook.site/seu-id',
'deliveryCallbackUrl' => 'https://webhook.site/seu-id',
'disconnectedCallbackUrl' => 'https://webhook.site/seu-id',
'connectedCallbackUrl' => 'https://webhook.site/seu-id',
'antiBanEnabled' => false
]),
CURLOPT_HTTPHEADER => [
"Client-Token: <api-key>",
"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://api.ezapi.com.br/instances"

payload := strings.NewReader("{\n \"name\": \"Minha Instância\",\n \"receivedCallbackUrl\": \"https://webhook.site/seu-id\",\n \"deliveryCallbackUrl\": \"https://webhook.site/seu-id\",\n \"disconnectedCallbackUrl\": \"https://webhook.site/seu-id\",\n \"connectedCallbackUrl\": \"https://webhook.site/seu-id\",\n \"antiBanEnabled\": false\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Client-Token", "<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.ezapi.com.br/instances")
.header("Client-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Minha Instância\",\n \"receivedCallbackUrl\": \"https://webhook.site/seu-id\",\n \"deliveryCallbackUrl\": \"https://webhook.site/seu-id\",\n \"disconnectedCallbackUrl\": \"https://webhook.site/seu-id\",\n \"connectedCallbackUrl\": \"https://webhook.site/seu-id\",\n \"antiBanEnabled\": false\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.ezapi.com.br/instances")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Client-Token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Minha Instância\",\n \"receivedCallbackUrl\": \"https://webhook.site/seu-id\",\n \"deliveryCallbackUrl\": \"https://webhook.site/seu-id\",\n \"disconnectedCallbackUrl\": \"https://webhook.site/seu-id\",\n \"connectedCallbackUrl\": \"https://webhook.site/seu-id\",\n \"antiBanEnabled\": false\n}"

response = http.request(request)
puts response.read_body
{
  "instanceId": "abc1234567890",
  "instanceToken": "tok_a1b2c3d4e5f6...",
  "status": "pending"
}
{
"error": "Bad Request",
"message": "name is required"
}
{
"error": "Unauthorized",
"message": "Missing or invalid Client-Token"
}
{
"error": "Internal Server Error",
"message": "Failed to persist instance in panel database"
}
Cria uma nova instância da EZ API e retorna os identificadores necessários para as próximas chamadas.

Authorizations

Client-Token
string
header
required

Body

application/json
name
string

Nome de exibição da instância.

Example:

"Minha Instância"

deliveryCallbackUrl
string<uri>

Webhook chamado no evento de entrega.

Example:

"https://example.com/webhooks/delivery"

receivedCallbackUrl
string<uri>

Webhook chamado no evento de recebimento.

Example:

"https://example.com/webhooks/received"

disconnectedCallbackUrl
string<uri>

Webhook chamado no evento de desconexão.

Example:

"https://example.com/webhooks/disconnected"

connectedCallbackUrl
string<uri>

Webhook chamado no evento de conexão.

Example:

"https://example.com/webhooks/connected"

messageStatusCallbackUrl
string<uri>

Webhook chamado quando o status da mensagem muda.

Example:

"https://example.com/webhooks/status"

antiBanEnabled
boolean

Ativa ou desativa o AntiBan já na criação.

Example:

false

Response

Resposta de sucesso.

instanceId
string
required
Example:

"abc1234567890"

instanceToken
string
required
Example:

"tok_a1b2c3d4e5f6..."

status
string
required
Example:

"pending"