### Create Webhook using Axios (TypeScript) Source: https://rusender.ru/docs/api/public-webhooks-create Example of creating a webhook using the Axios library in TypeScript. Ensure you have Axios installed and replace '' with your actual Bearer token. ```typescript import axios, { type AxiosRequestConfig } from 'axios'; interface PublicApiRequestMetaDto { requestId?: string; } interface PublicApiRequestDto { data: Record; meta?: (PublicApiRequestMetaDto); } interface CreateWebhookDataDto { name: string; url: string; triggers: string[]; status?: "enabled" | "disabled"; } interface PublicApiPaginationMetaDto { page: number; limit: number; totalItems: number; totalPages: number; } interface PublicApiResponseMetaDto { requestId: string; timestamp: string; pagination?: (PublicApiPaginationMetaDto); } interface PublicApiSuccessResponseDto { ok: boolean; data: Record; meta: (PublicApiResponseMetaDto); } interface WebhookDto { id: number; name: string; url: string; triggers: string[]; status: "enabled" | "disabled"; createdAt: string; updatedAt: string; } const data: (PublicApiRequestDto & { data?: CreateWebhookDataDto; }) = { "data": { "name": "Delivery notifications", "url": "https://example.com/webhooks/rusender", "triggers": [ "mail_distribution.completed", "data_mail_distribution.delivered" ], "status": "enabled" }, "meta": { "requestId": "string" } }; const config: AxiosRequestConfig = { method: 'post', maxBodyLength: Infinity, url: 'https://api.rusender.ru/api/v1/public/webhooks', headers: { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Bearer ' }, data: JSON.stringify(data) }; async function makeRequest() { try { const response = await axios.request<(PublicApiSuccessResponseDto & { data?: WebhookDto; })>(config); console.log(JSON.stringify(response.data)); } catch (error: unknown) { console.log(error); } } makeRequest(); ``` -------------------------------- ### Successful API Response Example Source: https://rusender.ru/docs/api/public-templates-list This is an example of a successful API response, including metadata and pagination information. ```json { "ok": true, "meta": { "requestId": "550e8400-e29b-41d4-a716-446655440000", "timestamp": "2026-03-05T12:00:00.000Z", "pagination": { "page": 1, "limit": 20, "totalItems": 150, "totalPages": 8 } } } ``` -------------------------------- ### Successful Response Example Source: https://rusender.ru/docs/api/public-campaigns-list This example shows a successful response when listing public campaigns. It includes details about the campaign, sender, lists, and statistics. ```json { "id": 1, "name": "March newsletter", "subject": "Our March update", "previewTitle": "Here is what we shipped this month", "type": "regular", "status": "completed", "statusModerate": "approved", "folderId": 5, "attachments": [ { "id": 42, "fileName": "price-list.pdf", "size": 153204 } ], "templateId": 100, "senderId": 10, "senderEmail": "noreply@example.com", "senderName": "Example Team", "lists": [ { "id": 1, "name": "Newsletter subscribers" } ], "scheduledAt": "2026-03-05T10:00:00.000Z", "startedAt": "2026-03-05T10:01:00.000Z", "finishedAt": "2026-03-05T11:00:00.000Z", "createdAt": "2026-03-04T12:00:00.000Z", "updatedAt": "2026-03-05T11:00:00.000Z", "stats": { "total": 1000, "sending": { "count": 900, "rate": 90 }, "delivered": { "count": 900, "rate": 90 }, "open": { "count": 900, "rate": 90 }, "click": { "count": 900, "rate": 90 }, "error": { "count": 900, "rate": 90 }, "unsubscribe": { "count": 900, "rate": 90 }, "complaint": { "count": 900, "rate": 90 } } } ``` -------------------------------- ### Fetch Campaign Stats by Domains using Axios Source: https://rusender.ru/docs/api/public-campaigns-get-stats-by-domains This TypeScript example demonstrates how to make a GET request to the /public/campaigns/:campaignId/stats-by-domains endpoint using the Axios library. It includes type definitions for the request and response, and handles potential errors. ```typescript import axios, { type AxiosRequestConfig } from 'axios'; interface PublicApiPaginationMetaDto { page: number; limit: number; totalItems: number; totalPages: number; } interface PublicApiResponseMetaDto { requestId: string; timestamp: string; pagination?: (PublicApiPaginationMetaDto); } interface PublicApiSuccessResponseDto { ok: boolean; data: Record; meta: (PublicApiResponseMetaDto); } interface CampaignStatMetricDto { count: number; rate: number; } interface CampaignDomainStatDto { groupName: string; groupSlug?: Record; iconBase64?: Record; domain: string; total: number; open: (CampaignStatMetricDto); click: (CampaignStatMetricDto); error: (CampaignStatMetricDto); unsubscribe: (CampaignStatMetricDto); } interface CampaignDomainStatsListDataDto { items: CampaignDomainStatDto[]; } const config: AxiosRequestConfig = { method: 'get', maxBodyLength: Infinity, url: 'https://api.rusender.ru/api/v1/public/campaigns/:campaignId/stats-by-domains', headers: { 'Accept': 'application/json', 'Authorization': 'Bearer ' } }; async function makeRequest() { try { const response = await axios.request<(PublicApiSuccessResponseDto & { data?: CampaignDomainStatsListDataDto; })>(config); console.log(JSON.stringify(response.data)); } catch (error: unknown) { console.log(error); } } makeRequest(); ``` -------------------------------- ### Import Contacts Request Example Source: https://rusender.ru/docs/api/public-lists-contacts-import This example demonstrates how to import contacts into a list. It includes contact details like email, name, phone, and optional variables. Ensure unknown variable keys are declared in the 'variables' specification for auto-creation. ```json { "data": { "rows": [ { "email": "john@example.com", "name": "John Doe", "phone": "+79001234567", "variables": { "city": "Moscow" } } ], "variables": [ { "key": "city", "name": "City", "type": "string" } ], "updateExisting": false }, "meta": { "requestId": "some-request-id" } } ``` -------------------------------- ### Send Email by Template Request Example Source: https://rusender.ru/docs/api/public-external-mail-send-by-template This example demonstrates the structure of a POST request to send an email using a template. It includes path parameters, headers, and the request body with recipient, sender, subject, template ID, and parameters. ```HTTP POST /api/v1/external-mails/send-by-template/:key_id HTTP/1.1 Host: api.rusender.ru Content-Type: application/json Idempotency-Key: your-idempotency-key Authorization: Bearer YOUR_PUBLIC_API_TOKEN { "mail": { "to": { "email": "recipient@example.com", "name": "Recipient Name" }, "from": { "email": "sender@example.com", "name": "Sender Name" }, "subject": "Your Subject Here", "previewTitle": "Preview Text", "headers": { "cc": "cc@example.com", "bcc": "bcc@example.com" }, "attachments": [ { "id": "attachment_id_1" } ] }, "idTemplateMailUser": 12345, "params": { "param1": "value1", "param2": "value2" } } ``` -------------------------------- ### Create Segment Request Body Example Source: https://rusender.ru/docs/api/public-segments-create This example demonstrates the structure of the JSON request body for creating a segment. It includes the segment name, condition logic, and a sample condition for filtering by email. ```json { "data": { "name": "VIP контакты", "applyConditionsType": "and", "conditions": [ { "field": "contactEmail", "operator": "equal", "value": "vip@example.com" } ] } } ``` -------------------------------- ### GET /v1/public/templates Source: https://rusender.ru/docs/openapi.json Retrieves a list of available templates. ```APIDOC ## GET /v1/public/templates ### Description Retrieves a list of available templates. ### Method GET ### Endpoint /v1/public/templates ### Parameters #### Query Parameters - **limit** (integer) - Optional - The maximum number of templates to return. - **offset** (integer) - Optional - The number of templates to skip before returning results. ### Response #### Success Response (200) - **templates** (array) - A list of template objects. - Each template object contains: - **id** (string) - The unique identifier of the template. - **name** (string) - The name of the template. - **type** (string) - The type of the template (e.g., 'email', 'sms'). #### Response Example ```json { "templates": [ { "id": "template-abc", "name": "Welcome Email", "type": "email" }, { "id": "template-xyz", "name": "Password Reset SMS", "type": "sms" } ] } ``` ``` -------------------------------- ### Get Webhooks Source: https://rusender.ru/docs/openapi.json Retrieves a list of configured webhooks. ```APIDOC ## GET /webhooks ### Description Retrieves a list of configured webhooks. ### Method GET ### Endpoint /webhooks ### Response #### Success Response (200) - **items** (array) - An array of WebhookDto objects. #### Response Example { "items": [ { "id": "wh_abc123", "url": "https://example.com/webhook", "events": ["delivered", "opened", "clicked"], "createdAt": "2026-02-01T10:00:00.000Z" } ] } ``` -------------------------------- ### Invalid API Token Error Example Source: https://rusender.ru/docs/api/public-campaigns-list This example illustrates an 'Invalid API Token' error response, returned when the provided API token is missing or invalid. It includes error codes, messages, and metadata. ```json { "ok": false, "error": { "code": "INVALID_API_TOKEN", "message": "API token is missing or invalid.", "details": [] }, "meta": { "requestId": "550e8400-e29b-41d4-a716-446655440000", "timestamp": "2026-03-05T12:00:00.000Z", "pagination": { "page": 1, "limit": 20, "totalItems": 150, "totalPages": 8 } } } ``` -------------------------------- ### Get Domains Source: https://rusender.ru/docs/openapi.json Retrieves a list of sender domains. ```APIDOC ## GET /domains ### Description Retrieves a list of sender domains. ### Method GET ### Endpoint /domains ### Response #### Success Response (200) - **items** (array) - An array of DomainDto objects. #### Response Example { "items": [ { "id": 5, "name": "example.com", "status": "enabled", "isVerified": true, "dnsRecords": { "dkim": { "name": "selector1._domainkey.example.com", "type": "TXT", "value": "v=DKIM1; k=rsa; p=..." }, "spf": { "name": "example.com", "type": "TXT", "value": "v=spf1 include:mailgun.org ~all" } }, "checkedAt": "2026-03-01T14:00:00.000Z" } ] } ``` -------------------------------- ### Get Templates Source: https://rusender.ru/docs/openapi.json Retrieves a list of available email templates. Supports filtering and pagination. ```APIDOC ## GET /templates ### Description Retrieves a list of available email templates. Supports filtering and pagination. ### Method GET ### Endpoint /templates ### Parameters #### Query Parameters - **limit** (integer) - Optional - Maximum number of templates to return. - **offset** (integer) - Optional - Number of templates to skip before starting to collect the result set. - **type** (string) - Optional - Filter templates by type (e.g., 'transactional', 'promotional'). ### Response #### Success Response (200) - **items** (array) - An array of TemplateDto objects. - **total** (integer) - The total number of templates available. #### Response Example { "items": [ { "id": "tpl_12345", "name": "Welcome Email", "type": "transactional", "html": "

