### SMTP Session Example Source: https://mailopost.ru/api.html Example of an SMTP session using telnet to connect to smtp.msndr.net, authenticate, and send an email message. ```APIDOC ## SMTP Session Example ### Description Example of an SMTP session using telnet to connect to smtp.msndr.net, authenticate, and send an email message. ### Connection - Server: smtp.msndr.net - Ports: 25 or 587 (plain or STARTTLS), 465 (SSL/TLS) ### Authentication - Username: email of your account - Password: API key ### Example Session ``` $ telnet smtp.msndr.net 25 Trying 95.213.163.242... Connected to smtp.msndr.net. Escape character is '^]'. 220 smtp.msndr.net ESMTP service ready ehlo sender 250-smtp.msndr.net 250-STARTTLS 250-AUTH PLAIN LOGIN 250-PIPELINING 250 8BITMIME auth plain AHVzZXJAZXhhbXBsZS5vcmcAc29tZS1zdXBlci1wdXBlci1zZWNyZXQta2V5 235 authentication ok mail from: mail@from.com 250 Ok rcpt to: rcpt@to.com 250 Ok rcpt to: rcpt1@to.com 250 Ok data 354 End data with . From: Mail From Subject: Hello X-Client-Id: 123 How are you doing? . 250 Message accepted (sent messages ,) quit 221 smtp.msndr.net closing connection Connection closed by foreign host. ``` ### Notes - The response includes a line with information about sent messages, containing recipient addresses and message IDs in the format , comma-separated. - You can add custom headers to the message using the format X-My-Header: my value. In the example, the header Client-Id: 123 is added. ``` -------------------------------- ### List Organizations: GET /email/organizations Source: https://mailopost.ru/api.html List organizations with a GET request to /email/organizations. The response is paginated and includes total_count, total_pages, page_number, page_size, and a collection of organization objects. ```bash curl -X GET https://api.mailopost.ru/v1/email/organizations \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer $API_TOKEN' ``` ```json { "total_count":1, "total_pages":1, "page_number":1, "page_size":25, "collection":[ { "id":1, "name":"My Organization", "address":"Lenina 40", "country":"Russia", "city":"Tomsk", "phone":"+7-3822-123-456", "zip":"634000", "current":true } ] } ``` -------------------------------- ### Get email balance via curl Source: https://mailopost.ru/api.html Example request to retrieve the account balance. Uses the GET /email/balance endpoint with a Bearer token in the Authorization header. ```bash curl -X GET https://api.mailopost.ru/v1/email/balance \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer $API_TOKEN' ``` -------------------------------- ### SMTP session example with telnet Source: https://mailopost.ru/api.html Example SMTP session using telnet to smtp.msndr.net on port 25. Shows authentication with AUTH PLAIN, sending a message with custom header X-Client-Id, and the response containing sent message IDs in format . ```text $ telnet smtp.msndr.net 25 Trying 95.213.163.242... Connected to smtp.msndr.net. Escape character is '^]'. 220 smtp.msndr.net ESMTP service ready ehlo sender 250-smtp.msndr.net 250-STARTTLS 250-AUTH PLAIN LOGIN 250-PIPELINING 250 8BITMIME auth plain AHVzZXJAZXhhbXBsZS5vcmcAc29tZS1zdXBlci1wdXBlci1zZWNyZXQta2V5 235 authentication ok mail from: mail@from.com 250 Ok rcpt to: rcpt@to.com 250 Ok rcpt to: rcpt1@to.com 250 Ok data 354 End data with . From: Mail From Subject: Hello X-Client-Id: 123 How are you doing? . 250 Message accepted (sent messages ,) quit 221 smtp.msndr.net closing connection Connection closed by foreign host. ``` -------------------------------- ### Balance endpoint success response Source: https://mailopost.ru/api.html Example successful response from the balance endpoint. Contains tariff details (subscribers total/available, credits, expires_at) and the current balance. ```json { "tariff" : { "subscribers" : { "total" : 1000, "available" : 997 }, "credits" : 0, "expires_at" : 1629273060 }, "balance" : 12965.96 } ``` -------------------------------- ### List webhooks: GET /email/messages_webhooks Source: https://mailopost.ru/api.html Lists webhooks via GET /email/messages_webhooks. Supports paginated results; the response includes total_count, total_pages, page_number, page_size, and a collection of webhook objects. ```bash curl -X GET https://api.mailopost.ru/v1/email/messages_webhooks \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer $API_TOKEN' ``` ```json { "total_count": 1, "total_pages": 1, "page_number": 1, "page_size": 25, "collection": [ { "id": 1, "url": "https://mysite.org/webhook", "events": [ "delivered" ], "kinds": [ "api" ], "status": "active", "title": "Api delivered webhooks" } ] } ``` -------------------------------- ### Get campaign details with GET /email/campaigns/:id Source: https://mailopost.ru/api.html Retrieves detailed information about a single campaign by its ID. The response includes the campaign attributes and statistics. ```bash curl -X GET https://api.mailopost.ru/v1/email/campaigns/1 \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer $API_TOKEN' ``` -------------------------------- ### Get parameters list success response Source: https://mailopost.ru/api.html Successful response for listing parameters. Contains pagination metadata (total_count, total_pages, page_number, page_size) and a collection of parameter objects. ```json { "total_count":2, "total_pages":1, "page_number":1, "page_size":25, "collection":[ { "id":1, "title":"Name", "kind":"string", "list_id":1 }, { "id":2, "title":"Age", "kind":"numeric", "list_id":1 } ] } ``` -------------------------------- ### Получение информации о получателе (GET /email/lists/:list_id/recipients/:id) Source: https://mailopost.ru/api.html Запрос для получения информации о получателе по ID. Используйте метод GET с указанием list_id и id получателя. Требуется авторизация через Bearer-токен. ```bash curl -X GET https://api.mailopost.ru/v1/email/lists/1/recipients/2 \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer $API_TOKEN' ``` -------------------------------- ### GET webhook details Source: https://mailopost.ru/api.html Retrieves webhook details by ID. Requires a valid API token in the Authorization header. ```bash curl -X GET https://api.mailopost.ru/v1/email/messages_webhooks/1 \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer $API_TOKEN' ``` -------------------------------- ### Получить организацию по умолчанию: GET /email/organizations/current Source: https://mailopost.ru/api.html Запрос организации по умолчанию и успешный ответ сервера. Ответ содержит те же атрибуты, что и в ответе на запрос по ID. ```bash curl -X GET https://api.mailopost.ru/v1/email/organizations/current \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer $API_TOKEN' ``` ```json { "id":1, "name":"My Organization", "address":"Lenina 40", "country":"Russia", "city":"Tomsk", "phone":"+7-3822-123-456", "zip":"634000", "current":true } ``` -------------------------------- ### Get available webhook events with curl and response Source: https://mailopost.ru/api.html Fetches the available webhook events using the GET /email/messages_webhooks/events endpoint. The response lists the supported event types such as delivered, opened, clicked, and unsubscribed. ```bash curl -X GET https://api.mailopost.ru/v1/email/messages_webhooks/events \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer $API_TOKEN' ``` ```json { "events": [ "delivered", "hard_bounced", "skipped", "opened", "clicked", "unsubscribed", "complained", "soft_bounced" ] } ``` -------------------------------- ### GET /email/templates/:template_id - Get template info Source: https://mailopost.ru/api.html Fetches detailed information about a specific template by its ID. The response includes fields such as id, name, subject, from_email, from_name, state, preset_params, html, and text. ```bash curl -X GET https://api.mailopost.ru/v1/email/templates/1 \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer $API_TOKEN' ``` ```json { "id": 1, "name": null, "subject": "Hello world!", "from_email": "hello@world.com", "from_name": "Mr.Hello", "state": "active", "preset_params": [ "age", "name" ], "html": true, "text": true } ``` -------------------------------- ### List campaigns with GET /email/campaigns Source: https://mailopost.ru/api.html Retrieves the full list of email campaigns for the account. Supports pagination via the page_number and page_size parameters. The statistic parameter can be set to false to exclude the statistics block and speed up the request. ```bash curl -X GET https://api.mailopost.ru/v1/email/campaigns?statistic=false \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer $API_TOKEN' ``` -------------------------------- ### List recipient groups (GET /email/lists) Source: https://mailopost.ru/api.html Lists all recipient groups with pagination support. The response includes total_count, total_pages, page_number, page_size, and a collection of groups. ```bash curl -X GET https://api.mailopost.ru/v1/email/lists \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer $API_TOKEN' ``` ```json { "total_count":3, "total_pages":1, "page_number":1, "page_size":25, "collection":[ { "id":1, "title":"My Recipients" }, { "id":2, "title":"My Recipients #2" }, { "id":3, "title":"My Recipients #3" } ] } ``` -------------------------------- ### List segments (GET /email/segments) Source: https://mailopost.ru/api.html Lists all segments. Supports pagination with a maximum page_size of 1000. The success response contains a collection of segments, each with an id and title. ```bash curl -X GET https://api.mailopost.ru/v1/email/segments \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer $API_TOKEN' ``` ```json { "total_count":2, "total_pages":1, "page_number":1, "page_size":25, "collection":[ { "id" : 1, "title" : "Segment Number One" } ] } ``` -------------------------------- ### Get available message kinds with curl and response Source: https://mailopost.ru/api.html Fetches the available message types (kinds) using the GET /email/messages_webhooks/kinds endpoint. The response lists the supported kinds: campaign, campaign_transactional, campaign_workflow, and api. ```bash curl -X GET https://api.mailopost.ru/v1/email/messages_webhooks/kinds \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer $API_TOKEN' ``` ```json { "kinds": [ "campaign", "campaign_transactional", "campaign_workflow", "api" ] } ``` -------------------------------- ### GET /email/lists/:id/parameters Source: https://mailopost.ru/api.html Получает список параметров группы получателей. Поддерживает постраничную выдачу результатов. ```APIDOC ## GET /email/lists/:id/parameters ### Description Получает список параметров группы получателей. Поддерживает постраничную выдачу результатов. ### Method GET ### Endpoint /email/lists/:id/parameters ### Parameters #### Path Parameters - **id** (integer) - Required - Идентификатор группы, для которой получается список параметров. ### Response #### Success Response (200) - **total_count** (integer) - Общее количество параметров. - **total_pages** (integer) - Общее количество страниц. - **page_number** (integer) - Номер текущей страницы. - **page_size** (integer) - Размер страницы. - **collection** (array) - Массив параметров. Каждый элемент содержит: - **id** (integer) - Идентификатор параметра. - **title** (string) - Название параметра. - **kind** (string) - Тип параметра. - **list_id** (integer) - Идентификатор группы. #### Response Example { "total_count": 2, "total_pages": 1, "page_number": 1, "page_size": 25, "collection": [ { "id": 1, "title": "Name", "kind": "string", "list_id": 1 }, { "id": 2, "title": "Age", "kind": "numeric", "list_id": 1 } ] } ``` -------------------------------- ### Получить список получателей (GET /email/lists/:id/recipients) Source: https://mailopost.ru/api.html Запрос списка получателей группы с использованием API-ключа. Поддерживает постраничную выдачу, максимальный page_size равен 1000. ```bash curl -X GET https://api.mailopost.ru/v1/email/lists/1/recipients \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer $API_TOKEN' ``` -------------------------------- ### GET /email/lists Source: https://mailopost.ru/api.html Получает список всех групп получателей с поддержкой постраничной выдачи. ```APIDOC ## GET /email/lists ### Description Возвращает коллекцию групп получателей. Поддерживает постраничную выдачу результатов. ### Method GET ### Endpoint https://api.mailopost.ru/v1/email/lists ### Response #### Success Response (200) - **total_count** (integer) - Общее количество групп - **total_pages** (integer) - Общее количество страниц - **page_number** (integer) - Номер текущей страницы - **page_size** (integer) - Размер страницы - **collection** (array) - Массив групп, каждая содержит: - **id** (integer) - Идентификатор группы - **title** (string) - Название группы #### Response Example { "total_count": 3, "total_pages": 1, "page_number": 1, "page_size": 25, "collection": [ { "id": 1, "title": "My Recipients" }, { "id": 2, "title": "My Recipients #2" }, { "id": 3, "title": "My Recipients #3" } ] } ``` -------------------------------- ### GET /email/templates Source: https://mailopost.ru/api.html Retrieves a paginated list of email templates. Supports pagination through query parameters. ```APIDOC ## GET /email/templates ### Description Retrieves a paginated list of email templates. ### Method GET ### Endpoint https://api.mailopost.ru/v1/email/templates ### Parameters #### Query Parameters - page_number (integer) - Optional - Page number for pagination - page_size (integer) - Optional - Number of items per page ### Request Example curl -X GET https://api.mailopost.ru/v1/email/templates \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer $API_TOKEN' ### Response #### Success Response (200) - **total_count** (integer) - Total number of templates - **total_pages** (integer) - Total number of pages - **page_number** (integer) - Current page number - **page_size** (integer) - Number of items per page - **collection** (array) - List of templates, each with id and name #### Response Example { "total_count": 3, "total_pages": 1, "page_number": 1, "page_size": 25, "collection": [ { "id": 1, "name": "My Template" } ] } ``` -------------------------------- ### GET /email/templates - List templates with curl Source: https://mailopost.ru/api.html Retrieves a paginated list of email templates. The response includes total_count, total_pages, page_number, page_size, and a collection of template objects. ```bash curl -X GET https://api.mailopost.ru/v1/email/templates \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer $API_TOKEN' ``` ```json { "total_count":3, "total_pages":1, "page_number":1, "page_size":25, "collection":[ { "id":1, "name":"My Template" } ] } ``` -------------------------------- ### GET /email/messages_webhooks Source: https://mailopost.ru/api.html Retrieves a list of existing webhooks. Supports pagination. Returns a collection of webhook objects. ```APIDOC ## GET /email/messages_webhooks ### Description Retrieves a list of webhooks. Supports pagination via query parameters. ### Method GET ### Endpoint https://api.mailopost.ru/v1/email/messages_webhooks ### Parameters #### Query Parameters - **page_number** (integer) - Optional - Page number for pagination. Default is 1. - **page_size** (integer) - Optional - Number of items per page. Default is 25. ### Response #### Success Response (200) - **total_count** (integer) - Total number of webhooks. - **total_pages** (integer) - Total number of pages. - **page_number** (integer) - Current page number. - **page_size** (integer) - Items per page. - **collection** (array) - Array of webhook objects. - **id** (integer) - Identifier. - **title** (string) - Name. - **url** (string) - URL for sending webhooks. - **kinds** (array of strings) - Types of messages. - **events** (array of strings) - List of events. - **status** (string) - Status. #### Response Example { "total_count": 1, "total_pages": 1, "page_number": 1, "page_size": 25, "collection": [ { "id": 1, "url": "https://mysite.org/webhook", "events": ["delivered"], "kinds": ["api"], "status": "active", "title": "Api delivered webhooks" } ] } ``` -------------------------------- ### Получить организацию по ID: GET /email/organizations/:id Source: https://mailopost.ru/api.html Запрос информации об организации по её идентификатору (в примере — id=1) и успешный ответ сервера. Ответ содержит атрибуты id, name, address, country, city, phone, zip, current. ```bash curl -X GET https://api.mailopost.ru/v1/email/organizations/1 \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer $API_TOKEN' ``` ```json { "id":1, "name":"My Organization", "address":"Lenina 40", "country":"Russia", "city":"Tomsk", "phone":"+7-3822-123-456", "zip":"634000", "current":true } ``` -------------------------------- ### GET /email/balance Source: https://mailopost.ru/api.html Retrieves the current account balance and tariff details, including subscriber limits and expiration. This endpoint requires authentication via Bearer token. ```APIDOC ## GET /email/balance ### Description Retrieves the current account balance and tariff details, including subscriber limits and expiration. ### Method GET ### Endpoint https://api.mailopost.ru/v1/email/balance ### Parameters #### Headers - **Authorization** (string) - Required - Bearer token for authentication. - **Content-Type** (string) - Required - application/json. ### Request Example ``` curl -X GET https://api.mailopost.ru/v1/email/balance \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer $API_TOKEN' ``` ### Response #### Success Response (200) - **tariff.subscribers.total** (integer) - Total number of subscribers. - **tariff.subscribers.available** (integer) - Available number of subscribers. - **tariff.credits** (integer) - Number of email credits. - **tariff.expires_at** (integer) - Timestamp of tariff expiration. - **balance** (number) - Account balance amount. #### Response Example ``` { "tariff" : { "subscribers" : { "total" : 1000, "available" : 997 }, "credits" : 0, "expires_at" : 1629273060 }, "balance" : 12965.96 } ``` ``` -------------------------------- ### SMTP Send Message Source: https://mailopost.ru/api.html Sends an email message using SMTP with authentication. The example connects to the SMTP server smtp.msndr.net on port 587, authenticates with PLAIN, and sends the message. ```APIDOC ## SMTP Send Message ### Description Sends an email message using SMTP with authentication. The example connects to the SMTP server smtp.msndr.net on port 587, authenticates with PLAIN, and sends the message. ### Method SMTP ### Endpoint smtp.msndr.net:587 ### Parameters #### SMTP Configuration - **host** (string) - Required - SMTP server hostname (smtp.msndr.net). - **port** (integer) - Required - SMTP server port (587). - **username** (string) - Required - SMTP username for authentication. - **password** (string) - Required - SMTP password for authentication. - **from** (string) - Required - Sender email address. - **to** (string) - Required - Recipient email address. - **subject** (string) - Required - Email subject. - **message** (string) - Required - Email body. ### Request Example ```php 'smtp.msndr.net', 'port' => 587, 'username' => 'CHANGE_ME', 'password' => 'CHANGE_ME', 'from' => 'CHANGE_ME', 'to' => 'CHANGE_ME', 'subject' => 'Test Subject', 'message' => 'Test Message' ]; extract($smtp_config); $s = fsockopen($host, $port); if ($s) { fgets($s); fputs($s, "EHLO localhost\r\n"); while(fgets($s)){} $auth = base64_encode("\0" . $username . "\0" . $password); fputs($s, "AUTH PLAIN $auth\r\n"); if (strpos(fgets($s), '235') !== false) { fputs($s, "MAIL FROM: <$from>\r\n"); fgets($s); fputs($s, "RCPT TO: <$to>\r\n"); fgets($s); fputs($s, "DATA\r\n"); fgets($s); fputs($s, "Subject: $subject\r\n\r\n$message\r\n.\r\n"); echo "Result: " . fgets($s); } else { echo "Authentication failed"; } fputs($s, "QUIT\r\n"); fclose($s); } else { echo "Connection failed"; } ?> ``` ### Response #### Success Response Outputs the SMTP server response after sending the message. #### Response Example Not provided in the source. ``` -------------------------------- ### Search recipients by email (GET /email/recipients/search) Source: https://mailopost.ru/api.html Searches for a recipient by email to determine which groups (lists) they belong to. The request requires the email query parameter and a Bearer token. The success response includes a collection with the recipient's email and an array of lists with their IDs and titles. ```bash curl -X GET https://api.mailopost.ru/v1/email/recipients/search?email=foo@bar.com \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer $API_TOKEN' ``` ```json { "total_count": 2, "total_pages": 1, "page_number": 1, "page_size": 25, "collection": [ { "email": "foo@bar.com", "recipients": [ { "list_id": 1, "list_title": "List #1", "recipient_id": 1 }, { "list_id": 2, "list_title": "List #2", "recipient_id": 2 } ] } ], "query": "test" } ``` -------------------------------- ### Получение информации о сообщении: GET /email/messages/:id Source: https://mailopost.ru/api.html Запрос к API для получения информации о сообщении по его идентификатору и пример успешного ответа. В ответе возвращаются атрибуты сообщения (id, from_email, from_name, to, subject, text, html, status) и объект events с количеством событий open, redirect, spam и unsubscribe. ```bash curl -X GET https://api.mailopost.ru/v1/email/messages/1 \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer $API_TOKEN' \ -d '...JSON...' ``` ```json { "id":1, "from_email":"alice@example.org", "from_name":"Alice", "to":"bob@example.org", "subject":"Hello", "text":"Hello, Bob!", "html":"

