POST
/messages
Use a Sending API key in the Authorization header.
Endpoint
POST https://api.sendzovo.com/v1/messages
Example request
curl -X POST "https://api.sendzovo.com/v1/messages" \
-H "Authorization: Bearer YOUR_SENDING_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": "notifications@example.com",
"from_name": "Example App",
"to": [
{
"email": "customer@example.net",
"name": "Customer"
}
],
"subject": "Your notification",
"html": "<p>Hello from Sendzovo.</p>",
"text": "Hello from Sendzovo.",
"tag": "transactional"
}'
<?php
require 'vendor/autoload.php';
use Sendzovo\Client;
$sendzovo = Client::withSendingKey(
$_ENV['SENDZOVO_SENDING_API_KEY']
);
$result = $sendzovo->messages()->send([
'from' => 'notifications@example.com',
'from_name' => 'Example App',
'to' => [
[
'email' => 'customer@example.net',
'name' => 'Customer',
],
],
'subject' => 'Your notification',
'html' => '<p>Hello from Sendzovo.</p>',
'text' => 'Hello from Sendzovo.',
'tag' => 'transactional',
]);
echo $result['id'];
const response = await fetch(
"https://api.sendzovo.com/v1/messages",
{
method: "POST",
headers: {
"Authorization": "Bearer YOUR_SENDING_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
from: "notifications@example.com",
from_name: "Example App",
to: [
{
email: "customer@example.net",
name: "Customer"
}
],
subject: "Your notification",
html: "<p>Hello from Sendzovo.</p>",
text: "Hello from Sendzovo.",
tag: "transactional"
})
}
);
const data = await response.json();
console.log(data);
import requests
response = requests.post(
"https://api.sendzovo.com/v1/messages",
headers={
"Authorization": "Bearer YOUR_SENDING_API_KEY",
"Content-Type": "application/json",
},
json={
"from": "notifications@example.com",
"from_name": "Example App",
"to": [
{
"email": "customer@example.net",
"name": "Customer",
}
],
"subject": "Your notification",
"html": "<p>Hello from Sendzovo.</p>",
"text": "Hello from Sendzovo.",
"tag": "transactional",
},
)
print(response.json())
using System.Net.Http.Headers;
using System.Net.Http.Json;
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue(
"Bearer",
"YOUR_SENDING_API_KEY"
);
var payload = new
{
from = "notifications@example.com",
from_name = "Example App",
to = new[]
{
new
{
email = "customer@example.net",
name = "Customer"
}
},
subject = "Your notification",
html = "<p>Hello from Sendzovo.</p>",
text = "Hello from Sendzovo.",
tag = "transactional"
};
var response = await client.PostAsJsonAsync(
"https://api.sendzovo.com/v1/messages",
payload
);
var result =
await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
Request requirements
-
The
fromaddress must belong to the sending domain assigned to the API key. - The request accepts 1–50 recipients.
-
For a direct-content message, provide a
subjectand at least one ofhtmlortext. -
Alternatively, provide
template. The template supplies the rendered subject and message content. -
If
message_streamis omitted, Sendzovo uses the domain's default Transactional stream. -
Messages using a Broadcast stream must include a
valid
unsubscribe_url.
Request fields
| Field | Required | Description |
|---|---|---|
from |
Yes | Sender email address. Must belong to the API key's sending domain. |
from_name |
No | Sender display name, up to 120 characters. |
to |
Yes | Array containing 1–50 recipients. |
to[].email |
Yes | Recipient email address. |
to[].name |
No | Recipient display name. |
subject |
Conditional |
Message subject. Required when
template is not supplied.
|
html |
Conditional |
HTML body. When no template is used,
provide html or
text.
|
text |
Conditional |
Plain-text body. When no template is
used, provide text or
html.
|
tag |
No | Optional message tag, up to 100 characters. |
message_stream |
No | Message Stream slug for this sending domain. If omitted, the default Transactional stream is used. |
template |
No | Active template ID or alias. When supplied, the template provides the rendered subject and message content. |
template_model |
No | Object containing dynamic values used while rendering the selected template. |
unsubscribe_url |
Conditional | Valid URL used for unsubscribing. Required when the selected Message Stream is Broadcast. |
Queued response
HTTP 202
{
"id": "MESSAGE_ID",
"status": "queued",
"domain": "example.com"
}
A successful send request returns a message ID that can be used to retrieve the message later.
Ready to send?
Start building
Create a free Sendzovo account, verify your domain and send your first email in minutes.