Welcome!

", "text": "Welcome!", "thumbnail": "https://cdn.example.com/thumb/100.png", "createdAt": "2026-01-15T10:30:00.000Z", "updatedAt": "2026-03-01T14:00:00.000Z" } ], "total": 1 } ``` -------------------------------- ### GET /variables Source: https://rusender.ru/docs/openapi.json Retrieves a list of variables. This endpoint is used to fetch all available variables within the system. ```APIDOC ## GET /variables ### Description Retrieves a list of variables. This endpoint is used to fetch all available variables within the system. ### Method GET ### Endpoint /variables ### Parameters #### Query Parameters - **list_id** (string) - Required - Уникальный идентификатор списка. ### Responses #### Success Response (200) - **data** (VariablesListDataDto) - Variables data. #### Error Response - **error** (object) - Error details. - **code** (string) - Error code. - **message** (string) - Error message. ``` -------------------------------- ### Get Lists Source: https://rusender.ru/docs/openapi.json Retrieves a list of all contact lists. Supports filtering by creation date and pagination. ```APIDOC ## GET /lists ### Description Retrieves a list of all contact lists. Supports filtering by creation date and pagination. ### Method GET ### Endpoint /lists ### Parameters #### Query Parameters - **filter[createdAt][gt]** (string) - Optional - Filter lists created after a specific date (ISO 8601 format). - **filter[createdAt][lt]** (string) - Optional - Filter lists created before a specific date (ISO 8601 format). - **page[number]** (integer) - Optional - The page number to retrieve. - **page[size]** (integer) - Optional - The number of items per page. ### Response #### Success Response (200) - **data** (array of ListDto) - An array of contact lists. - **meta** (object) - Metadata about the pagination. #### Error Response - **400** - Bad Request: The request is invalid or malformed. - **401** - Unauthorized: The API key is missing or invalid. - **403** - Forbidden: The API key is not authorized to perform this action. - **429** - Too Many Requests: Rate limit exceeded for the current API key. - **500** - Internal Server Error: An unexpected error occurred on the server. ``` -------------------------------- ### Get Domain Info Source: https://rusender.ru/docs/openapi.json Retrieves information about a specific domain. This endpoint allows users to fetch details related to a domain, including its associated data. ```APIDOC ## GET /domains/{domain} ### Description Retrieves information about a specific domain. ### Method GET ### Endpoint /domains/{domain} ### Parameters #### Path Parameters - **domain** (string) - Required - The domain name to retrieve information for. ### Response #### Success Response (200) - **data** (DomainDto) - Information about the domain. #### Response Example ```json { "data": { "example": "domain data" } } ``` #### Error Responses - **400** - Bad Request: The request was invalid. - **401** - Unauthorized: Invalid API token. - **403** - Forbidden: Missing required scope. - **404** - Not Found: The requested resource was not found. - **422** - Unprocessable Entity: The request could not be processed. ``` -------------------------------- ### Domain Not Found Error Response Source: https://rusender.ru/docs/api/public-domains-get-by-id Example of a DOMAIN_NOT_FOUND error, indicating that the requested resource could not be found. This response is typically returned for GET requests when the specified ID does not exist. ```json { "ok": false, "error": { "code": "DOMAIN_NOT_FOUND", "message": "The requested resource was not found.", "details": [ { "field": "string", "reason": "string", "value": {} } ] }, "meta": { "requestId": "550e8400-e29b-41d4-a716-446655440000", "timestamp": "2026-03-05T12:00:00.000Z", "pagination": { "page": 1, "limit": 20, "totalItems": 150, "totalPages": 8 } } } ``` -------------------------------- ### Multiple Attachments Format Example Source: https://rusender.ru/docs/sending/attachments Shows how to include multiple files in the 'attachments' array, ensuring each file has a unique name within the email. ```json "attachments": [ { "receipt.pdf": "JVBERi0x..." }, { "invoice.pdf": "JVBERi0x..." }, { "logo.png": "iVBORw0K..." } ] ``` -------------------------------- ### Get Public List by ID using Axios Source: https://rusender.ru/docs/api/public-lists-get-by-id This snippet demonstrates how to fetch a public list by its ID using the Axios library in TypeScript. Ensure you have Axios installed and replace `` with your actual API token. ```typescript import axios, { type AxiosRequestConfig } from 'axios'; interface PublicApiPaginationMetaDto { page: number; limit: number; totalItems: number; totalPages: number; } interface PublicApiResponseMetaDto { requestId: string; timestamp: string; pagination?: (PublicApiPaginationMetaDto); } interface PublicApiSuccessResponseDto { ok: boolean; data: Record; meta: (PublicApiResponseMetaDto); } interface ListDto { id: number; name: string; status: "enabled" | "disabled"; contactsCount: number; createdAt: string; updatedAt: string; } const config: AxiosRequestConfig = { method: 'get', maxBodyLength: Infinity, url: 'https://api.rusender.ru/api/v1/public/lists/:listId', headers: { 'Accept': 'application/json', 'Authorization': 'Bearer ' } }; async function makeRequest() { try { const response = await axios.request<(PublicApiSuccessResponseDto & { data?: ListDto; })>(config); console.log(JSON.stringify(response.data)); } catch (error: unknown) { console.log(error); } } makeRequest(); ``` -------------------------------- ### Get Public Contact by ID using Axios Source: https://rusender.ru/docs/api/public-contacts-get-by-id This snippet demonstrates how to fetch a single contact's details using the Axios library in TypeScript. Ensure you have Axios installed and replace `` with your actual API token. ```typescript import axios, { type AxiosRequestConfig } from 'axios'; interface PublicApiPaginationMetaDto { page: number; limit: number; totalItems: number; totalPages: number; } interface PublicApiResponseMetaDto { requestId: string; timestamp: string; pagination?: (PublicApiPaginationMetaDto); } interface PublicApiSuccessResponseDto { ok: boolean; data: Record; meta: (PublicApiResponseMetaDto); } interface ContactListDto { id: number; name: string; } interface ContactDto { id: number; email: string; name?: string; phone?: string; status: "new" | "active" | "unsubscribed" | "unsubscribed_by_us" | "soft_bounced" | "hard_bounced" | "error" | "complaint"; listIds: number[]; lists?: ContactListDto[]; variables?: Record; createdAt: string; updatedAt: string; lastActivityAt?: string; } const config: AxiosRequestConfig = { method: 'get', maxBodyLength: Infinity, url: 'https://api.rusender.ru/api/v1/public/contacts/:contactId', headers: { 'Accept': 'application/json', 'Authorization': 'Bearer ' } }; async function makeRequest() { try { const response = await axios.request<(PublicApiSuccessResponseDto & { data?: ContactDto; })>(config); console.log(JSON.stringify(response.data)); } catch (error: unknown) { console.log(error); } } makeRequest(); ``` -------------------------------- ### Get Public Template by ID using Axios (TypeScript) Source: https://rusender.ru/docs/api/public-templates-get-by-id This snippet demonstrates how to fetch a specific public template by its ID using the Axios library in TypeScript. Ensure you have Axios installed and replace `` with your actual authorization token. ```typescript import axios, { type AxiosRequestConfig } from 'axios'; interface PublicApiPaginationMetaDto { page: number; limit: number; totalItems: number; totalPages: number; } interface PublicApiResponseMetaDto { requestId: string; timestamp: string; pagination?: (PublicApiPaginationMetaDto); } interface PublicApiSuccessResponseDto { ok: boolean; data: Record; meta: (PublicApiResponseMetaDto); } interface TemplateDto { id: number; name: string; type: "html"; html: string; text?: string; thumbnail?: string; createdAt: string; updatedAt: string; } const config: AxiosRequestConfig = { method: 'get', maxBodyLength: Infinity, url: 'https://api.rusender.ru/api/v1/public/templates/:templateId', headers: { 'Accept': 'application/json', 'Authorization': 'Bearer ' } }; async function makeRequest() { try { const response = await axios.request<(PublicApiSuccessResponseDto & { data?: TemplateDto; })>(config); console.log(JSON.stringify(response.data)); } catch (error: unknown) { console.log(error); } } makeRequest(); ``` -------------------------------- ### Get External Mail Key by ID using TypeScript and Axios Source: https://rusender.ru/docs/api/public-external-mail-keys-get-by-id This snippet demonstrates how to fetch an external mail key by its ID using TypeScript and the Axios library. Ensure you have Axios installed and replace '' with your actual Bearer token. ```typescript import axios, { type AxiosRequestConfig } from 'axios'; interface PublicApiPaginationMetaDto { page: number; limit: number; totalItems: number; totalPages: number; } interface PublicApiResponseMetaDto { requestId: string; timestamp: string; pagination?: (PublicApiPaginationMetaDto); } interface PublicApiSuccessResponseDto { ok: boolean; data: Record; meta: (PublicApiResponseMetaDto); } interface ExternalMailKeyDomainDto { id: number; name: string; isVerified: boolean; } interface ExternalMailKeyDto { id: number; name: string; status: "enabled" | "disabled" | "banned" | "error"; isThrottled: boolean; partOfToken: string | null; domain: (ExternalMailKeyDomainDto); createdAt: string; updatedAt: string; } const config: AxiosRequestConfig = { method: 'get', maxBodyLength: Infinity, url: 'https://api.rusender.ru/api/v1/public/external-mails/keys/:keyId', headers: { 'Accept': 'application/json', 'Authorization': 'Bearer ' } }; async function makeRequest() { try { const response = await axios.request<(PublicApiSuccessResponseDto & { data?: ExternalMailKeyDto; })>(config); console.log(JSON.stringify(response.data)); } catch (error: unknown) { console.log(error); } } makeRequest(); ``` -------------------------------- ### List Webhooks - Success Response Source: https://rusender.ru/docs/api/public-webhooks-list This example shows a successful response when listing webhooks. It includes details of the webhooks and pagination metadata. ```json { "ok": true, "data": { "items": [ { "id": 42, "name": "Delivery notifications", "url": "https://example.com/webhooks/rusender", "triggers": [ "mail_distribution.completed", "data_mail_distribution.delivered" ], "status": "enabled", "createdAt": "2026-01-15T10:30:00.000Z", "updatedAt": "2026-03-01T14:00:00.000Z" } ] }, "meta": { "requestId": "550e8400-e29b-41d4-a716-446655440000", "timestamp": "2026-03-05T12:00:00.000Z", "pagination": { "page": 1, "limit": 20, "totalItems": 150, "totalPages": 8 } } } ``` -------------------------------- ### GET Request to List Webhooks Source: https://rusender.ru/docs/api/public-webhooks-list Use this GET request to retrieve a list of webhooks associated with the user. Requires the 'webhooks.read' permission. ```http GET https://api.rusender.ru/api/v1/public/webhooks ``` -------------------------------- ### Example cURL Request Source: https://rusender.ru/docs/intro This snippet demonstrates how to make a basic authenticated request to the RuSender API using cURL. ```APIDOC ## GET /api/v1/public/lists ### Description This is an example endpoint to demonstrate API usage. It likely retrieves a list of available lists. ### Method GET ### Endpoint /api/v1/public/lists ### Parameters #### Query Parameters None explicitly mentioned in the example. #### Headers - **Authorization** (string) - Required - Bearer token for authentication. ### Request Example ```bash curl https://api.rusender.ru/api/v1/public/lists \ -H "Authorization: Bearer $API_TOKEN" ``` ### Response #### Success Response (200) This endpoint is expected to return a JSON envelope containing a 'data' field with a list of resources. ```json { "ok": true, "data": [ ... ], "meta": { "requestId": "550e8400-e29b-41d4-a716-446655440000" } } ``` #### Response Example (Specific example not provided in source, but follows the general envelope structure.) ``` -------------------------------- ### Making Authenticated API Request in Go Source: https://rusender.ru/docs/auth This Go code demonstrates how to set the Authorization header for API requests. It retrieves the API token from environment variables. ```go package main import ( "net/http" "os" ) func main() { req, _ := http.NewRequest("GET", "https://api.rusender.ru/api/v1/public/lists", nil) req.Header.Set("Authorization", "Bearer "+os.Getenv("API_TOKEN")) resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() } ``` -------------------------------- ### List External Mail Keys with Axios (TypeScript) Source: https://rusender.ru/docs/api/public-external-mail-keys-list Demonstrates how to fetch a list of external mail keys using the Axios library in TypeScript. Ensure you replace `` with your actual Bearer token. ```typescript import axios, { type AxiosRequestConfig } from 'axios'; interface PublicApiPaginationMetaDto { page: number; limit: number; totalItems: number; totalPages: number; } interface PublicApiResponseMetaDto { requestId: string; timestamp: string; pagination?: (PublicApiPaginationMetaDto); } interface PublicApiSuccessResponseDto { ok: boolean; data: Record; meta: (PublicApiResponseMetaDto); } interface ExternalMailKeyDomainDto { id: number; name: string; isVerified: boolean; } interface ExternalMailKeyDto { id: number; name: string; status: "enabled" | "disabled" | "banned" | "error"; isThrottled: boolean; partOfToken: string | null; domain: (ExternalMailKeyDomainDto); createdAt: string; updatedAt: string; } interface ExternalMailKeysListDataDto { items: ExternalMailKeyDto[]; } const config: AxiosRequestConfig = { method: 'get', maxBodyLength: Infinity, url: 'https://api.rusender.ru/api/v1/public/external-mails/keys', headers: { 'Accept': 'application/json', 'Authorization': 'Bearer ' } }; async function makeRequest() { try { const response = await axios.request<(PublicApiSuccessResponseDto & { data?: ExternalMailKeysListDataDto; })>(config); console.log(JSON.stringify(response.data)); } catch (error: unknown) { console.log(error); } } makeRequest(); ``` -------------------------------- ### Get Public Segment by ID Source: https://rusender.ru/docs/api/public-segments-get-by-id Retrieves a public segment by its ID. This is a GET request that returns the segment's details if found, or an error if not. ```APIDOC ## GET /segments/{id} ### Description Retrieves a public segment by its unique identifier. ### Method GET ### Endpoint `/segments/{id}` ### Parameters #### Path Parameters - **id** (number) - Required - The unique identifier of the segment. ### Response #### Success Response (200) - **ok** (boolean) - Flag indicating successful execution. - **data** (object) - Payload of the successful response. - **id** (number) - The segment's identifier. - **name** (string) - The segment's name. - **applyConditionsType** (string) - Logic for combining conditions (`and` or `or`). - **conditions** (object[]) - List of segment conditions. - **id** (number) - The condition's identifier. - **field** (string) - The field to filter by (e.g., `contactEmail`). Possible values: [`contactName`, `contactEmail`, `contactPhone`, `contactStatus`, `contactDateCreatedAt`, `contactInList`, `activeInCampaign`, `variable`]. - **variableId** (number) - ID of the variable (only if `field = variable`). - **operator** (string) - Comparison operator (e.g., `equal`, `contain`). Possible values: [`equal`, `notEqual`, `contain`, `notContain`, `thereIs`, `missing`, `participated`, `notParticipated`, `opened`, `notOpened`, `clicked`, `notClicked`, `before`, `after`, `findInList`, `notFindInList`]. - **value** (string) - Value for comparison (not required for `thereIs`/`missing` operators). - **createdAt** (string) - Time of creation (ISO 8601). - **updatedAt** (string) - Time of update (ISO 8601). - **meta** (object) - Metadata of the successful response. - **requestId** (string) - The final request identifier used by the server. - **timestamp** (string) - The response formation time in ISO-8601 format. - **pagination** (object) - Pagination metadata for list/search responses. - **page** (number) - Current page. - **limit** (number) - Number of items per page. - **totalItems** (number) - Total number of items. - **totalPages** (number) - Total number of pages. #### Error Response (400, 401, 403, 404, 422, 429, 500) - **ok** (boolean) - Flag indicating unsuccessful execution. - **error** (object) - Error structure. - **code** (string) - Machine-readable error code. - **message** (string) - Human-readable error message. - **details** (object[]) - Error details, if available. - **field** (string) - The field related to the error. - **reason** (string) - The reason for the error. - **value** (object) - The value that caused the error. - **meta** (object) - Metadata of the error response. - **requestId** (string) - The final request identifier used by the server. - **timestamp** (string) - The response formation time in ISO-8601 format. - **pagination** (object) - Pagination metadata for list/search responses. ### Request Example ```json { "id": 17 } ``` ### Response Example (200 OK) ```json { "ok": true, "data": { "id": 17, "name": "VIP контакты", "applyConditionsType": "and", "conditions": [ { "id": 101, "field": "contactEmail", "variableId": 42, "operator": "equal", "value": "vip@example.com" } ], "createdAt": "2026-04-01T12:00:00.000Z", "updatedAt": "2026-04-20T09:30:00.000Z" }, "meta": { "requestId": "550e8400-e29b-41d4-a716-446655440000", "timestamp": "2026-03-05T12:00:00.000Z", "pagination": { "page": 1, "limit": 20, "totalItems": 150, "totalPages": 8 } } } ``` ### Response Example (Error) ```json { "ok": false, "error": { "code": "BAD_REQUEST", "message": "Запрос не прошёл валидацию.", "details": [ { "field": "string", "reason": "string", "value": {} } ] }, "meta": { "requestId": "550e8400-e29b-41d4-a716-446655440000", "timestamp": "2026-03-05T12:00:00.000Z", "pagination": { "page": 1, "limit": 20, "totalItems": 150, "totalPages": 8 } } } ``` ``` -------------------------------- ### GET Request to Retrieve Public List by ID Source: https://rusender.ru/docs/api/public-lists-get-by-id Use this endpoint to get a public contact list by its ID. Ensure you have the 'contacts.read' permission. ```http GET https://api.rusender.ru/api/v1/public/lists/:listId ``` -------------------------------- ### Attachment Format Example Source: https://rusender.ru/docs/sending/attachments Illustrates the JSON structure for the 'attachments' field, where each object represents a single file with its base64 encoded content. ```json "attachments": [ {"receipt.pdf": "JVBERi0xLjQK..."}, {"logo.png": "iVBORw0go..."} ] ``` -------------------------------- ### GET Request for Public Domains Source: https://rusender.ru/docs/api/public-domains-list Use this GET request to retrieve a list of user domains with DNS records. Requires the 'domains.read' permission. ```http GET ## https://api.rusender.ru/api/v1/public/domains ``` -------------------------------- ### Get List Statistics Source: https://rusender.ru/docs/openapi.json Retrieves statistics for a specified contact list. This endpoint allows you to get an overview of the contacts within a particular list. ```APIDOC ## GET /v1/public/lists/{listId}/statistics ### Description Returns statistics for the specified list. This endpoint provides contact statistics for a given list. ### Method GET ### Endpoint /v1/public/lists/{listId}/statistics ### Parameters #### Path Parameters - **listId** (integer) - Required - Unique identifier of the list. ### Responses #### Success Response (200) - **data** (ListStatisticsDto) - Statistics for the list. #### Error Response (400) - **error.code** (string) - Example: BAD_REQUEST - Message: The request did not pass validation. #### Error Response (401) - **error.code** (string) - Example: INVALID_API_TOKEN - Message: API token is missing or invalid. #### Error Response (403) - **error.code** (string) - Example: FORBIDDEN - Message: The authenticated user is not allowed to perform this action. ```