Send plain text
curl --request POST \
--url https://api.z-api.io/instances/{instanceId}/token/{token}/send-text \
--header 'Client-Token: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"phone": "<string>",
"message": "<string>"
}
'import requests
url = "https://api.z-api.io/instances/{instanceId}/token/{token}/send-text"
payload = {
"phone": "<string>",
"message": "<string>"
}
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({phone: '<string>', message: '<string>'})
};
fetch('https://api.z-api.io/instances/{instanceId}/token/{token}/send-text', 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.z-api.io/instances/{instanceId}/token/{token}/send-text",
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([
'phone' => '<string>',
'message' => '<string>'
]),
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.z-api.io/instances/{instanceId}/token/{token}/send-text"
payload := strings.NewReader("{\n \"phone\": \"<string>\",\n \"message\": \"<string>\"\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.z-api.io/instances/{instanceId}/token/{token}/send-text")
.header("Client-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"phone\": \"<string>\",\n \"message\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.z-api.io/instances/{instanceId}/token/{token}/send-text")
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 \"phone\": \"<string>\",\n \"message\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"zaapId": "<string>",
"messageId": "<string>",
"id": "<string>"
}Messages
Send plain text
Sends a plain text message to a contact or group on the application.
POST
/
instances
/
{instanceId}
/
token
/
{token}
/
send-text
Send plain text
curl --request POST \
--url https://api.z-api.io/instances/{instanceId}/token/{token}/send-text \
--header 'Client-Token: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"phone": "<string>",
"message": "<string>"
}
'import requests
url = "https://api.z-api.io/instances/{instanceId}/token/{token}/send-text"
payload = {
"phone": "<string>",
"message": "<string>"
}
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({phone: '<string>', message: '<string>'})
};
fetch('https://api.z-api.io/instances/{instanceId}/token/{token}/send-text', 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.z-api.io/instances/{instanceId}/token/{token}/send-text",
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([
'phone' => '<string>',
'message' => '<string>'
]),
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.z-api.io/instances/{instanceId}/token/{token}/send-text"
payload := strings.NewReader("{\n \"phone\": \"<string>\",\n \"message\": \"<string>\"\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.z-api.io/instances/{instanceId}/token/{token}/send-text")
.header("Client-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"phone\": \"<string>\",\n \"message\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.z-api.io/instances/{instanceId}/token/{token}/send-text")
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 \"phone\": \"<string>\",\n \"message\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"zaapId": "<string>",
"messageId": "<string>",
"id": "<string>"
}Overview
With this method you can send plain text messages, and enhance them using text formatting and emojis. If you don’t know how to do it yet, follow the links below:- To learn how to format text in the application click here
-
You can also use line breaks in your messages. Depending on your platform and programming language, use one of the following:
Check which one works best for your case. If you find a new way to break lines, please let us know :)- \n
- \r
- \r\n
- %0a
- You can also use emojis in your messages. Need some? Use this link.
About emojisAn emoji is a regular ASCII character — just like any font. You can copy and paste any emoji directly into your text! Feel free to use this one 🤪 if you want.
Example on the application

Attributes
Required
Recipient’s phone number (or group ID) in the format CountryCode AreaCode NUMBER. Ex: 5511999999999. IMPORTANT Send numbers only, no formatting or mask.
Optional
Adds a delay before sending the message. You can set a range of 1–15 seconds. (Ex.: “delayMessage”: 5). Default delay if not set: 1–3 sec.Short intervals and bulk sending increase the risk of the number being blocked or banned. Before sending at volume, read the Best Practices Guide and Blocks and Bans.
Sets how many seconds the “Typing…” status will show before sending. Range: 1–15 sec. (Ex.: “delayTyping”: 5). Default: 0.
Allows editing a previously sent application message. Use the message ID and new content in the JSON. Webhook must be configured before editing.
Request Body
{
"phone": "5511999999999",
"message": "Welcome to *Z-API*"
}
Response
200
{
"zaapId": "3999984263738042930CD6ECDE9VDWSA",
"messageId": "D241XXXX732339502B68",
"id": "D241XXXX732339502B68"
}
405
Make sure you are sending the correct HTTP method — verify that you are using POST or GET as specified at the top of this page.415
If you receive a 415 error, make sure to addContent-Type: application/json to your request headers.