Hello, Bob!

", "status":"queued", "events": { "open": 1, "redirect": { "http://foo.com": 2, "http://bar.com": 3 }, "spam": 1, "unsubscribe": 1 } } ``` -------------------------------- ### Get recipient group parameters with PHP cURL Source: https://mailopost.ru/api.html Fetches parameters for a specific recipient group by its list ID. Replace 'LIST ID' with the actual group identifier. Uses the same authentication and cURL setup as other Mailopost API examples. ```php Hello World", "text":"Hello World", "state":"sending", "recipients_count":10, "purchase":{ "enable":true, "subscribers":10, "credits":0, "deficit":0 }, "statistics":{ "delivered":1, "bounced":0, "delivering":0, "uniq_open":0, "total_open": 0, "last_open_at": nil, "uniq_click":0, "total_click": 0, "last_click_at": nil, "unsubscription":0, "spam":0 } } ``` -------------------------------- ### POST /email/templates Source: https://mailopost.ru/api.html Creates a new email template. The request must include from_email, subject, and html; optional fields include from_name, name, text, and preset_params. The response returns the created template with its id and status. ```APIDOC ## POST /email/templates ### Description Creates a new email template. The request must include from_email, subject, and html; optional fields include from_name, name, text, and preset_params. The response returns the created template with its id and status. ### Method POST ### Endpoint https://api.mailopost.ru/v1/email/templates ### Parameters #### Request Body - **from_email** (string) - Required - Sender address - **from_name** (string) - Optional - Sender name - **subject** (string) - Required - Email subject - **name** (string) - Optional - Template name - **text** (string) - Optional - Plain text content - **html** (string) - Required - HTML content - **preset_params** (array of strings) - Optional - Array of parameters for template substitution ### Request Example { "from_email": "hello@world.com", "subject": "Hello World", "text": "Hello World", "html": "

