Надіслати Email
Надішліть один email одному або кільком отримувачам. Підтримує шаблони, змінні, вкладення, планування відправки та відстеження.
/emails
Authorization
string
Required
Bearer токен для автентифікації.
Idempotency-Key
string
Унікальний ключ (максимум 256 символів, літери/цифри/дефіс/підкреслення) для запобігання дублювання відправок протягом 24 годин.
from
string
Required
Email відправника у форматі RFC: email@domain.com або Ім'я Відправника <email@domain.com>.
to
string | string[]
Required
Email адреса(и) отримувача(ів). Максимум 50 отримувачів.
subject
string
Тема листа. Обов’язкова, якщо шаблон не містить її.
html
string
HTML-вміст листа. Обов’язковий, якщо шаблон не містить його або не вказано текстовий вміст.
text
string
Текстовий вміст листа.
reply_to
string | string[]
Email адреса(и) для відповіді.
cc
string | string[]
Отримувачі копії. Максимум 50 отримувачів.
bcc
string | string[]
Отримувачі прихованої копії. Максимум 50 отримувачів.
template
string
Псевдонім або ID шаблону (формат tem_xxx).
variables
object
Змінні для підстановки в шаблон за допомогою синтаксису {{змінна}}.
attachments
array
Масив об’єктів вкладень (див. Об’єкт Вкладення нижче).
headers
object
Користувацькі заголовки листа у вигляді пар ключ-значення.
meta
object
Метадані у вигляді пар рядків ключ-значення. Зберігаються та повертаються разом з листом.
scheduled_at
string
Час запланованої відправки. Приймає ISO 8601, Unix timestamp або природну мову на кшталт завтра о 9 ранку.
tracking
boolean | object
Перевизначити налаштування відстеження домену за замовчуванням. Може бути булевим значенням або об’єктом з властивостями loads та clicks.
filename
string
Required
Ім’я файлу з розширенням.
content
string
Вміст, закодований у Base64. Взаємовиключний з url.
url
string
URL для завантаження вкладення. Взаємовиключний з content.
content_type
string
MIME тип. Обов’язковий при використанні content.
content_id
string
Content-ID для вбудованих зображень (cid:).
encoding
string
Кодування вмісту (за замовчуванням: base64).
| Категорія | Розширення |
|---|---|
| Текстові | .txt, .csv, .log, .css, .ics, .xml |
| Зображення | .jpg, .jpe, .jpeg, .gif, .png, .bmp, .psd, .tif, .tiff, .svg, .indd, .ai, .eps |
| Документи | .doc, .docx, .rtf, .odt, .ott, .pdf, .pub, .pages, .mobi, .epub |
| Аудіо | .mp3, .m4a, .m4v, .wma, .ogg, .flac, .wav, .aif, .aifc, .aiff |
| Відео | .mp4, .mov, .avi, .mkv, .mpeg, .mpg, .wmv |
| Таблиці | .xls, .xlsx, .ods, .numbers |
| Презентації | .odp, .ppt, .pptx, .pps, .key |
| Архіви | .zip, .vcf |
.eml |
|
| Криптографічні | .p7c, .p7m, .p7s, .pgp, .asc, .sig |
Заголовки Обмеження Швидкості
Наступні заголовки включаються в кожну відповідь:
| Заголовок | Опис |
|---|---|
| ratelimit-limit | Максимальна кількість запитів на секунду |
| ratelimit-remaining | Залишилося запитів у поточній секунді |
| ratelimit-reset | Секунд до скидання обмеження швидкості |
| ratelimit-daily-limit | Максимальна кількість щоденних запитів |
| ratelimit-daily-remaining | Залишилося щоденних запитів |
| ratelimit-daily-reset | Секунд до скидання щоденного ліміту |
::code-snippet{title=“Надіслати email”}
const response = await fetch('https://api.emailit.com/v2/emails', {
method: 'POST',
headers: {
'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type': 'application/json'
},
body: JSON.stringify({
from: 'Ваша Компанія <hello@yourdomain.com>',
to: ['recipient1@example.com', 'recipient2@example.com'],
subject: 'Привіт, світ!',
html: '<h1>Вітаємо!</h1><p>Дякуємо за реєстрацію.</p>',
tracking: {
loads: true,
clicks: true
}
})
});
const result = await response.json();
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.emailit.com/v2/emails',
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([
'from' => 'Ваша Компанія <hello@yourdomain.com>',
'to' => ['recipient1@example.com', 'recipient2@example.com'],
'subject' => 'Привіт, світ!',
'html' => '<h1>Вітаємо!</h1><p>Дякуємо за реєстрацію.</p>',
'tracking' => [
'loads' => true,
'clicks' => true
]
]),
CURLOPT_HTTPHEADER => [
'Authorization: Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type: application/json'
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "Помилка cURL #:" . $err;
} else {
$result = json_decode($response, true);
print_r($result);
}
import requests
response = requests.post(
'https://api.emailit.com/v2/emails',
headers={
'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type': 'application/json'
},
json={
'from': 'Ваша Компанія <hello@yourdomain.com>',
'to': ['recipient1@example.com', 'recipient2@example.com'],
'subject': 'Привіт, світ!',
'html': '<h1>Вітаємо!</h1><p>Дякуємо за реєстрацію.</p>',
'tracking': {
'loads': True,
'clicks': True
}
}
)
result = response.json()
print(result)
require 'net/http'
require 'json'
uri = URI('https://api.emailit.com/v2/emails')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'Bearer em_test_51RxCWJ...vS00p61e0qRE'
request['Content-Type'] = 'application/json'
request.body = {
from: 'Ваша Компанія <hello@yourdomain.com>',
to: ['recipient1@example.com', 'recipient2@example.com'],
subject: 'Привіт, світ!',
html: '<h1>Вітаємо!</h1><p>Дякуємо за реєстрацію.</p>',
tracking: {
loads: true,
clicks: true
}
}.to_json
response = http.request(request)
result = JSON.parse(response.body)
puts result
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
url := "https://api.emailit.com/v2/emails"
data := map[string]interface{}{
"from": "Ваша Компанія <hello@yourdomain.com>",
"to": []string{"recipient1@example.com", "recipient2@example.com"},
"subject": "Привіт, світ!",
"html": "<h Список листів
Отримайте список листів у вашому робочому просторі з пагінацією та опціональним фільтруванням за типом.
/emailsПараметри запиту
pageintegerНомер сторінки. Мінімум: 1. За замовчуванням: 1.
limitintegerКількість результатів на сторінці. Діапазон: 1–100. За замовчуванням: 10.
typestringФільтр за типом листа: inbound (вхідні) або outbound (вихідні).
const response = await fetch('https://api.emailit.com/v2/emails?page=1&limit=10', {
method: 'GET',
headers: {
'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type': 'application/json'
}
});
const result = await response.json(); <?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.emailit.com/v2/emails?page=1&limit=10',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type: application/json'
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "Помилка cURL #:" . $err;
} else {
$result = json_decode($response, true);
print_r($result);
} import requests
response = requests.get(
'https://api.emailit.com/v2/emails',
params={'page': 1, 'limit': 10},
headers={
'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type': 'application/json'
}
)
result = response.json()
print(result) require 'net/http'
require 'json'
uri = URI('https://api.emailit.com/v2/emails?page=1&limit=10')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri)
request['Authorization'] = 'Bearer em_test_51RxCWJ...vS00p61e0qRE'
request['Content-Type'] = 'application/json'
response = http.request(request)
result = JSON.parse(response.body)
puts result package main
import (
"encoding/json"
"fmt"
"net/http"
)
func main() {
url := "https://api.emailit.com/v2/emails?page=1&limit=10"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)
} use reqwest;
use serde_json::Value;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let response = client
.get("https://api.emailit.com/v2/emails?page=1&limit=10")
.header("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
.header("Content-Type", "application/json")
.send()
.await?;
let result: Value = response.json().await?;
println!("{:?}", result);
Ok(())
} import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
public class ListEmails {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.emailit.com/v2/emails?page=1&limit=10"))
.header("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
.header("Content-Type", "application/json")
.GET()
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
} using System;
using System.Net.Http;
using System.Threading.Tasks;
public class ListEmails
{
public static async Task Main()
{
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization",
"Bearer em_test_51RxCWJ...vS00p61e0qRE");
var response = await client.GetAsync(
"https://api.emailit.com/v2/emails?page=1&limit=10");
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
} curl -X GET "https://api.emailit.com/v2/emails?page=1&limit=10" \
-H "Authorization: Bearer em_test_51RxCWJ...vS00p61e0qRE" \
-H "Content-Type: application/json" {
"data": [
{
"object": "email",
"id": "em_abc123xyz789def456ghi012jkl345",
"type": "outbound",
"from": "sender@yourdomain.com",
"to": "recipient@example.com",
"subject": "Привіт світ",
"status": "delivered",
"size": 4523,
"scheduled_at": null,
"created_at": "2026-01-08T12:00:00.123456Z",
"updated_at": "2026-01-08T12:01:00.123456Z",
"meta": null
},
{
"object": "email",
"id": "em_def456ghi789jkl012mno345pqr678",
"type": "inbound",
"from": "external@otherdomain.com",
"to": "inbox@yourdomain.com",
"subject": "Відп: Ваш запит",
"status": "delivered",
"size": 2891,
"scheduled_at": null,
"created_at": "2026-01-08T11:30:00.123456Z",
"updated_at": "2026-01-08T11:30:00.123456Z",
"meta": null
}
],
"next_page_url": "/v2/emails?page=2&limit=10",
"previous_page_url": null
} Отримати електронний лист
Отримати окремий електронний лист за його ідентифікатором, включаючи заголовки, розібраний вміст тіла та вкладення.
/emails/{id}Параметри шляху
idstringRequiredІдентифікатор електронного листа у форматі em_xxx.
const response = await fetch('https://api.emailit.com/v2/emails/em_abc123xyz789def456', {
method: 'GET',
headers: {
'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type': 'application/json'
}
});
const result = await response.json(); <?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.emailit.com/v2/emails/em_abc123xyz789def456',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type: application/json'
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "Помилка cURL #:" . $err;
} else {
$result = json_decode($response, true);
print_r($result);
} import requests
response = requests.get(
'https://api.emailit.com/v2/emails/em_abc123xyz789def456',
headers={
'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type': 'application/json'
}
)
result = response.json()
print(result) require 'net/http'
require 'json'
uri = URI('https://api.emailit.com/v2/emails/em_abc123xyz789def456')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri)
request['Authorization'] = 'Bearer em_test_51RxCWJ...vS00p61e0qRE'
request['Content-Type'] = 'application/json'
response = http.request(request)
result = JSON.parse(response.body)
puts result package main
import (
"encoding/json"
"fmt"
"net/http"
)
func main() {
url := "https://api.emailit.com/v2/emails/em_abc123xyz789def456"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)
} use reqwest;
use serde_json::Value;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let response = client
.get("https://api.emailit.com/v2/emails/em_abc123xyz789def456")
.header("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
.header("Content-Type", "application/json")
.send()
.await?;
let result: Value = response.json().await?;
println!("{:?}", result);
Ok(())
} import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
public class GetEmail {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.emailit.com/v2/emails/em_abc123xyz789def456"))
.header("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
.header("Content-Type", "application/json")
.GET()
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
} using System;
using System.Net.Http;
using System.Threading.Tasks;
public class GetEmail
{
public static async Task Main()
{
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization",
"Bearer em_test_51RxCWJ...vS00p61e0qRE");
var response = await client.GetAsync(
"https://api.emailit.com/v2/emails/em_abc123xyz789def456");
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
} curl -X GET https://api.emailit.com/v2/emails/em_abc123xyz789def456 \
-H "Authorization: Bearer em_test_51RxCWJ...vS00p61e0qRE" \
-H "Content-Type: application/json" Поля відповіді
| Поле | Тип | Опис |
|---|---|---|
object | string | Завжди "email" |
id | string | Ідентифікатор листа у форматі em_xxx |
type | string | "inbound" або "outbound" |
token | string | Токен електронного листа |
message_id | string | SMTP Message-ID |
from | string | Адреса відправника |
to | string | Адреса отримувача |
subject | string | Тема листа |
status | string | Поточний статус листа |
size | integer | Розмір листа в байтах |
scheduled_at | string | null | Час запланованої доставки (ISO 8601) |
created_at | string | Час створення (ISO 8601) |
updated_at | string | Час останнього оновлення (ISO 8601) |
tracking | object | null | Налаштування відстеження (відсутнє для вхідних листів) |
meta | object | null | Користувацькі метадані |
headers | object | Розібрані заголовки листа |
body | object | Розібране тіло з полями text та html |
attachments | array | Розібрані вкладення з вмістом у форматі base64 |
Об’єкт Body
| Поле | Тип | Опис |
|---|---|---|
text | string | null | Текстовий вміст |
html | string | null | HTML-вміст |
Об’єкт Attachment
| Поле | Тип | Опис |
|---|---|---|
filename | string | Назва файлу вкладення |
content_type | string | MIME-тип |
size | integer | Розмір вкладення в байтах |
content_id | string | null | Content-ID для вбудованих вкладень |
content_disposition | string | "attachment" або "inline" |
content | string | Вміст вкладення у форматі Base64 |
{
"object": "email",
"id": "em_abc123xyz789def456ghi012jkl345",
"type": "outbound",
"token": "abc123xyz789",
"message_id": "<abc123xyz789@yourdomain.com>",
"from": "sender@yourdomain.com",
"to": "recipient@example.com",
"subject": "Привіт світ",
"status": "delivered",
"size": 12345,
"scheduled_at": null,
"created_at": "2026-01-08T12:00:00.123456Z",
"updated_at": "2026-01-08T12:05:00.123456Z",
"tracking": {
"loads": true,
"clicks": true
},
"meta": {
"campaign": "літня",
"type": "маркетинг"
},
"headers": {
"From": "sender@yourdomain.com",
"To": "recipient@example.com",
"Subject": "Привіт світ",
"Content-Type": "multipart/mixed; boundary=----boundary123"
},
"body": {
"text": "Ласкаво просимо!",
"html": "<html><body><h1>Ласкаво просимо!</h1></body></html>"
},
"attachments": [
{
"filename": "документ.pdf",
"content_type": "application/pdf",
"size": 12345,
"content_id": null,
"content_disposition": "attachment",
"content": "JVBERi0xLjQKJcOkw7zDqc..."
}
]
} {
"object": "email",
"id": "em_abc123xyz789def456ghi012jkl345",
"type": "inbound",
"token": "abc123xyz789",
"message_id": "<abc123xyz789@externaldomain.com>",
"from": "external@externaldomain.com",
"to": "inbox@yourdomain.com",
"subject": "Відп: Ваш запит",
"status": "delivered",
"size": 8234,
"scheduled_at": null,
"created_at": "2026-01-08T12:00:00.123456Z",
"updated_at": "2026-01-08T12:00:00.123456Z",
"meta": null,
"headers": {
"From": "external@externaldomain.com",
"To": "inbox@yourdomain.com",
"Subject": "Відп: Ваш запит",
"Content-Type": "text/plain; charset=utf-8"
},
"body": {
"text": "Дякуємо за звернення...",
"html": null
},
"attachments": []
} {
"object": "email",
"id": "em_abc123xyz789def456ghi012jkl345",
"type": "outbound",
"token": "abc123xyz789",
"message_id": "<abc123xyz789@yourdomain.com>",
"from": "sender@yourdomain.com",
"to": "recipient@example.com",
"subject": "Нагадування про зустріч",
"status": "scheduled",
"size": 8234,
"scheduled_at": "2026-01-10T15:00:00.000000Z",
"created_at": "2026-01-08T12:00:00.123456Z",
"updated_at": "2026-01-08T12:00:00.123456Z",
"tracking": {
"loads": true,
"clicks": true
},
"meta": null,
"headers": {
"From": "sender@yourdomain.com",
"To": "recipient@example.com",
"Subject": "Нагадування про зустріч",
"Content-Type": "text/html; charset=utf-8"
},
"body": {
"text": "Нагадування про зустріч...",
"html": "<html>..."
},
"attachments": []
} {
"error": "Електронний лист не знайдено",
"message": "Лист з ідентифікатором 'em_abc123' не знайдено у вашому робочому просторі"
} Отримати Raw Email
Повертає повний необроблений MIME-рядок повідомлення разом із метаданими електронної пошти.
/emails/{id}/rawПараметри шляху
idstringRequiredІдентифікатор електронного листа у форматі em_xxx.
const response = await fetch('https://api.emailit.com/v2/emails/em_abc123xyz789def456/raw', {
method: 'GET',
headers: {
'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type': 'application/json'
}
});
const result = await response.json(); <?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.emailit.com/v2/emails/em_abc123xyz789def456/raw',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type: application/json'
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "Помилка cURL #:" . $err;
} else {
$result = json_decode($response, true);
print_r($result);
} import requests
response = requests.get(
'https://api.emailit.com/v2/emails/em_abc123xyz789def456/raw',
headers={
'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type': 'application/json'
}
)
result = response.json()
print(result) require 'net/http'
require 'json'
uri = URI('https://api.emailit.com/v2/emails/em_abc123xyz789def456/raw')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri)
request['Authorization'] = 'Bearer em_test_51RxCWJ...vS00p61e0qRE'
request['Content-Type'] = 'application/json'
response = http.request(request)
result = JSON.parse(response.body)
puts result package main
import (
"encoding/json"
"fmt"
"net/http"
)
func main() {
url := "https://api.emailit.com/v2/emails/em_abc123xyz789def456/raw"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)
} use reqwest;
use serde_json::Value;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let response = client
.get("https://api.emailit.com/v2/emails/em_abc123xyz789def456/raw")
.header("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
.header("Content-Type", "application/json")
.send()
.await?;
let result: Value = response.json().await?;
println!("{:?}", result);
Ok(())
} import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
public class GetEmailRaw {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.emailit.com/v2/emails/em_abc123xyz789def456/raw"))
.header("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
.header("Content-Type", "application/json")
.GET()
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
} using System;
using System.Net.Http;
using System.Threading.Tasks;
public class GetEmailRaw
{
public static async Task Main()
{
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization",
"Bearer em_test_51RxCWJ...vS00p61e0qRE");
var response = await client.GetAsync(
"https://api.emailit.com/v2/emails/em_abc123xyz789def456/raw");
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
} curl -X GET https://api.emailit.com/v2/emails/em_abc123xyz789def456/raw \
-H "Authorization: Bearer em_test_51RxCWJ...vS00p61e0qRE" \
-H "Content-Type: application/json" {
"object": "email",
"id": "em_abc123xyz789def456ghi012jkl345",
"type": "outbound",
"token": "abc123xyz789",
"message_id": "<abc123xyz789@yourdomain.com>",
"from": "sender@yourdomain.com",
"to": "recipient@example.com",
"subject": "Привіт світ",
"status": "delivered",
"size": 4523,
"scheduled_at": null,
"created_at": "2026-01-08T12:00:00.123456Z",
"updated_at": "2026-01-08T12:05:00.123456Z",
"tracking": {
"loads": true,
"clicks": false
},
"meta": null,
"headers": {
"From": "sender@yourdomain.com",
"To": "recipient@example.com",
"Subject": "Привіт світ",
"Content-Type": "text/html; charset=utf-8"
},
"raw": "From: sender@yourdomain.com\r\nTo: recipient@example.com\r\nSubject: Привіт світ\r\nContent-Type: text/html; charset=utf-8\r\n\r\n<html><body><h1>Ласкаво просимо!</h1></body></html>"
} {
"error": "Електронний лист не знайдено",
"message": "Електронний лист з ID 'em_abc123' не знайдено у вашому робочому просторі"
} Отримання вкладень електронного листа
Повертає лише список вкладень для електронного листа з вмістом, закодованим у base64.
/emails/{id}/attachmentsПараметри шляху
idstringRequiredІдентифікатор електронного листа у форматі em_xxx.
const response = await fetch('https://api.emailit.com/v2/emails/em_abc123xyz789def456/attachments', {
method: 'GET',
headers: {
'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type': 'application/json'
}
});
const result = await response.json(); <?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.emailit.com/v2/emails/em_abc123xyz789def456/attachments',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type: application/json'
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "Помилка cURL #:" . $err;
} else {
$result = json_decode($response, true);
print_r($result);
} import requests
response = requests.get(
'https://api.emailit.com/v2/emails/em_abc123xyz789def456/attachments',
headers={
'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type': 'application/json'
}
)
result = response.json()
print(result) require 'net/http'
require 'json'
uri = URI('https://api.emailit.com/v2/emails/em_abc123xyz789def456/attachments')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri)
request['Authorization'] = 'Bearer em_test_51RxCWJ...vS00p61e0qRE'
request['Content-Type'] = 'application/json'
response = http.request(request)
result = JSON.parse(response.body)
puts result package main
import (
"encoding/json"
"fmt"
"net/http"
)
func main() {
url := "https://api.emailit.com/v2/emails/em_abc123xyz789def456/attachments"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)
} use reqwest;
use serde_json::Value;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let response = client
.get("https://api.emailit.com/v2/emails/em_abc123xyz789def456/attachments")
.header("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
.header("Content-Type", "application/json")
.send()
.await?;
let result: Value = response.json().await?;
println!("{:?}", result);
Ok(())
} import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
public class GetEmailAttachments {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.emailit.com/v2/emails/em_abc123xyz789def456/attachments"))
.header("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
.header("Content-Type", "application/json")
.GET()
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
} using System;
using System.Net.Http;
using System.Threading.Tasks;
public class GetEmailAttachments
{
public static async Task Main()
{
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization",
"Bearer em_test_51RxCWJ...vS00p61e0qRE");
var response = await client.GetAsync(
"https://api.emailit.com/v2/emails/em_abc123xyz789def456/attachments");
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
} curl -X GET https://api.emailit.com/v2/emails/em_abc123xyz789def456/attachments \
-H "Authorization: Bearer em_test_51RxCWJ...vS00p61e0qRE" \
-H "Content-Type: application/json" Поля відповіді
| Поле | Тип | Опис |
|---|---|---|
object | string | Завжди "list" |
data | array | Масив об’єктів вкладень |
Об’єкт вкладення
| Поле | Тип | Опис |
|---|---|---|
filename | string | Ім’я файлу вкладення |
content_type | string | MIME-тип |
size | integer | Розмір вкладення в байтах |
content_id | string | null | Content-ID для вбудованих вкладень |
content_disposition | string | "attachment" або "inline" |
content | string | Вміст вкладення, закодований у base64 |
{
"object": "list",
"data": [
{
"filename": "doc.pdf",
"content_type": "application/pdf",
"size": 12345,
"content_id": null,
"content_disposition": "attachment",
"content": "JVBERi0xLjQKJcOkw7zDqc..."
},
{
"filename": "logo.png",
"content_type": "image/png",
"size": 5678,
"content_id": "logo@yourdomain.com",
"content_disposition": "inline",
"content": "iVBORw0KGgoAAAANSUhEUg..."
}
]
} {
"object": "list",
"data": []
} {
"error": "Електронний лист не знайдено",
"message": "Електронний лист з ідентифікатором 'em_abc123' не знайдено у вашому робочому просторі"
} Отримати тіло листа
Повертає лише оброблений вміст тіла листа (текст та HTML).
/emails/{id}/bodyПараметри шляху
idstringRequiredІдентифікатор листа у форматі em_xxx.
const response = await fetch('https://api.emailit.com/v2/emails/em_abc123xyz789def456/body', {
method: 'GET',
headers: {
'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type': 'application/json'
}
});
const result = await response.json(); <?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.emailit.com/v2/emails/em_abc123xyz789def456/body',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type: application/json'
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "Помилка cURL #:" . $err;
} else {
$result = json_decode($response, true);
print_r($result);
} import requests
response = requests.get(
'https://api.emailit.com/v2/emails/em_abc123xyz789def456/body',
headers={
'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type': 'application/json'
}
)
result = response.json()
print(result) require 'net/http'
require 'json'
uri = URI('https://api.emailit.com/v2/emails/em_abc123xyz789def456/body')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri)
request['Authorization'] = 'Bearer em_test_51RxCWJ...vS00p61e0qRE'
request['Content-Type'] = 'application/json'
response = http.request(request)
result = JSON.parse(response.body)
puts result package main
import (
"encoding/json"
"fmt"
"net/http"
)
func main() {
url := "https://api.emailit.com/v2/emails/em_abc123xyz789def456/body"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)
} use reqwest;
use serde_json::Value;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let response = client
.get("https://api.emailit.com/v2/emails/em_abc123xyz789def456/body")
.header("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
.header("Content-Type", "application/json")
.send()
.await?;
let result: Value = response.json().await?;
println!("{:?}", result);
Ok(())
} import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
public class GetEmailBody {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.emailit.com/v2/emails/em_abc123xyz789def456/body"))
.header("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
.header("Content-Type", "application/json")
.GET()
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
} using System;
using System.Net.Http;
using System.Threading.Tasks;
public class GetEmailBody
{
public static async Task Main()
{
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization",
"Bearer em_test_51RxCWJ...vS00p61e0qRE");
var response = await client.GetAsync(
"https://api.emailit.com/v2/emails/em_abc123xyz789def456/body");
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
} curl -X GET https://api.emailit.com/v2/emails/em_abc123xyz789def456/body \
-H "Authorization: Bearer em_test_51RxCWJ...vS00p61e0qRE" \
-H "Content-Type: application/json" {
"text": "Текстовий вміст листа",
"html": "<html><body><h1>Ласкаво просимо!</h1><p>HTML-вміст листа</p></body></html>"
} {
"text": "Текстовий вміст листа",
"html": null
} {
"error": "Лист не знайдено",
"message": "Лист з ідентифікатором 'em_abc123' не знайдено у вашому робочому просторі"
} Отримання метаданих листа
Повертає метадані листа з інформацією про вкладення, але без вмісту вкладень. Корисно для перегляду листа без завантаження потенційно великих файлів.
/emails/{id}/metaПараметри шляху
idstringRequiredІдентифікатор листа у форматі em_xxx.
const response = await fetch('https://api.emailit.com/v2/emails/em_abc123xyz789def456/meta', {
method: 'GET',
headers: {
'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type': 'application/json'
}
});
const result = await response.json(); <?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.emailit.com/v2/emails/em_abc123xyz789def456/meta',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type: application/json'
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "Помилка cURL #:" . $err;
} else {
$result = json_decode($response, true);
print_r($result);
} import requests
response = requests.get(
'https://api.emailit.com/v2/emails/em_abc123xyz789def456/meta',
headers={
'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type': 'application/json'
}
)
result = response.json()
print(result) require 'net/http'
require 'json'
uri = URI('https://api.emailit.com/v2/emails/em_abc123xyz789def456/meta')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri)
request['Authorization'] = 'Bearer em_test_51RxCWJ...vS00p61e0qRE'
request['Content-Type'] = 'application/json'
response = http.request(request)
result = JSON.parse(response.body)
puts result package main
import (
"encoding/json"
"fmt"
"net/http"
)
func main() {
url := "https://api.emailit.com/v2/emails/em_abc123xyz789def456/meta"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)
} use reqwest;
use serde_json::Value;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let response = client
.get("https://api.emailit.com/v2/emails/em_abc123xyz789def456/meta")
.header("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
.header("Content-Type", "application/json")
.send()
.await?;
let result: Value = response.json().await?;
println!("{:?}", result);
Ok(())
} import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
public class GetEmailMeta {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.emailit.com/v2/emails/em_abc123xyz789def456/meta"))
.header("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
.header("Content-Type", "application/json")
.GET()
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
} using System;
using System.Net.Http;
using System.Threading.Tasks;
public class GetEmailMeta
{
public static async Task Main()
{
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization",
"Bearer em_test_51RxCWJ...vS00p61e0qRE");
var response = await client.GetAsync(
"https://api.emailit.com/v2/emails/em_abc123xyz789def456/meta");
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
} curl -X GET https://api.emailit.com/v2/emails/em_abc123xyz789def456/meta \
-H "Authorization: Bearer em_test_51RxCWJ...vS00p61e0qRE" \
-H "Content-Type: application/json" Поля відповіді
Відповідь містить усі поля метаданих листа плюс масив attachments з інформацією про вкладення (без поля content).
Об’єкт вкладення (метадані)
| Поле | Тип | Опис |
|---|---|---|
filename | string | Назва файлу вкладення |
content_type | string | MIME-тип |
size | integer | Розмір вкладення в байтах |
content_id | string | null | Content-ID для вбудованих вкладень |
content_disposition | string | "attachment" або "inline" |
{
"object": "email",
"id": "em_abc123xyz789def456ghi012jkl345",
"type": "outbound",
"token": "abc123xyz789",
"message_id": "<abc123xyz789@yourdomain.com>",
"from": "sender@yourdomain.com",
"to": "recipient@example.com",
"subject": "Привіт світ",
"status": "delivered",
"size": 4523,
"scheduled_at": null,
"created_at": "2026-01-08T12:00:00.123456Z",
"updated_at": "2026-01-08T12:05:00.123456Z",
"tracking": {
"loads": true,
"clicks": false
},
"meta": null,
"headers": {
"From": "sender@yourdomain.com",
"To": "recipient@example.com",
"Subject": "Привіт світ",
"Content-Type": "multipart/mixed; boundary=----boundary123"
},
"attachments": [
{
"filename": "doc.pdf",
"content_type": "application/pdf",
"size": 12345,
"content_id": null,
"content_disposition": "attachment"
}
]
} {
"object": "email",
"id": "em_abc123xyz789def456ghi012jkl345",
"type": "outbound",
"token": "abc123xyz789",
"message_id": "<abc123xyz789@yourdomain.com>",
"from": "sender@yourdomain.com",
"to": "recipient@example.com",
"subject": "Привіт світ",
"status": "delivered",
"size": 4523,
"scheduled_at": null,
"created_at": "2026-01-08T12:00:00.123456Z",
"updated_at": "2026-01-08T12:05:00.123456Z",
"tracking": {
"loads": true,
"clicks": false
},
"meta": null,
"headers": {
"From": "sender@yourdomain.com",
"To": "recipient@example.com",
"Subject": "Привіт світ",
"Content-Type": "text/html; charset=utf-8"
},
"attachments": []
} {
"error": "Лист не знайдено",
"message": "Лист з ідентифікатором 'em_abc123' не знайдено у вашому робочому просторі"
} Оновлення запланованого листа
Змінює час відправки запланованого листа. Працює лише для листів зі статусом “scheduled” (заплановано) і тільки якщо поточний запланований час відправки принаймні на 3 хвилини пізніше поточного моменту.
/emails/{id}Параметри шляху
idstringRequiredІдентифікатор листа у форматі em_xxx.
Тіло запиту
scheduled_atstringRequiredНовий час відправки. Приймає формат ISO 8601, Unix timestamp або природну мову на кшталт завтра о 9 ранку. Має бути принаймні на 3 хвилини пізніше поточного часу.
const response = await fetch('https://api.emailit.com/v2/emails/em_abc123xyz789def456', {
method: 'POST',
headers: {
'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type': 'application/json'
},
body: JSON.stringify({
scheduled_at: '2026-01-10T15:00:00Z'
})
});
const result = await response.json(); <?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.emailit.com/v2/emails/em_abc123xyz789def456',
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([
'scheduled_at' => '2026-01-10T15:00:00Z'
]),
CURLOPT_HTTPHEADER => [
'Authorization: Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type: application/json'
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "Помилка cURL #:" . $err;
} else {
$result = json_decode($response, true);
print_r($result);
} import requests
response = requests.post(
'https://api.emailit.com/v2/emails/em_abc123xyz789def456',
headers={
'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type': 'application/json'
},
json={
'scheduled_at': '2026-01-10T15:00:00Z'
}
)
result = response.json()
print(result) require 'net/http'
require 'json'
uri = URI('https://api.emailit.com/v2/emails/em_abc123xyz789def456')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'Bearer em_test_51RxCWJ...vS00p61e0qRE'
request['Content-Type'] = 'application/json'
request.body = {
scheduled_at: '2026-01-10T15:00:00Z'
}.to_json
response = http.request(request)
result = JSON.parse(response.body)
puts result package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
url := "https://api.emailit.com/v2/emails/em_abc123xyz789def456"
data := map[string]interface{}{
"scheduled_at": "2026-01-10T15:00:00Z",
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)
} use reqwest;
use serde_json::{json, Value};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let response = client
.post("https://api.emailit.com/v2/emails/em_abc123xyz789def456")
.header("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
.header("Content-Type", "application/json")
.json(&json!({
"scheduled_at": "2026-01-10T15:00:00Z"
}))
.send()
.await?;
let result: Value = response.json().await?;
println!("{:?}", result);
Ok(())
} import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
import java.net.http.HttpRequest.BodyPublishers;
public class UpdateEmail {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
String jsonBody = "{\"scheduled_at\":\"2026-01-10T15:00:00Z\"}";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.emailit.com/v2/emails/em_abc123xyz789def456"))
.header("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
.header("Content-Type", "application/json")
.POST(BodyPublishers.ofString(jsonBody))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
} using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
public class UpdateEmail
{
public static async Task Main()
{
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization",
"Bearer em_test_51RxCWJ...vS00p61e0qRE");
var data = new { scheduled_at = "2026-01-10T15:00:00Z" };
var json = JsonConvert.SerializeObject(data);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync(
"https://api.emailit.com/v2/emails/em_abc123xyz789def456", content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
} curl -X POST https://api.emailit.com/v2/emails/em_abc123xyz789def456 \
-H "Authorization: Bearer em_test_51RxCWJ...vS00p61e0qRE" \
-H "Content-Type: application/json" \
-d '{
"scheduled_at": "2026-01-10T15:00:00Z"
}' curl -X POST https://api.emailit.com/v2/emails/em_abc123xyz789def456 \
-H "Authorization: Bearer em_test_51RxCWJ...vS00p61e0qRE" \
-H "Content-Type: application/json" \
-d '{
"scheduled_at": "завтра о 15:00"
}' {
"object": "email",
"id": "em_abc123xyz789def456ghi012jkl345",
"status": "scheduled",
"scheduled_at": "2026-01-10T15:00:00.000Z",
"updated_at": "2026-01-08T12:00:00.123456Z",
"message": "Розклад відправки листа успішно оновлено"
} {
"error": "Лист не знайдено",
"message": "Лист з ідентифікатором 'em_abc123' не знайдено у вашому робочому просторі"
} {
"error": "Неможливо оновити лист",
"message": "Заплановані листи можна оновлювати лише принаймні за 3 хвилини до запланованого часу відправки. Цей лист заплановано відправити через 2 хвилини."
} {
"error": "Некоректний scheduled_at",
"message": "Новий час відправки має бути принаймні на 3 хвилини пізніше поточного моменту."
} Скасування листа
Скасувати заплановий або очікуючий лист. Для запланованих листів скасування можливе лише якщо до запланованого часу відправлення залишилося щонайменше 3 хвилини.
/emails/{id}/cancelПараметри шляху
idstringRequiredІдентифікатор листа у форматі em_xxx.
const response = await fetch('https://api.emailit.com/v2/emails/em_abc123xyz789def456/cancel', {
method: 'POST',
headers: {
'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type': 'application/json'
}
});
const result = await response.json(); <?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.emailit.com/v2/emails/em_abc123xyz789def456/cancel',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type: application/json'
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
$result = json_decode($response, true);
print_r($result);
} import requests
response = requests.post(
'https://api.emailit.com/v2/emails/em_abc123xyz789def456/cancel',
headers={
'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type': 'application/json'
}
)
result = response.json()
print(result) require 'net/http'
require 'json'
uri = URI('https://api.emailit.com/v2/emails/em_abc123xyz789def456/cancel')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'Bearer em_test_51RxCWJ...vS00p61e0qRE'
request['Content-Type'] = 'application/json'
response = http.request(request)
result = JSON.parse(response.body)
puts result package main
import (
"encoding/json"
"fmt"
"net/http"
"strings"
)
func main() {
url := "https://api.emailit.com/v2/emails/em_abc123xyz789def456/cancel"
req, _ := http.NewRequest("POST", url, strings.NewReader(""))
req.Header.Set("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)
} use reqwest;
use serde_json::Value;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let response = client
.post("https://api.emailit.com/v2/emails/em_abc123xyz789def456/cancel")
.header("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
.header("Content-Type", "application/json")
.send()
.await?;
let result: Value = response.json().await?;
println!("{:?}", result);
Ok(())
} import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
import java.net.http.HttpRequest.BodyPublishers;
public class CancelEmail {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.emailit.com/v2/emails/em_abc123xyz789def456/cancel"))
.header("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
.header("Content-Type", "application/json")
.POST(BodyPublishers.noBody())
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
} using System;
using System.Net.Http;
using System.Threading.Tasks;
public class CancelEmail
{
public static async Task Main()
{
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization",
"Bearer em_test_51RxCWJ...vS00p61e0qRE");
var response = await client.PostAsync(
"https://api.emailit.com/v2/emails/em_abc123xyz789def456/cancel",
new StringContent(""));
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
} curl -X POST https://api.emailit.com/v2/emails/em_abc123xyz789def456/cancel \
-H "Authorization: Bearer em_test_51RxCWJ...vS00p61e0qRE" \
-H "Content-Type: application/json" {
"object": "email",
"id": "em_abc123xyz789def456ghi012jkl345",
"status": "canceled",
"message": "Лист успішно скасовано"
} {
"error": "Лист не знайдено",
"message": "Лист з ідентифікатором 'em_abc123' не знайдено у вашому робочому просторі"
} {
"error": "Неможливо скасувати лист",
"message": "Лист неможливо скасувати. Поточний статус: 'sent'. Скасувати можна лише листи зі статусом 'scheduled' або 'pending'."
} {
"error": "Неможливо скасувати лист",
"message": "Заплановані листи можна скасувати лише за 3 хвилини до запланованого часу відправлення. Цей лист заплановано відправити через 2 хвилини."
} Статуси листів, які можна скасувати
| Статус | Можна скасувати? | Примітки |
|---|---|---|
| pending | ✅ Так | Лист у черзі, але ще не оброблений |
| scheduled | ✅ Так | Лише якщо до запланованого часу залишилося 3+ хвилини |
| sent | ❌ Ні | Лист уже відправлено на поштовий сервер |
| delivered | ❌ Ні | Лист уже доставлено отримувачу |
| bounced | ❌ Ні | Лист уже оброблено |
| canceled | ❌ Ні | Лист уже скасовано |
Повторна відправка листа
Повторно відправити лист, який зазнав критичної помилки, завершився з помилкою або був призупинений. Це створює дублікат оригінального листа та відправляє його знову. Новий лист отримує власний унікальний ID.
/emails/{id}/retryПараметри шляху
idstringRequiredID листа у форматі em_xxx.
const response = await fetch('https://api.emailit.com/v2/emails/em_abc123xyz789def456/retry', {
method: 'POST',
headers: {
'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type': 'application/json'
}
});
const result = await response.json(); <?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.emailit.com/v2/emails/em_abc123xyz789def456/retry',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type: application/json'
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "Помилка cURL #:" . $err;
} else {
$result = json_decode($response, true);
print_r($result);
} import requests
response = requests.post(
'https://api.emailit.com/v2/emails/em_abc123xyz789def456/retry',
headers={
'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type': 'application/json'
}
)
result = response.json()
print(result) require 'net/http'
require 'json'
uri = URI('https://api.emailit.com/v2/emails/em_abc123xyz789def456/retry')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'Bearer em_test_51RxCWJ...vS00p61e0qRE'
request['Content-Type'] = 'application/json'
response = http.request(request)
result = JSON.parse(response.body)
puts result package main
import (
"encoding/json"
"fmt"
"net/http"
"strings"
)
func main() {
url := "https://api.emailit.com/v2/emails/em_abc123xyz789def456/retry"
req, _ := http.NewRequest("POST", url, strings.NewReader(""))
req.Header.Set("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)
} use reqwest;
use serde_json::Value;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let response = client
.post("https://api.emailit.com/v2/emails/em_abc123xyz789def456/retry")
.header("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
.header("Content-Type", "application/json")
.send()
.await?;
let result: Value = response.json().await?;
println!("{:?}", result);
Ok(())
} import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
import java.net.http.HttpRequest.BodyPublishers;
public class RetryEmail {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.emailit.com/v2/emails/em_abc123xyz789def456/retry"))
.header("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
.header("Content-Type", "application/json")
.POST(BodyPublishers.noBody())
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
} using System;
using System.Net.Http;
using System.Threading.Tasks;
public class RetryEmail
{
public static async Task Main()
{
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization",
"Bearer em_test_51RxCWJ...vS00p61e0qRE");
var response = await client.PostAsync(
"https://api.emailit.com/v2/emails/em_abc123xyz789def456/retry",
new StringContent(""));
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
} curl -X POST https://api.emailit.com/v2/emails/em_abc123xyz789def456/retry \
-H "Authorization: Bearer em_test_51RxCWJ...vS00p61e0qRE" \
-H "Content-Type: application/json" {
"object": "email",
"id": "em_new789xyz456abc123",
"original_id": "em_abc123xyz789def456",
"status": "pending",
"message": "Лист поставлено в чергу для повторної відправки"
} {
"error": "Лист не знайдено",
"message": "Лист з ID 'em_abc123' не знайдено у вашому робочому просторі"
} {
"error": "Неможливо повторно відправити лист",
"message": "Лист неможливо відправити повторно. Поточний статус: 'delivered'. Повторно можна відправляти лише листи зі статусами 'failed', 'errored' або 'held'."
} Статуси листів для повторної відправки
| Статус | Можна повторити? | Примітки |
|---|---|---|
| failed | ✅ Так | Лист повернувся з критичною помилкою |
| errored | ✅ Так | Помилка під час обробки листа |
| held | ✅ Так | Лист призупинено для перевірки |
| pending | ❌ Ні | Лист вже в черзі на відправку |
| sent | ❌ Ні | Лист вже відправлено |
| delivered | ❌ Ні | Лист вже доставлено |
Важливі зауваження
- Тарифікація: Повторно відправлені листи тарифікуються як нові листи згідно зі стандартними цінами
- Новий ID: Повторно відправлений лист отримує новий ID, оригінальний лист залишається незмінним
- Посилання на оригінал: Відповідь містить
original_idдля зв’язку з оригінальним листом