Hello World

", "preset_params": [ "name", "age" ] } ### Response #### Success Response (200) - **id** (integer) - Identifier - **from_email** (string) - Sender address - **from_name** (string or null) - Sender name - **subject** (string) - Email subject - **name** (string or null) - Template name - **html** (boolean) - Indicates HTML content presence - **text** (boolean) - Indicates text content presence - **state** (string) - Status (created as draft) - **preset_params** (array of strings) - Array of parameters for template substitution #### Response Example { "id": 1, "from_email": "hello@world.com", "from_name": null, "subject": "Hello World", "html": true, "text": true, "state": "draft", "preset_params": [ "name", "age" ] } ### Statuses - **draft** - Draft - **pending** - Under moderation - **active** - Moderation passed - **inactive** - Paused - **canceled** - Canceled ``` -------------------------------- ### JSON для запроса обновления получателя Source: https://mailopost.ru/api.html Пример JSON-тела запроса для обновления получателя. Позволяет изменить email, значения параметров (с возможностью удаления через destroy) и теги. ```json { "email":"alice@example.org", "values":[ { "parameter_id":"1", "value":"Alice" }, { "parameter_id":"2", "destroy":"true" } ], "tags":[ { "value":"buyer" }, { "value":"customer", "destroy":"true" } ] } ``` -------------------------------- ### GET /email/messages_webhooks/events Source: https://mailopost.ru/api.html Получить список доступных событий для вебхуков. ```APIDOC ## GET /email/messages_webhooks/events ### Description Получить список доступных событий для вебхуков. ### Method GET ### Endpoint https://api.mailopost.ru/v1/email/messages_webhooks/events ### Request Example curl -X GET https://api.mailopost.ru/v1/email/messages_webhooks/events \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer $API_TOKEN' ### Response #### Success Response (200) - **events** (array) - Список доступных событий. #### Response Example { "events": [ "delivered", "hard_bounced", "skipped", "opened", "clicked", "unsubscribed", "complained", "soft_bounced" ] } ``` -------------------------------- ### Пример запроса curl для создания шаблона Source: https://mailopost.ru/api.html Пример запроса создания шаблона с помощью curl. Использует POST на https://api.mailopost.ru/v1/email/templates с заголовками Content-Type и Authorization. В теле запроса подставляется JSON, описанный выше. ```bash curl -X POST https://api.mailopost.ru/v1/email/templates \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer $API_TOKEN' \ -d '...JSON...' ``` -------------------------------- ### GET /email/messages_webhooks/kinds Source: https://mailopost.ru/api.html Получить список доступных типов сообщений для вебхуков. ```APIDOC ## GET /email/messages_webhooks/kinds ### Description Получить список доступных типов сообщений для вебхуков. ### Method GET ### Endpoint https://api.mailopost.ru/v1/email/messages_webhooks/kinds ### Request Example curl -X GET https://api.mailopost.ru/v1/email/messages_webhooks/kinds \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer $API_TOKEN' ### Response #### Success Response (200) - **kinds** (array) - Список доступных типов сообщений. #### Response Example { "kinds": [ "campaign", "campaign_transactional", "campaign_workflow", "api" ] } ``` -------------------------------- ### curl-запрос для отправки email с вложениями Source: https://mailopost.ru/api.html Пример curl-запроса для отправки email с вложениями. Использует multipart/form-data (флаги -F), суммарный размер вложений не должен превышать 5 Мбайт. ```bash curl -X POST https://api.mailopost.ru/v1/email/messages \ -H 'Authorization: Bearer $API_TOKEN' \ -F from_email=from@example.com \ -F to=to@example.com \ -F subject='Mail with attachments' \ -F text='Hello world' \ -F attachments[]=@/path/to/file1 \ -F attachments[]=@/path/to/file2 \ -F smtp_headers[Client-Id]=123 ``` -------------------------------- ### GET /email/recipients/search Source: https://mailopost.ru/api.html Searches for a recipient by email address to determine which groups they are present in. ```APIDOC ## GET /email/recipients/search ### Description Searches for a recipient by email address to determine which groups they are present in. ### Method GET ### Endpoint https://api.mailopost.ru/v1/email/recipients/search ### Parameters #### Query Parameters - **email** (string) - Required - Искомый адрес ### Request Example curl -X GET https://api.mailopost.ru/v1/email/recipients/search?email=foo@bar.com -H 'Content-Type: application/json' -H 'Authorization: Bearer $API_TOKEN' ### Response #### Success Response (200) - **email** (string) - Email получателя - **recipients** (array) - Массив, содержащий информацию о списках, в которых найден получатель #### Response Example { "total_count": 2, "total_pages": 1, "page_number": 1, "page_size": 25, "collection": [ { "email": "foo@bar.com", "recipients": [ { "list_id": 1, "list_title": "List #1", "recipient_id": 1 }, { "list_id": 2, "list_title": "List #2", "recipient_id": 2 } ] } ], "query": "test" } ``` -------------------------------- ### Импорт получателей: пример запроса после окончания Source: https://mailopost.ru/api.html Пример запроса после окончания импорта, если указан callback_url. Статус 'completed' означает завершение импорта. ```json { "id":7, "status":"completed", "callback_url":"https://my-callback-url.com/some-secret" } ``` -------------------------------- ### GET /email/segments Source: https://mailopost.ru/api.html Retrieves a list of segments. Supports pagination with a maximum page_size of 1000. ```APIDOC ## GET /email/segments ### Description Retrieves a list of segments. Supports pagination with a maximum page_size of 1000. ### Method GET ### Endpoint https://api.mailopost.ru/v1/email/segments ### Request Example curl -X GET https://api.mailopost.ru/v1/email/segments -H 'Content-Type: application/json' -H 'Authorization: Bearer $API_TOKEN' ### Response #### Success Response (200) - **id** (integer) - Идентификатор сегмента - **title** (string) - Название сегмента #### Response Example { "total_count": 2, "total_pages": 1, "page_number": 1, "page_size": 25, "collection": [ { "id": 1, "title": "Segment Number One" } ] } ```