# Get automation action detail
Source: https://docs.ecomail.cz/api-reference/automations/get-action-detail
GET https://api2.ecomailapp.cz/pipelines/{id}/actions/{actionId}
Retrieve detail of a specific action (node) within a given automation.
**id** `integer` *required*
Automation ID.
**actionId** `string` *required*
Action ID.
The response carries `next` with the ids of the node's follow-up nodes — an array of node ids on most node types, or an object with one array per output port on branching node types (`yes` / `no` on a `check` node, the variant keys on a `split` node, `default` / `quarantine_skip` on a `mail` node).
```bash cURL theme={null}
curl "https://api2.ecomailapp.cz/pipelines/42/actions/abc-123" \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$pipelineId = 42;
$actionId = 'abc-123';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/pipelines/{$pipelineId}/actions/{$actionId}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"data": {
"id": "abc-123",
"type": "mail",
"properties": {
"name": "Welcome email",
"template": 42
},
"next": ["def-456"]
}
}
```
```json 404 theme={null}
{
"message": "Action not found"
}
```
### Action types
| Type | Description |
| - | - |
| `mail` | Send an email. |
| `sms` | Send an SMS. |
| `wait` | Wait for a specified duration. |
| `check` | Conditional branch (if/else). |
| `split` | A/B split test. |
| `tag` | Add a tag to the subscriber. |
| `untag` | Remove a tag from the subscriber. |
| `subscribe` | Subscribe to a list. |
| `unsubscribe` | Unsubscribe from a list. |
| `edit` | Edit subscriber fields. |
| `webhook` | Send a webhook. |
| `trigger` | Trigger another automation. |
| `goal` | Goal (wait for condition). |
| `end` | End of automation. |
| `note` | Internal note. |
# Get automation actions
Source: https://docs.ecomail.cz/api-reference/automations/get-actions
GET https://api2.ecomailapp.cz/pipelines/{id}/actions
Retrieve all actions (nodes) within a given automation.
**id** `integer` *required*
Automation ID.
Each node carries `next` with the ids of its follow-up nodes, so the response describes the full automation graph:
* On most node types `next` is an array of node ids — usually one id, empty or `null` at the end of a branch.
* On branching node types `next` is an object with one array of node ids per output port — `yes` / `no` on a `check` node, the variant keys on a `split` node, and `default` / `quarantine_skip` on a `mail` node.
```bash cURL theme={null}
curl "https://api2.ecomailapp.cz/pipelines/42/actions" \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$pipelineId = 42;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/pipelines/{$pipelineId}/actions");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"data": [
{
"id": "abc-123",
"type": "mail",
"properties": {
"name": "Welcome email",
"template": 42
},
"next": ["def-456"]
},
{
"id": "def-456",
"type": "check",
"properties": {
"name": "Opened the welcome email?"
},
"next": {
"yes": ["ghi-789"],
"no": []
}
},
{
"id": "ghi-789",
"type": "tag",
"properties": {
"tag": "engaged"
},
"next": []
}
]
}
```
### Action types
| Type | Description |
| - | - |
| `mail` | Send an email. |
| `sms` | Send an SMS. |
| `wait` | Wait for a specified duration. |
| `check` | Conditional branch (if/else). |
| `split` | A/B split test. |
| `tag` | Add a tag to the subscriber. |
| `untag` | Remove a tag from the subscriber. |
| `subscribe` | Subscribe to a list. |
| `unsubscribe` | Unsubscribe from a list. |
| `edit` | Edit subscriber fields. |
| `webhook` | Send a webhook. |
| `trigger` | Trigger another automation. |
| `goal` | Goal (wait for condition). |
| `end` | End of automation. |
| `note` | Internal note. |
# Get automation stats
Source: https://docs.ecomail.cz/api-reference/automations/get-stats
GET https://api2.ecomailapp.cz/pipelines/{pipeline_id}/stats
Retrieve aggregate statistics for a specific automation.
**pipeline\_id** `integer` *required*
Automation ID.
**from\_date** `string`
Filter statistics from this date onwards (`YYYY-MM-DD`, UTC). Cannot be more than one year in the past.
**to\_date** `string`
Filter statistics up to this date (`YYYY-MM-DD`, UTC). Must be after `from_date`.
When a date range is supplied (`from_date` and/or `to_date`), the response includes three additional fields alongside the lifetime totals:
* `open_in_range` — opens that occurred within the selected period.
* `click_in_range` — clicks that occurred within the selected period.
* `inject_in_range` — e-mails injected (sent) within the selected period.
```bash cURL theme={null}
curl https://api2.ecomailapp.cz/pipelines/1/stats \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/pipelines/1/stats');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"stats": {
"triggered": 1,
"ended": 1,
"open": 0,
"open_rate": 0,
"total_open": 0,
"prefetched": 0,
"proxy": 0,
"machine_open": 0,
"total_user_open": 0,
"not_opened": 2,
"send": 2,
"click": 1,
"total_click": 4,
"click_rate": 50,
"inject": 2,
"soft_bounce": 0,
"hard_bounce": 0,
"bounce": 0,
"bounce_rate": 0,
"conversions": 0,
"conversions_value": 0,
"spam": 0,
"unsub": 0,
"delivery_rate": 100
}
}
```
```json 200 (with date range) theme={null}
{
"stats": {
"triggered": 1,
"ended": 1,
"open": 0,
"open_rate": 0,
"total_open": 0,
"not_opened": 2,
"send": 2,
"click": 1,
"total_click": 4,
"click_rate": 50,
"inject": 2,
"soft_bounce": 0,
"hard_bounce": 0,
"bounce": 0,
"bounce_rate": 0,
"conversions": 0,
"conversions_value": 0,
"spam": 0,
"unsub": 0,
"delivery_rate": 100,
"open_in_range": 1,
"click_in_range": 1,
"inject_in_range": 2
}
}
```
# Get automation stats detail
Source: https://docs.ecomail.cz/api-reference/automations/get-stats-detail
GET https://api2.ecomailapp.cz/pipelines/{pipeline_id}/stats-detail
Return statistics for a specific automation with each subscriber and their individual events.
**pipeline\_id** `integer` *required*
Automation ID.
**event** `string`
Filter by event type. One of: `open`, `send`, `unsub`, `soft_bounce`, `click`, `hard_bounce`, `out_of_band`, `spam`.
**email** `string`
Filter by subscriber email address.
**from\_date** `string`
Filter events from this date onwards in `YYYY-MM-DD` format (UTC). Cannot be more than one year in the past. If you omit it, it defaults to the date one year ago.
**to\_date** `string`
Filter events up to this date in `YYYY-MM-DD` format (UTC). Must be after `from_date`.
**detail** `string`
Set to `true` to return each individual event per subscriber instead of aggregated per-event counts. In detail mode every event row also carries the automation mail it belongs to — `action_id` and the resolved `mail_name` (see [Get actions](/api-reference/automations/get-actions)).
**per\_page** `integer`
Number of results per page. Default and maximum is `100`.
**page** `integer`
Page number.
The `total` field returns the total number of subscribers that entered the automation. The `open`, `click`, and `send` fields return unique counts.
> [!NOTE]
>
> This endpoint returns events from the last year only. If you omit `from_date`, the results start one year ago. A `to_date` older than that returns no subscribers.
```bash cURL theme={null}
curl "https://api2.ecomailapp.cz/pipelines/12345/stats-detail?per_page=100&page=1" \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/pipelines/12345/stats-detail?per_page=100&page=1');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"next_page_url": "https://api2.ecomailapp.cz/pipelines/12345/stats-detail?page=2",
"total": 2546,
"per_page": 100,
"subscribers": {
"foo@bar.com": {
"open": 2,
"send": 3,
"unsub": 0,
"soft_bounce": 0,
"click": 0,
"hard_bounce": 0,
"out_of_band": 0,
"spam": 0
}
}
}
```
```json 200 (detail=true) theme={null}
{
"next_page_url": null,
"total": 3,
"per_page": 100,
"subscribers": {
"foo@bar.com": [
{
"url": "",
"event": "open",
"occured_at": "2026-03-22 10:15:03",
"action_id": "a1b2c3d4e5",
"mail_name": "Welcome email"
}
]
}
}
```
# List all automations
Source: https://docs.ecomail.cz/api-reference/automations/list-all
GET https://api2.ecomailapp.cz/pipelines
Retrieve all automations in your account.
```bash cURL theme={null}
curl https://api2.ecomailapp.cz/pipelines \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/pipelines');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
[
{
"id": 1,
"name": "Pipeline name",
"list_id": 1,
"created_at": "2020-09-08 22:04:03",
"updated_at": "2021-04-03 20:04:04"
}
]
```
# Trigger automation
Source: https://docs.ecomail.cz/api-reference/automations/trigger
POST https://api2.ecomailapp.cz/pipelines/{pipeline_id}/trigger
Run a specific automation for the given email/subscriber.
**pipeline\_id** `integer` *required*
Automation ID.
**email** `string` *required*
Subscriber's email address.
```bash cURL theme={null}
curl -X POST https://api2.ecomailapp.cz/pipelines/1/trigger \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"email": "foo@bar.cz"
}'
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/pipelines/1/trigger');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'email' => 'foo@bar.cz',
]));
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"email": "foo@bar.cz"
}
```
# Add new campaign
Source: https://docs.ecomail.cz/api-reference/campaigns/add-new
POST https://api2.ecomailapp.cz/campaigns
Create a new campaign.
For list segments selection instead of a whole recipient list, use `"recepient_lists": {"segments": [{"id": "segment_id", "list": 14}]}`.
Segment IDs can be obtained from the [Show list detail](/api-reference/lists/show) endpoint.
Once smart delivery is set on a campaign, the response returns `recepient_lists` in the segments format, with the smart delivery settings inside the first segment. The segments format stays after you turn smart delivery off. Read the settings from the top-level `smart_delivery` field instead.
**title** `string` *required*
Campaign title. Maximum 255 characters.
**from\_name** `string`
Sender's name. Maximum 150 characters.
**from\_email** `string`
Sender's email address.
**reply\_to** `string`
Reply-to email address.
**subject** `string`
Campaign subject line. Maximum 255 characters.
**html\_text** `string`
HTML content of the campaign. When you send it, it must not be empty.
**recepient\_lists** `array|object`
Array of list IDs or an object with segments. See the example above for the segments format.
**campaign\_type** `string` (default: email)
Campaign type. Allowed values: `email`, `sms`, `whatsapp`, `push_notification`. Your account must have the channel enabled, otherwise the request fails with `403`.
**smart\_delivery** `object`
Smart delivery settings of the campaign. Smart delivery skips subscribers who would receive too many emails.
Send either `sending_policy_id`, or the manual limits. When you send `sending_policy_id`, the manual limits are ignored.
When you omit `smart_delivery`, the campaign gets the default sending policy of your account.
Send `null` or `{"sending_policy_id": "unlimited"}` to turn smart delivery off.
**smart\_delivery properties**
**smart\_delivery\[sending\_policy\_id]** `string`
ID of a sending policy usable for campaigns. Use `standard` or `unlimited` for the system policies, or the ID of a custom policy from **Account settings** → **Settings** → **Sending rules**.
**smart\_delivery\[priority\_window\_hours]** `integer`
Skip a subscriber who received an email in the last N hours. Allowed range: `0`–`24`. Requires `priority_scope`.
**smart\_delivery\[priority\_scope]** `string`
Which emails count for `priority_window_hours`. Allowed values: `all`, `campaigns`, `pipelines_all` (automations only).
**smart\_delivery\[frequency\_cap\_email\_count]** `integer`
Maximum number of emails a subscriber can receive in `frequency_cap_email_days` days. Allowed range: `1`–`50`. Send it together with `frequency_cap_email_days` and `frequency_cap_email_scope`.
**smart\_delivery\[frequency\_cap\_email\_days]** `integer`
Length of the frequency cap period in days. Allowed range: `1`–`7`.
**smart\_delivery\[frequency\_cap\_email\_scope]** `string`
Which emails count for the frequency cap. Allowed values: `all`, `campaigns`, `pipelines_all` (automations only).
```bash cURL theme={null}
curl -X POST https://api2.ecomailapp.cz/campaigns \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Campaign title",
"from_name": "Senders name",
"from_email": "test@ecomailapp.cz",
"reply_to": "test@ecomailapp.cz",
"subject": "New campaign subject",
"html_text": "HTML content of new campaign",
"recepient_lists": [1],
"smart_delivery": {
"priority_window_hours": 12,
"priority_scope": "all",
"frequency_cap_email_count": 3,
"frequency_cap_email_days": 7,
"frequency_cap_email_scope": "campaigns"
}
}'
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/campaigns');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'title' => 'Campaign title',
'from_name' => 'Senders name',
'from_email' => 'test@ecomailapp.cz',
'reply_to' => 'test@ecomailapp.cz',
'subject' => 'New campaign subject',
'html_text' => 'HTML content of new campaign',
'recepient_lists' => [1],
'smart_delivery' => [
'priority_window_hours' => 12,
'priority_scope' => 'all',
'frequency_cap_email_count' => 3,
'frequency_cap_email_days' => 7,
'frequency_cap_email_scope' => 'campaigns',
],
]));
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"id": 712,
"title": "Campaign title",
"from_name": "Senders name",
"from_email": "test@ecomailapp.cz",
"reply_to": "test@ecomailapp.cz",
"subject": "New campaign subject",
"recepient_lists": {
"segments": [
{
"id": "cid_712",
"query": "entire_list",
"smart_delivery": {
"priority_window_hours": 12,
"priority_scope": "all",
"frequency_cap_email_count": 3,
"frequency_cap_email_days": 7,
"frequency_cap_email_scope": "campaigns"
},
"list": 1
}
]
},
"template_type": "html",
"campaign_type": "email",
"updated_at": "2023-06-14T10:16:16.112614Z",
"created_at": "2023-06-14T10:16:16.000000Z",
"archive_url": "https://foo.ecomailapp.cz/campaigns/render/712/randomhashhere",
"smart_delivery": {
"priority_window_hours": 12,
"priority_scope": "all",
"frequency_cap_email_count": 3,
"frequency_cap_email_days": 7,
"frequency_cap_email_scope": "campaigns"
}
}
```
```json 403 theme={null}
{
"errors": ["cant create campaign of type sms"]
}
```
```json 422 theme={null}
{
"errors": {
"smart_delivery.priority_scope": ["The smart delivery.priority scope field is required when smart delivery.priority window hours is present."]
}
}
```
# Get campaign detail
Source: https://docs.ecomail.cz/api-reference/campaigns/get-detail
GET https://api2.ecomailapp.cz/campaigns/{campaign_id}
Returns detailed campaign information including statistics for sent campaigns.
**campaign\_id** `integer` *required*
Campaign ID.
The `smart_delivery` field returns the smart delivery settings of the campaign:
* `{"sending_policy_id": "..."}` when the campaign uses a sending policy,
* the manual limits (`priority_window_hours`, `priority_scope`, `frequency_cap_email_count`, `frequency_cap_email_days`, `frequency_cap_email_scope`) when they are set on the campaign,
* `null` when smart delivery is off.
See [Add new campaign](/api-reference/campaigns/add-new) for the meaning of each field.
```bash cURL theme={null}
curl https://api2.ecomailapp.cz/campaigns/1 \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$campaignId = 1;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/campaigns/{$campaignId}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"id": 1,
"from_name": "From name",
"from_email": "from@foo.cz",
"reply_to": "reply@bar.cz",
"title": "My first campaign",
"subject": "First hello",
"recepient_lists": {
"segments": [
{
"id": "segment_abc123",
"list": 1,
"smart_delivery": {
"sending_policy_id": "standard"
}
}
]
},
"smart_delivery": {
"sending_policy_id": "standard"
},
"sent_at": "2025-01-10 08:30:00",
"recipients": 100,
"status": 3,
"archive_url": "https://foo.ecomailapp.cz/campaigns/render/1/randomhashhere",
"stats": {
"inject": 100,
"send": 99,
"delivered": 99,
"open": 40,
"total_open": 45,
"prefetched": 8,
"proxy": 3,
"machine_open": 9,
"total_user_open": 36,
"click": 12,
"total_click": 15,
"hard_bounce": 1,
"spam": 0,
"unsub": 2,
"openrate": 40.4,
"clickrate": 12.12,
"delivery_rate": 99
}
}
```
# Get campaign log
Source: https://docs.ecomail.cz/api-reference/campaigns/get-log
GET https://api2.ecomailapp.cz/campaigns/{campaignId}/log
Search and browse the campaign log — sends, opens, clicks, bounces, unsubscribes, complaints, and other events. Filter by subscriber email, event types, and date range.
**email** `string`
Filter by subscriber email address.
**events\[]** `string`
Filter by event types. Can be specified multiple times. Possible values: `send`, `open`, `click`, `bounce`, `hard_bounce`, `soft_bounce`, `out_of_band`, `unsub`, `spam`, `spam_complaint`, `not_opened`, `not_clicked`, `open_no_click`, `sms_sent`, `sms_inv_nr`, `sms_accepted`, `whatsapp_sent`, `whatsapp_failed`.
**date\_from** `string`
Filter events from this date (inclusive, ISO format e.g. `2025-01-01`).
**date\_to** `string`
Filter events up to this date (inclusive, ISO format e.g. `2025-12-31`). Must be after `date_from` if provided.
**per\_page** `integer`
Number of results per page. Default `20`, maximum `100`.
**page** `integer`
Page number.
**sort\_by** `string`
Column to sort by. Possible values: `occured_at`, `id`, `event`. Default `occured_at`.
**sort\_dir** `string`
Sort direction. Possible values: `asc`, `desc`. Default `desc`.
```bash cURL theme={null}
curl "https://api2.ecomailapp.cz/campaigns/1/log?email=foo@bar.cz&per_page=10&events[]=open&events[]=click" \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/campaigns/1/log?email=foo@bar.cz&per_page=10&events[]=open&events[]=click");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"campaign_log": [
{
"id": 5678,
"campaign_id": 1,
"autoresponder_id": null,
"action_id": null,
"event": "open",
"msg": null,
"url": null,
"email": "foo@bar.cz",
"occured_at": "2025-03-15T14:30:00.000000Z",
"mail_name": null
},
{
"id": 5677,
"campaign_id": 1,
"autoresponder_id": null,
"action_id": null,
"event": "click",
"msg": null,
"url": "https://example.com/offer",
"email": "foo@bar.cz",
"occured_at": "2025-03-15T14:25:00.000000Z",
"mail_name": null
}
],
"current_page": 1,
"per_page": 10,
"total": 2,
"last_page": 1
}
```
# Get segment stats
Source: https://docs.ecomail.cz/api-reference/campaigns/get-segment-stats
GET https://api2.ecomailapp.cz/campaigns/segment/{segmentId}/stats
Retrieves performance statistics for a specific segment across all campaigns it was sent to.
**segmentId** `string` *required*
Segment ID. Can be retrieved from the [Show list detail](/api-reference/lists/show) endpoint.
```bash cURL theme={null}
curl https://api2.ecomailapp.cz/campaigns/segment/5c36008811e45/stats \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$segmentId = '5c36008811e45';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/campaigns/segment/{$segmentId}/stats");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"stats": {
"810": {
"bounce": 0,
"bounce_rate": 0,
"click": 3,
"click_rate": 75,
"conversions": 2,
"conversions_value": 2500,
"delivery": 4,
"delivery_rate": 100,
"inject": 4,
"open": 4,
"open_rate": 100,
"prefetched": 0,
"proxy": 0,
"machine_open": 0,
"total_user_open": 4,
"spam": 0,
"spam_rate": 0,
"unsub": 1,
"unsub_rate": 25
}
}
}
```
# Get campaign stats
Source: https://docs.ecomail.cz/api-reference/campaigns/get-stats
GET https://api2.ecomailapp.cz/campaigns/{campaign_id}/stats
Returns aggregated statistics for a specific campaign.
**campaign\_id** `integer` *required*
Campaign ID.
**from\_date** `string`
Filter statistics from this date onwards (`YYYY-MM-DD`, UTC). Cannot be more than one year in the past.
**to\_date** `string`
Filter statistics up to this date (`YYYY-MM-DD`, UTC). Must be after `from_date`.
When a date range is supplied (`from_date` and/or `to_date`), the response includes two additional fields alongside the lifetime totals:
* `opened_in_range` — unique opens that occurred within the selected period.
* `clicked_in_range` — unique clicks that occurred within the selected period.
```bash cURL theme={null}
curl https://api2.ecomailapp.cz/campaigns/1/stats \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$campaignId = 1;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/campaigns/{$campaignId}/stats");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"stats": {
"inject": 10,
"delivery": 10,
"delivery_rate": 97,
"open": 5,
"total_open": 10,
"open_rate": 10,
"prefetched": 3,
"proxy": 1,
"machine_open": 3,
"total_user_open": 7,
"click": 2,
"total_click": 4,
"click_rate": 4,
"bounce": 3,
"bounce_rate": 3,
"spam": 1,
"spam_rate": 0.01,
"unsub": 1,
"unsub_rate": 1,
"conversions": 0,
"conversions_value": 0
}
}
```
```json 200 (with date range) theme={null}
{
"stats": {
"inject": 10,
"delivery": 10,
"delivery_rate": 97,
"open": 5,
"total_open": 10,
"open_rate": 10,
"click": 2,
"total_click": 4,
"click_rate": 4,
"bounce": 3,
"bounce_rate": 3,
"spam": 1,
"spam_rate": 0.01,
"unsub": 1,
"unsub_rate": 1,
"conversions": 0,
"conversions_value": 0,
"opened_in_range": 3,
"clicked_in_range": 1
}
}
```
# Get campaign stats detail
Source: https://docs.ecomail.cz/api-reference/campaigns/get-stats-detail
GET https://api2.ecomailapp.cz/campaigns/{id}/stats-detail
Returns statistics for a specific campaign with each subscriber and their individual events.
**id** `integer` *required*
Campaign ID.
**event** `string`
Filter by event type: `open`, `send`, `unsub`, `soft_bounce`, `click`, `hard_bounce`, `out_of_band`, `spam`.
**email** `string`
Filter by subscriber email.
**from\_date** `string`
Filter events from this date onwards (`YYYY-MM-DD` in UTC). Cannot be more than one year in the past.
**to\_date** `string`
Filter events up to this date (`YYYY-MM-DD` in UTC). Must be after `from_date`.
**detail** `string`
Set to `true` to return each individual event per subscriber (with `event`, `url` and `occured_at`) instead of aggregated per-event counts.
**per\_page** `integer`
Results per page. Maximum and default is `100`.
**page** `integer`
Page number.
The `total` field returns the total number of subscribers the campaign was targeted at.
The `open`, `click`, and `send` fields return unique counts — not total events, which can include one subscriber many times.
```bash cURL theme={null}
curl https://api2.ecomailapp.cz/campaigns/12345/stats-detail \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$campaignId = 12345;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/campaigns/{$campaignId}/stats-detail");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"next_page_url": "https://api2.ecomailapp.cz/campaigns/12345/stats-detail?page=2",
"total": 4256,
"per_page": 100,
"subscribers": {
"foo@bar.com": {
"open": 2,
"send": 1,
"unsub": 0,
"soft_bounce": 0,
"click": 1,
"hard_bounce": 0,
"out_of_band": 0,
"spam": 0
}
}
}
```
```json 200 (detail=true) theme={null}
{
"next_page_url": null,
"total": 3,
"per_page": 100,
"subscribers": {
"foo@bar.com": [
{
"url": "https://example.com/landing",
"event": "click",
"occured_at": "2026-03-22 10:15:03"
}
]
}
}
```
# List all campaigns
Source: https://docs.ecomail.cz/api-reference/campaigns/list-all
GET https://api2.ecomailapp.cz/campaigns
Returns all campaigns with pagination and filtering.
> [!NOTE]
>
> **Campaign status codes:**
>
> * `0` — Draft
> * `1` — Preparing
> * `2` — Sending
> * `3` — Sent
> * `4` — Errored
> * `7` — Scheduled
Each campaign carries a `smart_delivery` field with its smart delivery settings, in the same format as [Get campaign detail](/api-reference/campaigns/get-detail).
**per\_page** `integer`
Number of items per page.
**filters\[title]** `string`
Filter by campaign title.
**filters\[subject]** `string`
Filter by campaign subject.
**filters\[status]** `integer`
Filter by campaign status code.
**filters\[updated\_at]** `string`
Filter by updated date (`YYYY-MM-DD`).
**filters\[date\_from]** `string`
Filter from date (`YYYY-MM-DD`).
**filters\[date\_to]** `string`
Filter to date (`YYYY-MM-DD`).
**filters\[id]** `integer`
Filter by campaign ID.
**sort\_by** `string` (default: id)
Column to sort results by. Allowed values: `id`, `sent_at`, `changed_at`, `title`, `status`.
**sort\_dir** `string` (default: desc)
Sort direction. Allowed values: `asc`, `desc`.
```bash cURL theme={null}
curl 'https://api2.ecomailapp.cz/campaigns?sort_by=sent_at&sort_dir=desc' \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/campaigns?sort_by=sent_at&sort_dir=desc');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
[
{
"id": 1,
"from_name": "From name",
"from_email": "from@foo.cz",
"reply_to": "reply@bar.cz",
"title": "My first campaign",
"subject": "First hello",
"sent_at": "2014-09-08 22:04:03",
"recipients": 1,
"status": 3,
"scheduled_at": null,
"template_id": 62,
"recepient_lists": [1],
"smart_delivery": null,
"archive_url": "https://foo.ecomailapp.cz/campaigns/render/1/randomhashhere"
}
]
```
# Send campaign
Source: https://docs.ecomail.cz/api-reference/campaigns/send
POST https://api2.ecomailapp.cz/campaigns/{campaign_id}/send
Puts the campaign in the sending queue immediately.
> [!WARNING]
>
> This action is irreversible. Only campaigns in draft status can be sent.
**campaign\_id** `integer` *required*
Campaign ID.
```bash cURL theme={null}
curl -X POST https://api2.ecomailapp.cz/campaigns/1/send \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$campaignId = 1;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/campaigns/{$campaignId}/send");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
[
{
"id": 1,
"title": "My first campaign",
"from_name": "From name",
"from_email": "from@foo.cz",
"reply_to": "reply@bar.cz",
"subject": "First hello",
"recepient_lists": [1, 2],
"template_type": "html",
"campaign_type": "email"
}
]
```
# Send test campaign
Source: https://docs.ecomail.cz/api-reference/campaigns/send-test
POST https://api2.ecomailapp.cz/campaigns/{campaign_id}/send-test
Sends a test version of a draft campaign to up to 5 recipients.
> [!NOTE]
>
> Only campaigns in draft status can be tested. The test send is rate limited per account.
**campaign\_id** `integer` *required*
Campaign ID.
**emails** `array` *required*
Recipients of the test email. At least 1 and at most 5 email addresses.
**merge** `object`
Optional map of merge-tag values used to personalize the test email. Keys are merge-tag names, values are their replacements; empty values are ignored.
```bash cURL theme={null}
curl -X POST https://api2.ecomailapp.cz/campaigns/1/send-test \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"emails": ["test@foo.cz", "qa@foo.cz"],
"merge": {
"first_name": "Foo"
}
}'
```
```php PHP theme={null}
$campaignId = 1;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/campaigns/{$campaignId}/send-test");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'emails' => ['test@foo.cz', 'qa@foo.cz'],
'merge' => [
'first_name' => 'Foo',
],
]));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"campaign_id": 1,
"sent_emails_count": 2
}
```
```json 403 theme={null}
{
"errors": ["You can not do this because you have a blocked account"]
}
```
```json 409 theme={null}
{
"errors": ["Only draft campaigns can be tested."]
}
```
```json 422 theme={null}
{
"errors": {
"emails": ["The emails field is required."]
}
}
```
```json 429 theme={null}
{
"errors": ["You have exceeded daily limit of sent test emails of 50."]
}
```
# Update campaign
Source: https://docs.ecomail.cz/api-reference/campaigns/update
PUT https://api2.ecomailapp.cz/campaigns/{campaign_id}
Update an existing campaign.
Only the fields you send are changed. Read-only fields such as `status`, `sent_at`, or `created_at` are ignored.
Once smart delivery is set on a campaign, the response returns `recepient_lists` in the segments format, with the smart delivery settings inside the first segment. The segments format stays after you turn smart delivery off. You can send this value back unchanged. Read the settings from the top-level `smart_delivery` field.
**campaign\_id** `integer` *required*
Campaign ID.
**title** `string` *required*
Campaign title. Maximum 255 characters.
**from\_name** `string`
Sender's name. Maximum 150 characters. Send `null` to clear it.
**from\_email** `string`
Sender's email address.
**reply\_to** `string`
Reply-to email address.
**subject** `string`
Campaign subject line. Maximum 255 characters. Send `null` to clear it.
**preheader** `string`
Preheader text shown after the subject line in the inbox. Maximum 255 characters. Send `null` to clear it.
**ga** `string`
Google Analytics campaign name. Send `null` to clear it.
**html\_text** `string`
HTML content of the campaign. When you send it, it must not be empty.
**template\_id** `integer`
ID of a template to copy into the campaign. The template content replaces the campaign content. When you send the ID of the template the campaign already uses, the campaign content stays unchanged.
**recepient\_lists** `array|object`
Array of list IDs or an object with segments. The current smart delivery settings of the campaign are kept.
**campaign\_type** `string`
Campaign type. Allowed values: `email`, `sms`, `whatsapp`, `push_notification`. Your account must have the channel enabled, otherwise the request fails with `403`.
**smart\_delivery** `object`
Smart delivery settings of the campaign. Smart delivery skips subscribers who would receive too many emails.
Send either `sending_policy_id`, or the manual limits. When you send `sending_policy_id`, the manual limits are ignored.
When you omit `smart_delivery`, the current settings stay unchanged.
Send `null` or `{"sending_policy_id": "unlimited"}` to turn smart delivery off.
**smart\_delivery properties**
**smart\_delivery\[sending\_policy\_id]** `string`
ID of a sending policy usable for campaigns. Use `standard` or `unlimited` for the system policies, or the ID of a custom policy from **Account settings** → **Settings** → **Sending rules**.
**smart\_delivery\[priority\_window\_hours]** `integer`
Skip a subscriber who received an email in the last N hours. Allowed range: `0`–`24`. Requires `priority_scope`.
**smart\_delivery\[priority\_scope]** `string`
Which emails count for `priority_window_hours`. Allowed values: `all`, `campaigns`, `pipelines_all` (automations only).
**smart\_delivery\[frequency\_cap\_email\_count]** `integer`
Maximum number of emails a subscriber can receive in `frequency_cap_email_days` days. Allowed range: `1`–`50`. Send it together with `frequency_cap_email_days` and `frequency_cap_email_scope`.
**smart\_delivery\[frequency\_cap\_email\_days]** `integer`
Length of the frequency cap period in days. Allowed range: `1`–`7`.
**smart\_delivery\[frequency\_cap\_email\_scope]** `string`
Which emails count for the frequency cap. Allowed values: `all`, `campaigns`, `pipelines_all` (automations only).
```bash cURL theme={null}
curl -X PUT https://api2.ecomailapp.cz/campaigns/1 \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Campaign title",
"from_name": "Senders name",
"from_email": "test@ecomailapp.cz",
"reply_to": "test@ecomailapp.cz",
"subject": "New campaign subject",
"html_text": "HTML content of new campaign",
"recepient_lists": [1, 2],
"smart_delivery": {
"sending_policy_id": "standard"
}
}'
```
```php PHP theme={null}
$campaignId = 1;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/campaigns/{$campaignId}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'title' => 'Campaign title',
'from_name' => 'Senders name',
'from_email' => 'test@ecomailapp.cz',
'reply_to' => 'test@ecomailapp.cz',
'subject' => 'New campaign subject',
'html_text' => 'HTML content of new campaign',
'recepient_lists' => [1, 2],
'smart_delivery' => [
'sending_policy_id' => 'standard',
],
]));
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"id": 1,
"title": "Campaign title",
"from_name": "Senders name",
"from_email": "test@ecomailapp.cz",
"reply_to": "test@ecomailapp.cz",
"subject": "New campaign subject",
"recepient_lists": {
"segments": [
{
"id": "cid_1",
"query": "entire_list",
"smart_delivery": {
"sending_policy_id": "standard"
},
"lists": [1, 2]
}
]
},
"template_type": "html",
"campaign_type": "email",
"updated_at": "2025-01-10T08:30:00.000000Z",
"created_at": "2025-01-09 14:12:05",
"archive_url": "https://foo.ecomailapp.cz/campaigns/render/1/randomhashhere",
"smart_delivery": {
"sending_policy_id": "standard"
}
}
```
```json 403 theme={null}
{
"errors": ["cant create campaign of type sms"]
}
```
```json 422 theme={null}
{
"errors": {
"smart_delivery.sending_policy_id": ["Sending policy not found."]
}
}
```
# Delete discount coupons
Source: https://docs.ecomail.cz/api-reference/coupons/delete
DELETE https://api2.ecomailapp.cz/coupons/delete
Delete discount coupons from a default or specific folder.
**folderId** `integer`
Folder ID. If not provided, coupons are deleted from the default folder.
**codes** `array` *required*
Array of coupon code strings to delete.
```bash cURL theme={null}
curl -X DELETE https://api2.ecomailapp.cz/coupons/delete \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"folderId": 1,
"codes": ["code1", "code2", "code3", "code4"]
}'
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/coupons/delete');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'folderId' => 1,
'codes' => ['code1', 'code2', 'code3', 'code4'],
]));
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"deleted": 4,
"invalid": 0
}
```
# List coupon folders
Source: https://docs.ecomail.cz/api-reference/coupons/folders
GET https://api2.ecomailapp.cz/coupons/folders
Retrieve every coupon folder with the number of coupons that can still be sent and the number of expired unused coupons.
> [!NOTE]
>
> Use `remaining` to top up a folder through `POST /coupons/import` before it runs out. `expired` coupons can no longer be sent and a daily job deletes them, so `remaining + expired` matches the remaining count shown on the Coupons page in the app until that job runs.
The default folder is always listed first, also when the account has no coupons yet. The other folders follow in ascending order of `id`. A folder without coupons is listed with zeros.
**folders** `object[]`
All coupon folders of the account.
**folder properties**
**id** `integer | null`
Folder ID, the same value as `folderId` in `POST /coupons/import`. The default folder has `null`, because coupons are imported into it when `folderId` is not provided.
**name** `string`
Folder name as stored in the account. The default folder is named `default`. The name is not translated.
**is\_default** `boolean`
Whether the folder is the default folder.
**remaining** `integer`
Number of unused coupons that can still be sent: coupons without `valid_until`, or with `valid_until` today or later. A coupon that expires today is counted here.
**expired** `integer`
Number of unused coupons whose `valid_until` is earlier than today and that are not deleted yet.
> [!NOTE]
>
> Coupons imported with `folderId` set to the ID of the default folder are counted in the default folder (`"id": null`) together with the coupons imported without `folderId`. For the default folder, `remaining + expired` can therefore be higher than the number on the Coupons page.
```bash cURL theme={null}
curl https://api2.ecomailapp.cz/coupons/folders \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/coupons/folders');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"folders": [
{
"id": null,
"name": "default",
"is_default": true,
"remaining": 120,
"expired": 4
},
{
"id": 12,
"name": "Black Friday",
"is_default": false,
"remaining": 0,
"expired": 0
}
]
}
```
```json 401 theme={null}
{
"message": "Wrong api key"
}
```
# Import discount coupons
Source: https://docs.ecomail.cz/api-reference/coupons/import
POST https://api2.ecomailapp.cz/coupons/import
Import discount coupons into a default or specific folder.
> [!NOTE]
>
> A code that already exists in the target folder is skipped and counted in `duplicated`. Its stored fields do not change. To overwrite existing coupons, use `PUT /coupons/import`.
**folderId** `integer`
Folder ID. If not provided, coupons are imported into the default folder.
**codes** `array` *required*
Array of coupon code strings, up to 50,000 codes. Each code can have up to 255 characters.
**valid\_until** `string`
Expiration date in `YYYY-MM-DD` format.
**type** `string`
Discount type: `percentual` or `fixed`. Required when `value` is set.
**value** `number`
Discount value, greater than `0`. The maximum is `100` for `percentual` and `99999999.99` for `fixed`. Required when `type` is set.
**currency** `string`
Three-letter currency code, for example `CZK`. Required when `type` is `fixed` or when `min_spend` is set.
**min\_spend** `number`
Minimum order value, from `0` to `99999999.99`.
**shipping\_price** `string`
Shipping rule of the discount: `cart`, `free`, or `beforeDiscount`.
**update\_existing** `boolean` *deprecated* (default: false)
Deprecated. Use `PUT /coupons/import` instead. When `true`, only `valid_until` of the existing coupons is updated and the updated coupons are counted in both `duplicated` and `updated`. The request fails with `422` when `update_existing` is combined with `type`, `value`, `currency`, `min_spend`, or `shipping_price`.
```bash cURL theme={null}
curl -X POST https://api2.ecomailapp.cz/coupons/import \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"folderId": 1,
"codes": ["code1", "code2", "code3", "code4"],
"valid_until": "2025-12-31",
"type": "percentual",
"value": 15,
"currency": "CZK",
"min_spend": 1000,
"shipping_price": "free"
}'
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/coupons/import');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'folderId' => 1,
'codes' => ['code1', 'code2', 'code3', 'code4'],
'valid_until' => '2025-12-31',
'type' => 'percentual',
'value' => 15,
'currency' => 'CZK',
'min_spend' => 1000,
'shipping_price' => 'free',
]));
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"imported": 4,
"duplicated": 0,
"updated": 0,
"totalCount": 4
}
```
```json 422 theme={null}
{
"errors": {
"update_existing": ["The update_existing flag cannot be combined with discount metadata. Use PUT /coupons/import to overwrite existing coupons."]
}
}
```
# Create or overwrite discount coupons
Source: https://docs.ecomail.cz/api-reference/coupons/put-import
PUT https://api2.ecomailapp.cz/coupons/import
Create new discount coupons and overwrite existing ones in a default or specific folder.
> [!NOTE]
>
> An existing coupon is overwritten completely. The request sets `valid_until`, `type`, `value`, `currency`, `min_spend`, and `shipping_price` exactly as sent. A field that is missing or `null` is cleared. The coupon code and its usage state never change.
**folderId** `integer`
Folder ID. If not provided, coupons are created and overwritten in the default folder.
**codes** `array` *required*
Array of coupon code strings, up to 50,000 codes. Each code can have up to 255 characters.
**valid\_until** `string`
Expiration date in `YYYY-MM-DD` format.
**type** `string`
Discount type: `percentual` or `fixed`. Required when `value` is set.
**value** `number`
Discount value, greater than `0`. The maximum is `100` for `percentual` and `99999999.99` for `fixed`. Required when `type` is set.
**currency** `string`
Three-letter currency code, for example `CZK`. Required when `type` is `fixed` or when `min_spend` is set.
**min\_spend** `number`
Minimum order value, from `0` to `99999999.99`.
**shipping\_price** `string`
Shipping rule of the discount: `cart`, `free`, or `beforeDiscount`.
```bash cURL theme={null}
curl -X PUT https://api2.ecomailapp.cz/coupons/import \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"folderId": 1,
"codes": ["code1", "code2", "code3", "code4"],
"valid_until": "2025-12-31",
"type": "fixed",
"value": 200,
"currency": "CZK",
"min_spend": 1000,
"shipping_price": "cart"
}'
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/coupons/import');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'folderId' => 1,
'codes' => ['code1', 'code2', 'code3', 'code4'],
'valid_until' => '2025-12-31',
'type' => 'fixed',
'value' => 200,
'currency' => 'CZK',
'min_spend' => 1000,
'shipping_price' => 'cart',
]));
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"imported": 1,
"duplicated": 0,
"updated": 3,
"totalCount": 4
}
```
```json 422 theme={null}
{
"errors": {
"currency": ["The currency field is required when type is fixed."]
}
}
```
# Create a new domain
Source: https://docs.ecomail.cz/api-reference/domains/create
POST https://api2.ecomailapp.cz/domains
Add a new domain to your account.
**name** `string` *required*
Domain name.
**type** `string` (default: sending)
Which variant to create — `sending` or `transactional`. One domain name can be held as both variants at the
same time, and each of them is created separately. Omit the field to create a sending domain.
```bash cURL theme={null}
curl -X POST https://api2.ecomailapp.cz/domains \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "newdomain.cz"
}'
```
```bash cURL (transactional) theme={null}
curl -X POST https://api2.ecomailapp.cz/domains \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "newdomain.cz",
"type": "transactional"
}'
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/domains');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'name' => 'newdomain.cz',
]));
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"name": "newdomain.cz",
"valid": 0
}
```
```json 422 Domain exists theme={null}
{
"error": "Domain already exists.",
"domain": "newdomain.cz"
}
```
```json 422 Freemail domain theme={null}
{
"error": "Freemail domain is not allowed.",
"domain": "newdomain.cz"
}
```
```json 422 Invalid domain theme={null}
{
"error": "Invalid URL address"
}
```
```json 422 Invalid type theme={null}
{
"errors": {
"type": ["type contains invalid value."]
}
}
```
# Delete a domain
Source: https://docs.ecomail.cz/api-reference/domains/delete
DELETE https://api2.ecomailapp.cz/domains/{domain}
Remove a domain from your account.
**domain** `string` *required*
Domain name.
**type** `string`
Which variant to delete — `sending` or `transactional`. Omit it while the account holds the name under a
single variant; that one is deleted whichever type it is.
> [!WARNING]
>
> One domain name can be held as both a sending and a transactional domain. When the account holds both and the
> request carries no `type`, nothing is deleted and the API answers `409 Conflict` — repeat the request with
> `?type=sending` or `?type=transactional` to pick the variant.
```bash cURL theme={null}
curl -X DELETE https://api2.ecomailapp.cz/domains/foo.cz \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```bash cURL (pick the variant) theme={null}
curl -X DELETE "https://api2.ecomailapp.cz/domains/foo.cz?type=transactional" \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/domains/foo.cz');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"name": "foo.cz",
"valid": true,
"blocked": false
}
```
```json 409 theme={null}
{
"error": "Domain exists as both a sending and a transactional domain, specify which type to delete.",
"domain": "foo.cz"
}
```
```json 422 Invalid type theme={null}
{
"errors": {
"type": ["type contains invalid value."]
}
}
```
# List all domains
Source: https://docs.ecomail.cz/api-reference/domains/list-all
GET https://api2.ecomailapp.cz/domains
Retrieve all domains in your account.
```bash cURL theme={null}
curl https://api2.ecomailapp.cz/domains \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/domains');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
**name** `string`
Domain name. A name held as both a sending and a transactional domain is listed once per variant.
**valid** `boolean`
Whether the domain passed verification.
**blocked** `boolean`
Whether sending from the domain is blocked.
**type** `string`
Variant of the domain — `sending` or `transactional`.
```json 200 theme={null}
[
{
"name": "foo.cz",
"valid": true,
"blocked": false,
"type": "sending"
},
{
"name": "foo.cz",
"valid": true,
"blocked": false,
"type": "transactional"
},
{
"name": "bar.cz",
"valid": false,
"blocked": false,
"type": "sending"
}
]
```
# List all feeds
Source: https://docs.ecomail.cz/api-reference/feeds/list-all
GET https://api2.ecomailapp.cz/feeds
Retrieve all product feeds in your account.
Returns the product feeds of your account. Use the `id` values as `feed_id` for the [refresh endpoint](/api-reference/feeds/refresh-product). Data feeds are not included.
**feeds** `array`
List of product feeds.
**Feed object**
**id** `integer`
Feed ID.
**type** `string`
Feed format, for example `heureka`, `google`, or `zbozi`.
**url** `string`
Source URL of the feed.
**products\_count** `integer | null`
Number of products loaded from the feed.
**error** `string | null`
Error from the last feed processing, or `null` when the feed is healthy.
**created\_at** `string`
When the feed was created, formatted as `Y-m-d H:i:s`.
**updated\_at** `string`
When the feed was last updated, formatted as `Y-m-d H:i:s`.
```bash cURL theme={null}
curl https://api2.ecomailapp.cz/feeds \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/feeds');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"feeds": [
{
"id": 1,
"type": "heureka",
"url": "https://www.example.com/feed.xml",
"products_count": 250,
"error": null,
"created_at": "2026-08-01 10:00:00",
"updated_at": "2026-08-31 06:30:00"
}
]
}
```
# Refresh data feed
Source: https://docs.ecomail.cz/api-reference/feeds/refresh-data
GET https://api2.ecomailapp.cz/data-feeds/{feed_id}/refresh
Trigger a refresh of a data feed.
> [!NOTE]
>
> Limited to 1 refresh per hour. Only available for Marketer+ accounts and feeds with fewer than 50,000 items.
**feed\_id** `integer` *required*
ID of the data feed.
```bash cURL theme={null}
curl https://api2.ecomailapp.cz/data-feeds/1/refresh \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$feedId = 1;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/data-feeds/{$feedId}/refresh");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"message": "Your feed is being refreshed"
}
```
```json 403 theme={null}
{
"errors": "Account must be marketer+ tariff"
}
```
```json 422 theme={null}
{
"errors": "Feed can be refreshed just once per hour"
}
```
# Refresh product feed
Source: https://docs.ecomail.cz/api-reference/feeds/refresh-product
GET https://api2.ecomailapp.cz/feeds/{feed_id}/refresh
Trigger a refresh of a product feed.
> [!NOTE]
>
> Limited to 1 refresh per hour. Only available for Marketer+ accounts and feeds with fewer than 50,000 products.
**feed\_id** `integer` *required*
ID of the product feed.
```bash cURL theme={null}
curl https://api2.ecomailapp.cz/feeds/1/refresh \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$feedId = 1;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/feeds/{$feedId}/refresh");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"message": "Your feed is being refreshed"
}
```
```json 403 theme={null}
{
"errors": "Account must be marketer+ tariff"
}
```
# Introduction
Source: https://docs.ecomail.cz/api-reference/introduction
Get started with the Ecomail API v2.0
The Ecomail API v2.0 lets you programmatically manage your email marketing — lists, subscribers, campaigns, automations, and more.
> [card] [Download the OpenAPI spec](/openapi.json)
>
> Machine-readable OpenAPI 3.1 description of the whole API. Import it into Postman or Insomnia, or use it to generate client SDKs.
## Base URL
All API requests use the following base URL:
```
https://api2.ecomailapp.cz/
```
## Authentication
Before using the API, you need an API key. To obtain one:
1. Log in to your Ecomail account
2. Go to **Manage your account** → **For developers**
3. Click **Copy API Key**
Every request must include a `key` header containing your API key:
```bash theme={null}
curl https://api2.ecomailapp.cz/lists \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
> [!WARNING]
>
> Keep your API key secret. Do not expose it in client-side code or public repositories.
### Required headers
| Header | Value |
| - | - |
| `key` | Your API key |
| `Content-Type` | `application/json` |
## CORS and security restrictions
For security reasons, the API **does not accept direct HTTP requests from JavaScript/AJAX in a browser**. Attempting to call the API from a frontend application results in a CORS (Cross-Origin Resource Sharing) error.
JavaScript runs client-side, meaning API requests made directly from a browser would expose your API key. Always send API requests **from a backend server** where your API key is safely stored. Do not expose API requests in client-side code to prevent key leaks.
If you need to access the API from a web application, route requests through your **backend server** to handle authentication securely.
## Rate limiting
The API allows up to **1,000 requests per minute** per API key. If you exceed this limit, the API returns a `429 Too Many Requests` status code with a `Retry-After` header indicating how many seconds to wait before retrying.
## Response format
All responses are returned as JSON. Successful responses return the requested data directly. Error responses include an appropriate HTTP status code.
# Add new list
Source: https://docs.ecomail.cz/api-reference/lists/add-new
POST https://api2.ecomailapp.cz/lists
Create a new subscriber list in your account.
**name** `string` *required*
List name.
**from\_name** `string`
Sender name used in emails sent from this list.
**from\_email** `string`
Sender email address used in emails sent from this list.
**reply\_to** `string`
Reply-to email address.
**sub\_success\_page** `string`
URL to redirect to after submitting a sign-up form.
**sub\_confirmed\_page** `string`
URL to redirect to after confirming a sign-up email.
**unsub\_page** `string`
URL to redirect to after unsubscribing from the list.
**double\_optin** `boolean`
Whether sign-up confirmation (double opt-in) is required.
**conf\_subject** `string`
Subject line of the confirmation email.
**conf\_message** `string`
HTML content of the confirmation email.
```bash cURL theme={null}
curl -X POST https://api2.ecomailapp.cz/lists \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "New list name",
"from_name": "Ecomailapp.cz",
"from_email": "test@ecomailapp.cz",
"reply_to": "support@ecomail.cz"
}'
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/lists');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'name' => 'New list name',
'from_name' => 'Ecomailapp.cz',
'from_email' => 'test@ecomailapp.cz',
'reply_to' => 'support@ecomail.cz',
]));
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"name": "New list name",
"id": 2
}
```
# Get segments
Source: https://docs.ecomail.cz/api-reference/lists/get-segments
GET https://api2.ecomailapp.cz/lists/{list_id}/segments
Retrieve all segments created in a specific list.
**list\_id** `integer` *required*
ID of the list.
> [!NOTE]
>
> A list with no segments returns an empty array.
```bash cURL theme={null}
curl https://api2.ecomailapp.cz/lists/1/segments \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$listId = 1;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/lists/{$listId}/segments");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"segments": {
"5c36008811e45": { "name": "Segment 1", "id": "5c36008811e45", "count": 860 },
"5cbf2405a77ce": { "name": "Segment 2", "id": "5cbf2405a77ce", "count": 540 }
}
}
```
```json 404 theme={null}
{
"message": "Not Found!"
}
```
# Get subscriber from list
Source: https://docs.ecomail.cz/api-reference/lists/get-subscriber
GET https://api2.ecomailapp.cz/lists/{list_id}/subscriber/{email}
Retrieve a specific subscriber from a list by their email address.
**list\_id** `integer` *required*
ID of the list.
**email** `string` *required*
Email of the subscriber.
> [!NOTE]
>
> Status values in the response: `1` = subscribed, `2` = unsubscribed, `4` = hard bounce, `5` = spam complaint, `6` = unconfirmed.
```bash cURL theme={null}
curl https://api2.ecomailapp.cz/lists/42/subscriber/john.doe@example.com \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$listId = 42;
$email = 'john.doe@example.com';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/lists/{$listId}/subscriber/{$email}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"subscriber": {
"id": 12345,
"name": "John",
"surname": "Doe",
"email": "john.doe@example.com",
"company": "Acme Corporation",
"city": "New York",
"country": "US",
"phone": "+1 (555) 123-4567",
"gender": "male",
"tags": ["tag1", "tag2"],
"rating": 4.5,
"list_id": 42,
"status": 1,
"subscribed_at": "2022-01-01T12:00:00.000000Z",
"custom_fields": { "field1": "Value 1" },
"groups": { "grp_60ddec46df422": ["a", "b"] },
"fcm_token": "fcmExampleToken:APA91bExampleRegistrationToken",
"fcm_platform": "android",
"fcm_app_id": "1:1234567890:android:abc123def456"
}
}
```
```json 404 theme={null}
{
"errors": ["Subscriber with email foo@bar.cz was not found in the list"]
}
```
# Get subscriber by phone
Source: https://docs.ecomail.cz/api-reference/lists/get-subscriber-by-phone
GET https://api2.ecomailapp.cz/lists/{list_id}/subscriber-by-phone/{phone}
Retrieve a specific subscriber from a list by their phone number.
**list\_id** `integer` *required*
ID of the list.
**phone** `string` *required*
Phone number of the subscriber. Must be a valid international phone number.
```bash cURL theme={null}
curl https://api2.ecomailapp.cz/lists/789/subscriber-by-phone/+420777888999 \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$listId = 789;
$phone = urlencode('+420777888999');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/lists/{$listId}/subscriber-by-phone/{$phone}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"subscriber": {
"id": 123456,
"list_id": 789,
"email": "foo@bar.cz",
"status": 1,
"subscribed_at": "2023-01-01T00:00:00.000000Z",
"custom_fields": { "id": "123" },
"source": "API"
}
}
```
```json 422 theme={null}
{
"errors": { "phone": ["Invalid phone number"] }
}
```
# Get subscribers
Source: https://docs.ecomail.cz/api-reference/lists/get-subscribers
GET https://api2.ecomailapp.cz/lists/{list_id}/subscribers
Retrieve a paginated list of subscribers from a specific list.
**list\_id** `integer` *required*
ID of the list.
**page** `integer` (default: 1)
Page index.
**status** `string` (default: subscribed)
Filter by status: `unsubscribed`, `not_confirmed`, `bounced`, `complained`.
**per\_page** `integer` (default: 20)
Number of subscribers per page, up to 5000. We recommend keeping this at a lower number (e.g. 4000) depending on the amount of data each subscriber has.
> [!NOTE]
>
> Status values in the response: `1` = subscribed, `2` = unsubscribed, `4` = hard bounce, `5` = spam complaint, `6` = unconfirmed.
```bash cURL theme={null}
curl https://api2.ecomailapp.cz/lists/75/subscribers?page=1&per_page=20 \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$listId = 75;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/lists/{$listId}/subscribers?page=1&per_page=20");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"current_page": 1,
"data": [
{
"list_id": 75,
"email": "some1@contact.com",
"status": 1,
"subscribed_at": "2024-05-10T12:29:07.000000Z",
"unsubscribed_at": null,
"custom_fields": [],
"groups": null,
"source": "app",
"subscriber": {
"id": 1158595,
"name": "Foo",
"surname": "Bar",
"email": "some1@contact.com",
"gender": "male",
"company": null,
"city": "City",
"country": "CZ",
"phone": null
}
}
],
"per_page": 20,
"total": 2
}
```
# View all lists
Source: https://docs.ecomail.cz/api-reference/lists/list-all
GET https://api2.ecomailapp.cz/lists
Retrieve all subscriber lists in your account.
## List properties
**id** `integer`
Unique identifier of the list.
**name** `string` *required*
List name.
**from\_name** `string`
Sender name used in emails sent from this list.
**from\_email** `string`
Sender email address used in emails sent from this list.
**reply\_to** `string`
Reply-to email address.
**sub\_success\_page** `string`
URL to redirect to after submitting a sign-up form.
**sub\_confirmed\_page** `string`
URL to redirect to after confirming a sign-up email.
**unsub\_page** `string`
URL to redirect to after unsubscribing from the list.
**double\_optin** `boolean`
Whether sign-up confirmation (double opt-in) is required.
**conf\_subject** `string`
Subject line of the confirmation email.
**conf\_message** `string`
HTML content of the confirmation email.
```bash cURL theme={null}
curl https://api2.ecomailapp.cz/lists \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/lists');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
[
{
"id": 29,
"name": "New list name",
"from_name": "Ecomailapp.cz",
"from_email": "test@ecomailapp.cz",
"reply_to": "support@ecomail.cz",
"sub_success_page": null,
"sub_confirmed_page": null,
"unsub_page": null,
"double_optin": null,
"conf_subject": null,
"conf_message": null
}
]
```
# Show list detail
Source: https://docs.ecomail.cz/api-reference/lists/show
GET https://api2.ecomailapp.cz/lists/{list_id}
Retrieve detailed information about a specific list, including custom fields, groups, segments, and subscriber counts.
**list\_id** `integer` *required*
ID of the list.
```bash cURL theme={null}
curl https://api2.ecomailapp.cz/lists/1 \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$listId = 1;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/lists/{$listId}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"list": {
"id": "1",
"name": "List Name",
"from_name": "Sender Name",
"from_email": "sender@example.com",
"reply_to": "reply@example.com",
"sub_success_page": null,
"sub_confirmed_page": "https://www.example.com/confirm?email=*|EMAIL|*",
"unsub_page": null,
"double_optin": true,
"conf_subject": "Confirmation Subject",
"conf_message": "Please confirm your subscription: *|SUBCONFIRM|*",
"custom_fields": {
"date1": { "type": "string", "name": "Date Field" },
"size": { "type": "int", "name": "Size Field" }
},
"groups": {
"grp_5e83080ebb988": {
"name": "Group 1",
"category": [{ "name": "Category A", "id": "plnQNPzCz" }],
"id": "grp_1",
"type": "select"
}
},
"segments": {
"5c36008811e45": {
"name": "Segment 1",
"id": "5c36008811e45"
}
},
"active_subscribers": 100,
"created": "26.6.2018"
},
"subscribers": {
"unknown": 0,
"subscribed": 375,
"unsubscribed": 143,
"soft_bounced": 9,
"hard_bounced": 11,
"complained": 1,
"unconfirmed": 25
}
}
```
# Add new subscriber to list
Source: https://docs.ecomail.cz/api-reference/lists/subscribe
POST https://api2.ecomailapp.cz/lists/{list_id}/subscribe
Subscribe a new contact to a specific list.
**list\_id** `integer` *required*
ID of the list.
**subscriber\_data** `object` *required*
Information about the subscriber.
**subscriber\_data properties**
**subscriber\_data\[email]** `string` *required*
Subscriber's email address.
**subscriber\_data\[name]** `string`
First name.
**subscriber\_data\[surname]** `string`
Last name.
**subscriber\_data\[gender]** `string`
Gender. Must be `male` or `female`.
**subscriber\_data\[status]** `integer`
Subscriber status. `1` = subscribed, `2` = unsubscribed, `4` = hard bounce, `5` = spam complaint, `6` = unconfirmed.
**subscriber\_data\[company]** `string`
Company name.
**subscriber\_data\[city]** `string`
City.
**subscriber\_data\[street]** `string`
Street address.
**subscriber\_data\[zip]** `string`
ZIP or postal code.
**subscriber\_data\[country]** `string`
Country code.
**subscriber\_data\[phone]** `string`
Phone number.
**subscriber\_data\[pretitle]** `string`
Pre-title (e.g. Mr., Mrs.).
**subscriber\_data\[surtitle]** `string`
Post-nominal title (e.g. PhD).
**subscriber\_data\[birthday]** `string`
Birthday in `YYYY-MM-DD` format.
**subscriber\_data\[nameday]** `string`
Name day in `MM-DD` format.
**subscriber\_data\[source]** `string`
Source of the subscriber.
**subscriber\_data\[custom\_fields]** `object`
Custom field values. Limited to 5000 characters total. Reserved system merge tags are ignored. If a field doesn't exist, a new field is created. Supported types: `string`, `date`, `json`, `int`, `float`, `url`. Float precision is limited to 3 decimal places.
Keys are case-insensitive — they are trimmed and lowercased on input, so `SHOP`, `shop` and `Shop` are treated as the same field. Two keys that differ only in case or whitespace in the same request are rejected as duplicates.
**subscriber\_data\[tags]** `array`
Subscriber tags. Limited to 2000 characters total and 50 characters per tag. Content overwrites current tags. Only updates if the parameter is present and `update_existing` is `true`. To clear all tags, send an empty array.
**subscriber\_data\[groups]** `object`
Group assignments. Overwrites current values. To keep existing selections, send the current values together with new ones.
**subscriber\_data\[fcm\_token]** `string`
Firebase Cloud Messaging (FCM) registration token used to deliver push notifications. Max 255 characters. Required whenever you send `fcm_app_id`. Send `null` to remove the token, the platform, and the app ID from the contact. Leave the field out to keep the stored values. A token and app ID pair belongs to one contact only: when you send a pair that another contact already has, Ecomail removes it from that other contact.
**subscriber\_data\[fcm\_platform]** `string`
Device platform for push notifications. Must be `android`, `ios`, or `web`. Can only be sent together with `fcm_token`.
**subscriber\_data\[fcm\_app\_id]** `string`
Firebase application ID associated with the FCM token. Max 150 characters. Required whenever you send `fcm_token`.
**trigger\_autoresponders** `boolean` (default: false)
Trigger automations when the subscriber is added.
**trigger\_notification** `boolean` (default: false)
Send a notification about the new subscriber if configured in list settings.
**update\_existing** `boolean` (default: false)
Update the subscriber if they already exist in the list.
**skip\_confirmation** `boolean` (default: false)
Skip double opt-in confirmation. If `false`, the system sends a double opt-in email and the subscriber is added with status `6` (unconfirmed).
**resubscribe** `boolean` (default: false)
Force resubscribe if the subscriber was previously unsubscribed (status `2`). If `status` is provided in `subscriber_data`, it takes precedence. For resubscribe to work, the status must be `1`.
> [!NOTE]
>
> If the subscriber already exists in the list, the response includes `already_subscribed: true`.
> [!NOTE]
>
> The `inserted_at` field in the response returns the time in UTC format.
```bash cURL theme={null}
curl -X POST https://api2.ecomailapp.cz/lists/1/subscribe \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"subscriber_data": {
"name": "Jan",
"surname": "Novak",
"email": "jan@novak.cz",
"gender": "male",
"company": "Company name",
"city": "Praha",
"country": "CZ",
"phone": "+420777888999",
"birthday": "1984-01-01",
"custom_fields": {
"shop": "myshop.cz",
"birthday": { "value": "2022-01-20", "type": "date" }
},
"tags": ["tags"],
"groups": { "grp_5a145ee75780f": ["Category 1", "Category 2"] },
"fcm_token": "fcmExampleToken:APA91bExampleRegistrationToken",
"fcm_platform": "android",
"fcm_app_id": "1:1234567890:android:abc123def456"
},
"trigger_autoresponders": false,
"update_existing": false,
"resubscribe": false
}'
```
```php PHP theme={null}
$listId = 1;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/lists/{$listId}/subscribe");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'subscriber_data' => [
'name' => 'Jan',
'surname' => 'Novak',
'email' => 'jan@novak.cz',
'gender' => 'male',
'company' => 'Company name',
'city' => 'Praha',
'country' => 'CZ',
'phone' => '+420777888999',
'birthday' => '1984-01-01',
'custom_fields' => [
'shop' => 'myshop.cz',
'birthday' => ['value' => '2022-01-20', 'type' => 'date'],
],
'tags' => ['tags'],
'groups' => ['grp_5a145ee75780f' => ['Category 1', 'Category 2']],
'fcm_token' => 'fcmExampleToken:APA91bExampleRegistrationToken',
'fcm_platform' => 'android',
'fcm_app_id' => '1:1234567890:android:abc123def456',
],
'trigger_autoresponders' => false,
'update_existing' => false,
'resubscribe' => false,
]));
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"id": 259471,
"name": "Jan",
"surname": "Novak",
"email": "jan@novak.cz",
"gender": null,
"bounce_soft": 0,
"bounced_hard": 0,
"bounce_message": null,
"inserted_at": "2015-01-21 10:50:04",
"already_subscribed": true
}
```
```json 422 theme={null}
{
"success": false,
"message": "Validation errors",
"data": {
"subscriber_data.custom_fields": [
"Custom fields must be an array with unique keys (case-insensitive)",
"Subscriber custom fields must be an array with max 5000 bytes"
]
}
}
```
# Add bulk subscribers
Source: https://docs.ecomail.cz/api-reference/lists/subscribe-bulk
POST https://api2.ecomailapp.cz/lists/{list_id}/subscribe-bulk
Subscribe multiple contacts to a specific list in a single request.
**list\_id** `integer` *required*
ID of the list.
**subscriber\_data** `array` *required*
Array of subscriber objects. Limited to 3000 subscribers per call — subscribers above the limit are ignored.
**subscriber object properties**
**subscriber\_data\[]\[email]** `string` *required*
Email address of the subscriber.
**subscriber\_data\[]\[status]** `integer` (default: 1)
Subscriber status. `1` = subscribed, `2` = unsubscribed, `4` = hard bounce.
**subscriber\_data\[]\[fcm\_token]** `string`
Firebase Cloud Messaging (FCM) registration token used to deliver push notifications. Max 255 characters. Required whenever you send `fcm_app_id`. Send `null` to remove the token, the platform, and the app ID from the contact. Leave the field out to keep the stored values. A token and app ID pair belongs to one contact only: when you send a pair that another contact already has, Ecomail removes it from that other contact.
**subscriber\_data\[]\[fcm\_platform]** `string`
Device platform for push notifications. Must be `android`, `ios`, or `web`. Can only be sent together with `fcm_token`.
**subscriber\_data\[]\[fcm\_app\_id]** `string`
Firebase application ID associated with the FCM token. Max 150 characters. Required whenever you send `fcm_token`.
**update\_existing** `boolean` (default: true)
Update subscribers that already exist in the list.
**resubscribe** `boolean` (default: false)
Force resubscribe if the subscriber was previously unsubscribed.
**trigger\_autoresponders** `boolean` (default: false)
Trigger automations when subscribers are added.
> [!WARNING]
>
> Maximum of 3000 subscribers per call. Subscribers above the limit are silently ignored.
> [!NOTE]
>
> Subscribers added via bulk subscribe always skip double opt-in confirmation. Custom fields are limited to 5000 characters total. Custom field keys are case-insensitive — they are trimmed and lowercased on input, so `SHOP`, `shop` and `Shop` are treated as the same field; two keys that differ only in case or whitespace within the same subscriber are rejected as duplicates. Tags are limited to 2000 characters total and 50 characters per tag — tag content only updates when the `tags` parameter is present and `update_existing` is `true`.
```bash cURL theme={null}
curl -X POST https://api2.ecomailapp.cz/lists/1/subscribe-bulk \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"subscriber_data": [
{
"name": "Foo",
"surname": "Bar",
"email": "foo@bar.cz",
"custom_fields": { "category": "customer" },
"fcm_token": "fcmExampleToken:APA91bExampleRegistrationToken",
"fcm_platform": "ios",
"fcm_app_id": "1:1234567890:ios:abc123def456"
},
{
"name": "Foo 2",
"email": "foo2@bar.cz"
}
],
"update_existing": true,
"resubscribe": false,
"trigger_autoresponders": false
}'
```
```php PHP theme={null}
$listId = 1;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/lists/{$listId}/subscribe-bulk");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'subscriber_data' => [
[
'name' => 'Foo',
'surname' => 'Bar',
'email' => 'foo@bar.cz',
'custom_fields' => ['category' => 'customer'],
'fcm_token' => 'fcmExampleToken:APA91bExampleRegistrationToken',
'fcm_platform' => 'ios',
'fcm_app_id' => '1:1234567890:ios:abc123def456',
],
[
'name' => 'Foo 2',
'email' => 'foo2@bar.cz',
],
],
'update_existing' => true,
'resubscribe' => false,
'trigger_autoresponders' => false,
]));
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"inserts": 2
}
```
```json 422 theme={null}
{
"errors": {
"subscriber_data.0": {
"email": ["Invalid email address"],
"custom_fields": [
"Custom fields must be an array with unique keys (case-insensitive)",
"Subscriber custom fields must be an array with max 5000 bytes"
]
},
"subscriber_data.1": { "email": ["Invalid email address"] }
}
}
```
# Unsubscribe subscriber from list
Source: https://docs.ecomail.cz/api-reference/lists/unsubscribe
DELETE https://api2.ecomailapp.cz/lists/{list_id}/unsubscribe
Unsubscribe a subscriber from a specific list.
**list\_id** `integer` *required*
ID of the list.
**email** `string` *required*
Email address of the subscriber to unsubscribe.
```bash cURL theme={null}
curl -X DELETE https://api2.ecomailapp.cz/lists/1/unsubscribe \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"email": "foo@bar.cz"}'
```
```php PHP theme={null}
$listId = 1;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/lists/{$listId}/unsubscribe");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'email' => 'foo@bar.cz',
]));
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"id": 4,
"list_id": 1,
"email": "foo@bar.cz",
"status": 2,
"subscribed_at": "2024-11-27T11:18:00.000000Z",
"unsubscribed_at": "2024-11-27T11:39:16.000000Z",
"custom_fields": { "mergetag": "content" },
"source": "api"
}
```
# Update list
Source: https://docs.ecomail.cz/api-reference/lists/update
PUT https://api2.ecomailapp.cz/lists/{list_id}
Update an existing subscriber list.
**list\_id** `integer` *required*
ID of the list.
**name** `string` *required*
List name.
**from\_name** `string`
Sender name used in emails sent from this list.
**from\_email** `string`
Sender email address used in emails sent from this list.
**reply\_to** `string`
Reply-to email address.
**sub\_success\_page** `string`
URL to redirect to after submitting a sign-up form.
**sub\_confirmed\_page** `string`
URL to redirect to after confirming a sign-up email.
**unsub\_page** `string`
URL to redirect to after unsubscribing from the list.
**double\_optin** `boolean`
Whether sign-up confirmation (double opt-in) is required.
**conf\_subject** `string`
Subject line of the confirmation email.
**conf\_message** `string`
HTML content of the confirmation email.
```bash cURL theme={null}
curl -X PUT https://api2.ecomailapp.cz/lists/2 \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Updated name",
"from_name": "Ecomailapp.cz",
"from_email": "test@ecomailapp.cz",
"reply_to": "support@ecomail.cz"
}'
```
```php PHP theme={null}
$listId = 2;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/lists/{$listId}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'name' => 'Updated name',
'from_name' => 'Ecomailapp.cz',
'from_email' => 'test@ecomailapp.cz',
'reply_to' => 'support@ecomail.cz',
]));
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"id": 2,
"name": "Updated name",
"from_name": "Ecomailapp.cz",
"from_email": "test@ecomailapp.cz",
"reply_to": "support@ecomail.cz",
"sub_success_page": null,
"sub_confirmed_page": null,
"unsub_page": null,
"double_optin": null,
"conf_subject": null,
"conf_message": null
}
```
# Update subscriber
Source: https://docs.ecomail.cz/api-reference/lists/update-subscriber
PUT https://api2.ecomailapp.cz/lists/{list_id}/update-subscriber
Update an existing subscriber in a specific list.
**list\_id** `integer` *required*
ID of the list.
**email** `string` *required*
Email address of the subscriber to update.
**subscriber\_data** `object`
Updated subscriber information.
**subscriber\_data properties**
**subscriber\_data\[name]** `string`
First name.
**subscriber\_data\[surname]** `string`
Last name.
**subscriber\_data\[gender]** `string`
Gender. Must be `male` or `female`.
**subscriber\_data\[company]** `string`
Company name.
**subscriber\_data\[city]** `string`
City.
**subscriber\_data\[street]** `string`
Street address.
**subscriber\_data\[zip]** `string`
ZIP or postal code.
**subscriber\_data\[country]** `string`
Country code.
**subscriber\_data\[phone]** `string`
Phone number.
**subscriber\_data\[pretitle]** `string`
Pre-title (e.g. Mr., Mrs.).
**subscriber\_data\[surtitle]** `string`
Post-nominal title (e.g. PhD).
**subscriber\_data\[birthday]** `string`
Birthday in `YYYY-MM-DD` format.
**subscriber\_data\[nameday]** `string`
Name day in `MM-DD` format.
**subscriber\_data\[source]** `string`
Source of the subscriber.
**subscriber\_data\[custom\_fields]** `object`
Custom field values. Limited to 5000 characters total.
Keys are case-insensitive — they are trimmed and lowercased on input, so `SHOP`, `shop` and `Shop` are treated as the same field. Two keys that differ only in case or whitespace in the same request are rejected as duplicates.
**subscriber\_data\[tags]** `array`
Subscriber tags. Limited to 2000 characters total and 50 characters per tag. Content overwrites current tags.
**subscriber\_data\[groups]** `object`
Group assignments. Overwrites current values.
**subscriber\_data\[fcm\_token]** `string`
Firebase Cloud Messaging (FCM) registration token used to deliver push notifications. Max 255 characters. Required whenever you send `fcm_app_id`. Send `null` to remove the token, the platform, and the app ID from the contact. Leave the field out to keep the stored values. A token and app ID pair belongs to one contact only: when you send a pair that another contact already has, Ecomail removes it from that other contact.
**subscriber\_data\[fcm\_platform]** `string`
Device platform for push notifications. Must be `android`, `ios`, or `web`. Can only be sent together with `fcm_token`.
**subscriber\_data\[fcm\_app\_id]** `string`
Firebase application ID associated with the FCM token. Max 150 characters. Required whenever you send `fcm_token`.
```bash cURL theme={null}
curl -X PUT https://api2.ecomailapp.cz/lists/1/update-subscriber \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"email": "foo@bar.cz",
"subscriber_data": {
"name": "Jan",
"surname": "Novak",
"gender": "male",
"company": "Company name",
"city": "Praha",
"custom_fields": { "shop": "myshop.cz" },
"tags": ["tags"],
"groups": { "grp_5a145ee75780f": ["Category 1", "Category 2"] },
"fcm_token": "fcmExampleToken:APA91bExampleRegistrationToken",
"fcm_platform": "web",
"fcm_app_id": "1:1234567890:web:abc123def456"
}
}'
```
```php PHP theme={null}
$listId = 1;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/lists/{$listId}/update-subscriber");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'email' => 'foo@bar.cz',
'subscriber_data' => [
'name' => 'Jan',
'surname' => 'Novak',
'gender' => 'male',
'company' => 'Company name',
'city' => 'Praha',
'custom_fields' => ['shop' => 'myshop.cz'],
'tags' => ['tags'],
'groups' => ['grp_5a145ee75780f' => ['Category 1', 'Category 2']],
'fcm_token' => 'fcmExampleToken:APA91bExampleRegistrationToken',
'fcm_platform' => 'web',
'fcm_app_id' => '1:1234567890:web:abc123def456',
],
]));
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"id": 12345,
"name": "Jan",
"surname": "Novak",
"email": "foo@bar.cz",
"gender": "male",
"bounce_soft": 0,
"bounce_hard": null,
"bounce_message": null,
"inserted_at": "2022-11-15 13:59:21",
"fcm_token": "fcmExampleToken:APA91bExampleRegistrationToken",
"fcm_platform": "web",
"fcm_app_id": "1:1234567890:web:abc123def456"
}
```
```json 422 theme={null}
{
"errors": {
"subscriber_data.custom_fields": [
"Custom fields must be an array with unique keys (case-insensitive)",
"Subscriber custom fields must be an array with max 5000 bytes"
]
}
}
```
# Update bulk subscribers
Source: https://docs.ecomail.cz/api-reference/lists/update-subscribers-bulk
PUT https://api2.ecomailapp.cz/lists/{list_id}/update-subscribers-bulk
Update multiple existing subscribers in a specific list in a single request.
**list\_id** `integer` *required*
ID of the list.
**subscriber\_data** `array` *required*
Array of subscriber objects to update. Limited to 3000 subscribers per call.
**subscriber object properties**
**subscriber\_data\[]\[email]** `string` *required*
Email address of the subscriber to update.
**subscriber\_data\[]\[name]** `string`
First name.
**subscriber\_data\[]\[surname]** `string`
Last name.
**subscriber\_data\[]\[status]** `integer`
Subscriber status. `1` = subscribed, `2` = unsubscribed, `4` = hard bounce.
**subscriber\_data\[]\[custom\_fields]** `object`
Custom field values. Limited to 5000 characters total.
Keys are case-insensitive — they are trimmed and lowercased on input, so `SHOP`, `shop` and `Shop` are treated as the same field. Two keys that differ only in case or whitespace within the same subscriber are rejected as duplicates.
**subscriber\_data\[]\[tags]** `array`
Subscriber tags. Limited to 2000 characters total and 50 characters per tag. Content overwrites current tags.
**subscriber\_data\[]\[fcm\_token]** `string`
Firebase Cloud Messaging (FCM) registration token used to deliver push notifications. Max 255 characters. Required whenever you send `fcm_app_id`. Send `null` to remove the token, the platform, and the app ID from the contact. Leave the field out to keep the stored values. A token and app ID pair belongs to one contact only: when you send a pair that another contact already has, Ecomail removes it from that other contact.
**subscriber\_data\[]\[fcm\_platform]** `string`
Device platform for push notifications. Must be `android`, `ios`, or `web`. Can only be sent together with `fcm_token`.
**subscriber\_data\[]\[fcm\_app\_id]** `string`
Firebase application ID associated with the FCM token. Max 150 characters. Required whenever you send `fcm_token`.
**allow\_resubscribe** `boolean` (default: false)
Allow resubscribing previously unsubscribed contacts when `status` is set to `1`.
> [!WARNING]
>
> Maximum of 3000 subscribers per call. Subscribers above the limit are silently ignored.
```bash cURL theme={null}
curl -X PUT https://api2.ecomailapp.cz/lists/1/update-subscribers-bulk \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"subscriber_data": [
{
"email": "foo@bar.cz",
"name": "Jan",
"surname": "Novak",
"custom_fields": { "shop": "myshop.cz" },
"tags": ["vip"],
"fcm_token": "fcmExampleToken:APA91bExampleRegistrationToken",
"fcm_platform": "android",
"fcm_app_id": "1:1234567890:android:abc123def456"
},
{
"email": "foo2@bar.cz",
"name": "Jana"
}
],
"allow_resubscribe": false
}'
```
```php PHP theme={null}
$listId = 1;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/lists/{$listId}/update-subscribers-bulk");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'subscriber_data' => [
[
'email' => 'foo@bar.cz',
'name' => 'Jan',
'surname' => 'Novak',
'custom_fields' => ['shop' => 'myshop.cz'],
'tags' => ['vip'],
'fcm_token' => 'fcmExampleToken:APA91bExampleRegistrationToken',
'fcm_platform' => 'android',
'fcm_app_id' => '1:1234567890:android:abc123def456',
],
[
'email' => 'foo2@bar.cz',
'name' => 'Jana',
],
],
'allow_resubscribe' => false,
]));
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"updates": 2
}
```
```json 400 theme={null}
{
"errors": {
"subscriber_data.0.email": ["Invalid email address"],
"subscriber_data.0.custom_fields": [
"Custom fields must be an array with unique keys (case-insensitive)",
"Subscriber custom fields must be an array with max 5000 bytes"
]
}
}
```
# Register a push click
Source: https://docs.ecomail.cz/api-reference/push/register-click
POST https://api2.ecomailapp.cz/push/click
Report push notification click tokens so taps are attributed to the campaign or automation that sent them.
When Ecomail sends a push notification, it adds a click token named `ecm_push_id` to the FCM message `data` payload, next to `deep_link`. Post that token back to this endpoint when the recipient taps the notification, and Ecomail attributes the click to the campaign or automation that sent it.
For `web` recipients with an `https` deep link, Ecomail also adds the token to the link the browser opens (`webpush.fcm_options.link`) as the `ecm_push_id` query parameter.
> [!NOTE]
>
> Ecomail only adds `ecm_push_id` when the notification has a deep link and the recipient is a known subscriber. A notification without a deep link carries no token, and there is nothing to report.
Ecomail counts each token once. A token sent again, in a later request or twice in one batch, adds no click, so you can safely retry a request that failed. You can batch up to 500 tokens in a single request.
**ecm\_push\_id** `array|string` *required*
Click tokens read from the `ecm_push_id` value in the notification's `data` payload, or from the `ecm_push_id` query parameter of the link opened on the web. Send an array of 1 to 500 tokens, or a single token as a plain string. Each token can be up to 2048 characters.
## Responses
The status code tells you how many of the tokens Ecomail accepted:
* `204` — every token was accepted. The response has no body.
* `200` — some tokens were rejected. The accepted ones are still registered, and `rejected` says how many were not.
* `422` — none of the tokens were accepted, or the `ecm_push_id` field itself failed validation. Nothing was registered.
A token is rejected when it is malformed, was not issued by Ecomail, or belongs to a different account than the API key you used.
```bash cURL theme={null}
curl -X POST https://api2.ecomailapp.cz/push/click \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"ecm_push_id": [
"eyJpdiI6IkV4YW1wbGVJdiIsInZhbHVlIjoiRXhhbXBsZUVuY3J5cHRlZENsaWNrVG9rZW4ifQ=="
]
}'
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/push/click');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'ecm_push_id' => [
'eyJpdiI6IkV4YW1wbGVJdiIsInZhbHVlIjoiRXhhbXBsZUVuY3J5cHRlZENsaWNrVG9rZW4ifQ==',
],
]));
$response = curl_exec($ch);
curl_close($ch);
```
```json 204 theme={null}
```
```json 200 Some tokens rejected theme={null}
{
"rejected": 1
}
```
```json 422 Missing field theme={null}
{
"errors": {
"ecm_push_id": ["The ecm push id field is required."]
}
}
```
```json 422 Invalid token theme={null}
{
"errors": {
"ecm_push_id": ["The ecm_push_id is invalid."]
}
}
```
# Create recommender
Source: https://docs.ecomail.cz/api-reference/recommenders/create
POST https://api2.ecomailapp.cz/recommenders
Create a new Spark recommender for a specific shop and product feed. Training starts automatically after creation.
**shop\_id** `string` *required*
The shop (e-commerce platform) identifier. Max 64 characters, allowed characters: letters, digits, `.`, `_`, `-`.
**feed\_id** `integer` *required*
The product feed ID to use for recommendations.
**name** `string`
Optional human-readable name of the recommender. Max 191 characters.
**filtered\_products** `string[]`
Optional list of product identifiers (SKUs) to exclude from the recommendations. Max 1000 items, each unique and max 255 characters. Omit the field for no product filter.
**filtered\_categories** `string[]`
Optional list of category names to exclude from the recommendations. Max 1000 items, each unique and max 255 characters. Omit the field for no category filter.
**included\_months** `integer[]`
Optional list of calendar month numbers (`1`–`12`) that restrict which purchase history is used for training. Values must be unique, max 12 items. Omit the field to use the full purchase history.
> [!NOTE]
>
> After creation the recommender status will be `created` and training will start automatically in the background.
> Each account can have at most 5 recommenders; creating a 6th returns a `422` error. Deleting a recommender never recycles its `sequence_number`.
> This endpoint is rate limited to 2 requests per minute.
```bash cURL theme={null}
curl -X POST https://api2.ecomailapp.cz/recommenders \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"shop_id": "my-shop",
"feed_id": 1,
"name": "Christmas 2026",
"filtered_products": ["SKU-A", "SKU-B"],
"filtered_categories": ["Sale"],
"included_months": [11, 12]
}'
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/recommenders');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'shop_id' => 'my-shop',
'feed_id' => 1,
'name' => 'Christmas 2026',
'filtered_products' => ['SKU-A', 'SKU-B'],
'filtered_categories' => ['Sale'],
'included_months' => [11, 12],
]));
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
[
{
"recommender_id": "6789abc123def",
"feed_id": 1,
"shop_id": "my-shop",
"last_trained_timestamp": null,
"status": "created",
"settings": {
"filtered_products": ["SKU-A", "SKU-B"],
"filtered_categories": ["Sale"],
"included_months": [11, 12]
},
"sequence_number": 1,
"name": "Christmas 2026"
}
]
```
```json 422 theme={null}
{
"errors": {
"recommender": ["You have reached the maximum number of recommenders."]
}
}
```
```json 422 theme={null}
{
"errors": {
"recommender": ["There is not enough purchase data to train a recommender yet."]
}
}
```
# Delete recommender
Source: https://docs.ecomail.cz/api-reference/recommenders/delete
DELETE https://api2.ecomailapp.cz/recommenders/{recommender_id}
Remove a Spark recommender by its ID. Returns the updated list of remaining recommenders.
**recommender\_id** `string` *required*
The unique identifier of the recommender to delete.
> [!NOTE]
>
> Deleting a recommender does not recycle its `sequence_number` — the account's counter keeps growing so merge tags in existing templates never collide with a future recommender.
```bash cURL theme={null}
curl -X DELETE https://api2.ecomailapp.cz/recommenders/6789abc123def \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/recommenders/6789abc123def');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
[
{
"recommender_id": "abcd1234ef5678",
"feed_id": 2,
"shop_id": "my-shop",
"last_trained_timestamp": 1710000000,
"status": "ready",
"settings": {
"filtered_products": [],
"filtered_categories": [],
"included_months": []
},
"sequence_number": 2,
"name": null
}
]
```
```json 404 theme={null}
{
"message": "Recommender not found."
}
```
# List all recommenders
Source: https://docs.ecomail.cz/api-reference/recommenders/list-all
GET https://api2.ecomailapp.cz/recommenders
Retrieve all Spark recommenders configured for your account.
Returns a list of recommender objects, each containing the recommender ID, sequence number, optional name, associated shop and feed, training status and settings.
> [!NOTE]
>
> Recommender status values: `created` (just created, waiting to train), `training` (currently training on EMR), `ready` (trained and serving recommendations).
> [!NOTE]
>
> `sequence_number` is a stable, per-account identifier that is never reused, even after a recommender is deleted. It is the number referenced by the merge tag `*|ECM_SPARK_REC_{sequence_number}_{limit}[N].{field}|*` in templates and automations.
```bash cURL theme={null}
curl https://api2.ecomailapp.cz/recommenders \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/recommenders');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
[
{
"recommender_id": "6789abc123def",
"feed_id": 1,
"shop_id": "my-shop",
"last_trained_timestamp": 1710000000,
"status": "ready",
"settings": {
"filtered_products": [],
"filtered_categories": [],
"included_months": []
},
"sequence_number": 1,
"name": "Christmas 2026"
}
]
```
# Get recommender
Source: https://docs.ecomail.cz/api-reference/recommenders/show
GET https://api2.ecomailapp.cz/recommenders/{recommender_id}
Retrieve a single Spark recommender by its ID.
**recommender\_id** `string` *required*
The unique identifier of the recommender to retrieve.
> [!NOTE]
>
> Unlike the list endpoint, this returns a single recommender object (not an array). An unknown `recommender_id` returns a `404` error.
```bash cURL theme={null}
curl https://api2.ecomailapp.cz/recommenders/6789abc123def \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/recommenders/6789abc123def');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"recommender_id": "6789abc123def",
"feed_id": 1,
"shop_id": "my-shop",
"last_trained_timestamp": 1710000000,
"status": "ready",
"settings": {
"filtered_products": ["SKU-A", "SKU-B"],
"filtered_categories": ["Sale"],
"included_months": [11, 12]
},
"sequence_number": 1,
"name": "Christmas 2026"
}
```
```json 404 theme={null}
{
"message": "Recommender not found."
}
```
# Update recommender
Source: https://docs.ecomail.cz/api-reference/recommenders/update
PUT https://api2.ecomailapp.cz/recommenders/{recommender_id}
Update the name and settings (filters) of an existing Spark recommender. Returns the updated list of recommenders.
**recommender\_id** `string` *required*
The unique identifier of the recommender to update.
**name** `string`
Optional human-readable name of the recommender. Max 191 characters.
**filtered\_products** `string[]`
List of product identifiers (SKUs) to exclude from the recommendations. Max 1000 items, each unique and max 255 characters. Omit the field for no product filter.
**filtered\_categories** `string[]`
List of category names to exclude from the recommendations. Max 1000 items, each unique and max 255 characters. Omit the field for no category filter.
**included\_months** `integer[]`
List of calendar month numbers (`1`–`12`) that restrict which purchase history is used for training. Values must be unique, max 12 items. Omit the field to use the full purchase history.
> [!NOTE]
>
> Only `name` and the settings filters can be changed. `recommender_id`, `sequence_number`, `shop_id` and `feed_id` are immutable, and `status` / `last_trained_timestamp` are managed by the training pipeline. An unknown `recommender_id` returns a `404` error.
```bash cURL theme={null}
curl -X PUT https://api2.ecomailapp.cz/recommenders/6789abc123def \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Christmas 2026",
"filtered_products": ["SKU-A"],
"filtered_categories": ["Sale"],
"included_months": [11, 12]
}'
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/recommenders/6789abc123def');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'name' => 'Christmas 2026',
'filtered_products' => ['SKU-A'],
'filtered_categories' => ['Sale'],
'included_months' => [11, 12],
]));
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
[
{
"recommender_id": "6789abc123def",
"feed_id": 1,
"shop_id": "my-shop",
"last_trained_timestamp": 1710000000,
"status": "ready",
"settings": {
"filtered_products": ["SKU-A"],
"filtered_categories": ["Sale"],
"included_months": [11, 12]
},
"sequence_number": 1,
"name": "Christmas 2026"
}
]
```
```json 404 theme={null}
{
"message": "Recommender not found."
}
```
# Find contact
Source: https://docs.ecomail.cz/api-reference/search/find-contact
POST https://api2.ecomailapp.cz/search
Search for a subscriber globally across the account by email address.
**query** `string` *required*
Must be a valid email address.
```bash cURL theme={null}
curl -X POST https://api2.ecomailapp.cz/search \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "foo@bar.cz"
}'
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/search');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'query' => 'foo@bar.cz',
]));
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
[
{
"email": "foo@bar.cz",
"list_id": 1,
"status": 2,
"name": "Foo",
"surname": "Bar",
"custom_fields": {
"some_field": "text"
},
"tags": ["tags"],
"source": "app",
"subscribed_at": "2022-11-15T12:59:21.000000Z",
"unsubscribed_at": "2023-09-21T10:36:38.000000Z"
}
]
```
```json 422 theme={null}
{
"errors": {
"query": ["Invalid email address"]
}
}
```
# Create smart delivery rule
Source: https://docs.ecomail.cz/api-reference/smart-delivery/create
POST https://api2.ecomailapp.cz/smart-delivery/rules
Create a custom smart delivery rule that limits how often a contact receives messages.
**name** `string` *required*
Name of the rule. Max 255 characters.
**description** `string`
Description of the rule. Max 1000 characters.
**applicability** `string` (default: both)
Where the rule can be used. Allowed values: `campaign`, `pipeline`, `both`.
**limits** `object` *required*
The limits of the rule. Send `null` or omit a field to switch that limit off.
**limits properties**
**limits\[priority\_window\_hours]** `integer`
Skip a contact who received a message in the last N hours. Range `0`–`24`. Requires `priority_scope`.
**limits\[priority\_scope]** `string`
Which messages count for `priority_window_hours`. Allowed values: `all`, `campaigns`, `pipelines_all`, `pipelines_other`.
**limits\[frequency\_cap\_email\_count]** `integer`
Maximum number of e-mails a contact can receive in `frequency_cap_email_days` days. Range `1`–`50`.
**limits\[frequency\_cap\_email\_days]** `integer`
Length of the e-mail frequency cap period in days. Range `1`–`7`.
**limits\[frequency\_cap\_email\_scope]** `string`
Which e-mails count for the e-mail frequency cap. Allowed values: `all`, `campaigns`, `pipelines_all`, `pipelines_other`.
**limits\[frequency\_cap\_sms\_count]** `integer`
Maximum number of SMS messages a contact can receive in `frequency_cap_sms_days` days. Range `1`–`50`.
**limits\[frequency\_cap\_sms\_days]** `integer`
Length of the SMS frequency cap period in days. Range `1`–`7`.
**limits\[frequency\_cap\_sms\_scope]** `string`
Which SMS messages count for the SMS frequency cap. Allowed values: `all`, `campaigns`, `pipelines_all`, `pipelines_other`.
> [!NOTE]
>
> Each frequency cap is all or nothing: when you send one of its three fields (`count`, `days`, `scope`), you must send the other two.
> The scope `pipelines_other` means "other automations than the one that sends the message", so it applies only to automation actions.
> An account can have at most 50 custom rules.
```bash cURL theme={null}
curl -X POST https://api2.ecomailapp.cz/smart-delivery/rules \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Weekend",
"description": "Weekend sends",
"applicability": "campaign",
"limits": {
"priority_window_hours": 12,
"priority_scope": "all",
"frequency_cap_email_count": 2,
"frequency_cap_email_days": 7,
"frequency_cap_email_scope": "all"
}
}'
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/smart-delivery/rules');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'name' => 'Weekend',
'description' => 'Weekend sends',
'applicability' => 'campaign',
'limits' => [
'priority_window_hours' => 12,
'priority_scope' => 'all',
'frequency_cap_email_count' => 2,
'frequency_cap_email_days' => 7,
'frequency_cap_email_scope' => 'all',
],
]));
$response = curl_exec($ch);
curl_close($ch);
```
```json 201 theme={null}
{
"success": true,
"data": {
"id": "aB3dE5fG7h",
"name": "Weekend",
"description": "Weekend sends",
"is_system": false,
"applicability": "campaign",
"limits": {
"priority_window_hours": 12,
"priority_scope": "all",
"frequency_cap_email_count": 2,
"frequency_cap_email_days": 7,
"frequency_cap_email_scope": "all",
"frequency_cap_sms_count": null,
"frequency_cap_sms_days": null,
"frequency_cap_sms_scope": null
},
"usage": null
}
}
```
```json 422 theme={null}
{
"success": false,
"message": "Validation errors",
"data": {
"limits.frequency_cap_email_days": ["The limits.frequency cap email days field is required when limits.frequency cap email count / limits.frequency cap email scope is present."],
"limits.frequency_cap_email_scope": ["The limits.frequency cap email scope field is required when limits.frequency cap email count / limits.frequency cap email days is present."]
}
}
```
```json 422 theme={null}
{
"success": false,
"message": "You have reached the maximum number of custom sending policies."
}
```
# Delete smart delivery rule
Source: https://docs.ecomail.cz/api-reference/smart-delivery/delete
DELETE https://api2.ecomailapp.cz/smart-delivery/rules/{id}
Delete a custom smart delivery rule that no campaign or automation uses.
**id** `string` *required*
ID of the custom rule.
> [!NOTE]
>
> System rules (`standard`, `unlimited`) cannot be deleted and return `403`.
> A rule used by a campaign or an automation action cannot be deleted. The `409` response lists the campaigns and automation actions that use it.
> A successful delete returns `204` with no body.
```bash cURL theme={null}
curl -X DELETE https://api2.ecomailapp.cz/smart-delivery/rules/aB3dE5fG7h \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/smart-delivery/rules/aB3dE5fG7h');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 204 theme={null}
```
```json 403 theme={null}
{
"success": false,
"message": "System sending policies cannot be edited or deleted."
}
```
```json 404 theme={null}
{
"success": false,
"message": "Sending policy not found."
}
```
```json 409 theme={null}
{
"success": false,
"message": "This sending policy cannot be deleted because it is used in campaigns or automations.",
"data": {
"count": 2,
"pipelines": [
{
"pipeline_id": 42,
"action_id": "4f6c2a9e-1b7d-4e3a-9c8f-2d5b6a7e8f90"
}
],
"campaigns": [
{
"campaign_id": 1234,
"title": "Newsletter"
}
]
}
}
```
# List smart delivery rules
Source: https://docs.ecomail.cz/api-reference/smart-delivery/list-all
GET https://api2.ecomailapp.cz/smart-delivery/rules
Return every smart delivery rule of the account — the two system rules first, then the custom rules.
**applicability** `string`
Return only the rules usable in this area. Allowed values: `campaign`, `pipeline`, `both`. A rule with applicability `both` matches every filter value.
**with\_usages** `boolean` (default: false)
Add the `usage` object to each rule — the campaigns and automation actions that use the rule. Without this parameter `usage` is `null`.
> [!NOTE]
>
> Every account has two system rules: `standard` and `unlimited`. You can change the limits of `standard`, but not its name. You cannot change or delete `unlimited`.
```bash cURL theme={null}
curl -X GET "https://api2.ecomailapp.cz/smart-delivery/rules?applicability=campaign&with_usages=1" \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/smart-delivery/rules?applicability=campaign&with_usages=1');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"success": true,
"data": [
{
"id": "standard",
"name": "Standard",
"description": "At most one e-mail anywhere in the last 16 hours.",
"is_system": true,
"applicability": "both",
"limits": {
"priority_window_hours": 16,
"priority_scope": "all",
"frequency_cap_email_count": null,
"frequency_cap_email_days": null,
"frequency_cap_email_scope": null,
"frequency_cap_sms_count": null,
"frequency_cap_sms_days": null,
"frequency_cap_sms_scope": null
},
"usage": {
"count": 0,
"pipelines": [],
"campaigns": []
}
},
{
"id": "aB3dE5fG7h",
"name": "Weekend",
"description": "Weekend sends",
"is_system": false,
"applicability": "campaign",
"limits": {
"priority_window_hours": 12,
"priority_scope": "all",
"frequency_cap_email_count": 2,
"frequency_cap_email_days": 7,
"frequency_cap_email_scope": "all",
"frequency_cap_sms_count": null,
"frequency_cap_sms_days": null,
"frequency_cap_sms_scope": null
},
"usage": {
"count": 2,
"pipelines": [
{
"pipeline_id": 42,
"action_id": "4f6c2a9e-1b7d-4e3a-9c8f-2d5b6a7e8f90"
}
],
"campaigns": [
{
"campaign_id": 1234,
"title": "Newsletter"
}
]
}
}
]
}
```
```json 422 theme={null}
{
"success": false,
"message": "Validation errors",
"data": {
"applicability": ["The selected applicability is invalid."]
}
}
```
# Update smart delivery rule
Source: https://docs.ecomail.cz/api-reference/smart-delivery/update
PUT https://api2.ecomailapp.cz/smart-delivery/rules/{id}
Replace a smart delivery rule with the sent values. A field you omit is cleared.
**id** `string` *required*
ID of the rule. Use `standard` to change the limits of the system Standard rule.
**name** `string` *required*
Name of the rule. Max 255 characters. Not required for `standard`, and ignored for it: the system rule keeps its name.
**description** `string`
Description of the rule. Max 1000 characters. When you omit it, the description is cleared.
**applicability** `string` (default: both)
Where the rule can be used. Allowed values: `campaign`, `pipeline`, `both`. When you omit it, the rule is set to `both`.
**limits** `object` *required*
The limits of the rule. Send `null` or omit a field to switch that limit off.
**limits properties**
**limits\[priority\_window\_hours]** `integer`
Skip a contact who received a message in the last N hours. Range `0`–`24`. Requires `priority_scope`.
**limits\[priority\_scope]** `string`
Which messages count for `priority_window_hours`. Allowed values: `all`, `campaigns`, `pipelines_all`, `pipelines_other`.
**limits\[frequency\_cap\_email\_count]** `integer`
Maximum number of e-mails a contact can receive in `frequency_cap_email_days` days. Range `1`–`50`.
**limits\[frequency\_cap\_email\_days]** `integer`
Length of the e-mail frequency cap period in days. Range `1`–`7`.
**limits\[frequency\_cap\_email\_scope]** `string`
Which e-mails count for the e-mail frequency cap. Allowed values: `all`, `campaigns`, `pipelines_all`, `pipelines_other`.
**limits\[frequency\_cap\_sms\_count]** `integer`
Maximum number of SMS messages a contact can receive in `frequency_cap_sms_days` days. Range `1`–`50`.
**limits\[frequency\_cap\_sms\_days]** `integer`
Length of the SMS frequency cap period in days. Range `1`–`7`.
**limits\[frequency\_cap\_sms\_scope]** `string`
Which SMS messages count for the SMS frequency cap. Allowed values: `all`, `campaigns`, `pipelines_all`, `pipelines_other`.
> [!NOTE]
>
> The system rule `unlimited` cannot be changed and returns `403`.
> You cannot narrow `applicability` to an area that excludes a campaign, an automation action, or an account default that already uses the rule. The `409` response lists what blocks the change.
```bash cURL theme={null}
curl -X PUT https://api2.ecomailapp.cz/smart-delivery/rules/aB3dE5fG7h \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Weekend",
"applicability": "both",
"limits": {
"priority_window_hours": 4,
"priority_scope": "all"
}
}'
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/smart-delivery/rules/aB3dE5fG7h');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'name' => 'Weekend',
'applicability' => 'both',
'limits' => [
'priority_window_hours' => 4,
'priority_scope' => 'all',
],
]));
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"success": true,
"data": {
"id": "aB3dE5fG7h",
"name": "Weekend",
"description": null,
"is_system": false,
"applicability": "both",
"limits": {
"priority_window_hours": 4,
"priority_scope": "all",
"frequency_cap_email_count": null,
"frequency_cap_email_days": null,
"frequency_cap_email_scope": null,
"frequency_cap_sms_count": null,
"frequency_cap_sms_days": null,
"frequency_cap_sms_scope": null
},
"usage": null
}
}
```
```json 403 theme={null}
{
"success": false,
"message": "System sending policies cannot be edited or deleted."
}
```
```json 404 theme={null}
{
"success": false,
"message": "Sending policy not found."
}
```
```json 409 theme={null}
{
"success": false,
"message": "This sending policy cannot be narrowed because it is already used in the excluded area.",
"data": {
"applicability": "pipeline",
"defaults": [],
"usage": {
"count": 1,
"pipelines": [],
"campaigns": [
{
"campaign_id": 1234,
"title": "Newsletter"
}
]
}
}
}
```
```json 422 theme={null}
{
"success": false,
"message": "Validation errors",
"data": {
"limits.priority_scope": ["The limits.priority scope field is required when limits.priority window hours is present."]
}
}
```
# Get automation log
Source: https://docs.ecomail.cz/api-reference/subscribers/automation-log
GET https://api2.ecomailapp.cz/subscribers/{email}/automation-log
Retrieve a paginated list of automation (pipeline) log entries for a given subscriber email address, sorted by timestamp descending by default.
**email** `string` *required*
Subscriber's email address.
**per\_page** `integer`
Number of results per page. Default `20`, maximum `100`.
**page** `integer`
Page number.
**sort\_by** `string`
Column to sort by. Possible values: `timestamp`, `id`, `pipeline_id`. Default `timestamp`.
**sort\_dir** `string`
Sort direction. Possible values: `asc`, `desc`. Default `desc`.
```bash cURL theme={null}
curl "https://api2.ecomailapp.cz/subscribers/foo@bar.cz/automation-log?per_page=10" \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$email = 'foo@bar.cz';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/subscribers/{$email}/automation-log?per_page=10");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"automation_log": [
{
"id": 5678,
"user_id": 1,
"pipeline_id": 42,
"action_id": "node_abc123",
"trigger_id": "trigger_xyz",
"email": "foo@bar.cz",
"props": {"key": "value"},
"next": null,
"timestamp": "2025-03-15T14:30:00.000000Z"
}
],
"current_page": 1,
"per_page": 10,
"total": 1,
"last_page": 1
}
```
# Delete subscriber
Source: https://docs.ecomail.cz/api-reference/subscribers/delete
DELETE https://api2.ecomailapp.cz/subscribers/{email}/delete
Permanently delete a subscriber from the database.
**email** `string` *required*
Subscriber's email address.
```bash cURL theme={null}
curl -X DELETE https://api2.ecomailapp.cz/subscribers/foo@bar.cz/delete \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$email = 'foo@bar.cz';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/subscribers/{$email}/delete");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"deleted": true
}
```
# Get email log
Source: https://docs.ecomail.cz/api-reference/subscribers/email-log
GET https://api2.ecomailapp.cz/subscribers/{email}/email-log
Retrieve a paginated list of campaign log entries for a given subscriber email address, sorted by occurrence date descending.
**email** `string` *required*
Subscriber's email address.
**per\_page** `integer`
Number of results per page. Default `20`, maximum `100`.
**page** `integer`
Page number.
**events\[]** `string`
Filter by event types. Can be specified multiple times. Possible values: `send`, `open`, `click`, `hard_bounce`, `soft_bounce`, `out_of_band`, `unsub`, `spam`, `spam_complaint`.
```bash cURL theme={null}
curl "https://api2.ecomailapp.cz/subscribers/foo@bar.cz/email-log?per_page=10&events[]=open&events[]=click" \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$email = 'foo@bar.cz';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/subscribers/{$email}/email-log?per_page=10&events[]=open&events[]=click");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"current_page": 1,
"data": [
{
"campaign_id": 100,
"autoresponder_id": null,
"action_id": null,
"event": "open",
"msg": null,
"url": null,
"email": "foo@bar.cz",
"occured_at": "2025-03-15T14:30:00.000000Z",
"mail_name": null
},
{
"campaign_id": 100,
"autoresponder_id": null,
"action_id": null,
"event": "click",
"msg": null,
"url": "https://example.com/offer",
"email": "foo@bar.cz",
"occured_at": "2025-03-15T14:25:00.000000Z",
"mail_name": null
}
],
"per_page": 10,
"total": 2
}
```
# Get events for subscriber
Source: https://docs.ecomail.cz/api-reference/subscribers/events
GET https://api2.ecomailapp.cz/subscribers/{email}/events
Retrieve a paginated list of tracker events for a given subscriber email address, sorted by ID descending.
**email** `string` *required*
Subscriber's email address.
**per\_page** `integer`
Number of results per page. Default `20`, maximum `100`.
**page** `integer`
Page number.
```bash cURL theme={null}
curl "https://api2.ecomailapp.cz/subscribers/foo@bar.cz/events?per_page=10" \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$email = 'foo@bar.cz';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/subscribers/{$email}/events?per_page=10");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"current_page": 1,
"data": [
{
"id": 1234,
"email": "foo@bar.cz",
"category": "ue",
"action": "Basket",
"label": "Basket",
"property": null,
"value": "{\"data\":{\"data\":{\"action\":\"Basket\",\"products\":[]}}}",
"timestamp": "2025-03-15T14:30:00.000000Z"
}
],
"per_page": 10,
"total": 1
}
```
# Get subscriber
Source: https://docs.ecomail.cz/api-reference/subscribers/get
GET https://api2.ecomailapp.cz/subscribers/{email}
Get subscriber details globally across all lists in the account.
**email** `string` *required*
Subscriber's email address.
```bash cURL theme={null}
curl https://api2.ecomailapp.cz/subscribers/foo@bar.cz \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$email = 'foo@bar.cz';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/subscribers/{$email}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"subscriber": {
"name": "Foo",
"surname": "Bar",
"email": "foo@bar.cz",
"gender": "male",
"bounce_soft": 0,
"bounced_hard": 0,
"inserted_at": "2018-11-15 13:59:21",
"rating": 2.5,
"country": "CZ",
"tags": ["Completed", "SomeTag"],
"lists": {
"1": {
"id": 407704,
"list_id": 1,
"email": "foo@bar.cz",
"status": 1,
"subscribed_at": "2018-11-15T12:59:21.000000Z",
"source": "app"
}
}
}
}
```
# Get transactions
Source: https://docs.ecomail.cz/api-reference/subscribers/transactions
GET https://api2.ecomailapp.cz/subscribers/{email}/transactions
Retrieve a paginated list of transactions (purchases) for a given subscriber email address, sorted by timestamp descending. Each transaction includes its items.
> [!NOTE]
>
> Timestamps are saved and returned in UTC+0.
**email** `string` *required*
Subscriber's email address.
**per\_page** `integer`
Number of results per page. Default `100`, maximum `500`.
**page** `integer`
Page number.
```bash cURL theme={null}
curl "https://api2.ecomailapp.cz/subscribers/foo@bar.cz/transactions?per_page=50&page=1" \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$email = 'foo@bar.cz';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/subscribers/{$email}/transactions?per_page=50&page=1");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"transactions": [
{
"id": 2220,
"order_id": "5301",
"email": "foo@bar.cz",
"shop": "mujshop.cz",
"amount": 2000,
"tax": 420,
"shipping": 99,
"city": "Praha",
"county": null,
"country": "CZ",
"timestamp": "2025-03-15 14:30:00",
"props": null,
"status": "completed",
"items": [
{
"order_id": "5301",
"code": "SKU-001",
"title": "Product name",
"category": "Electronics",
"price": 1901,
"amount": 1,
"categories": ["Electronics", "Gadgets"]
}
]
}
],
"current_page": 1,
"per_page": 50,
"total": 128,
"last_page": 3
}
```
# Create a new template
Source: https://docs.ecomail.cz/api-reference/templates/create
POST https://api2.ecomailapp.cz/templates
Create a new email template from HTML or from an MJML definition.
Create a template from raw HTML, or from an MJML definition. Send exactly one of `html` and `mjml`.
A template created from an MJML definition is editable in the Ecomail drag-and-drop editor. Ecomail compiles the definition to HTML for you, so the template is ready to send right away. A template created from raw HTML is editable only in the code editor.
**name** `string` *required*
Template name.
**html** `string`
Template HTML content. Required when `mjml` is not sent. Do not combine with `mjml`.
**mjml** `object`
MJML definition of the template, in the same JSON format the Ecomail editor uses. Required when `html` is not sent.
The definition is a tree of nodes. Each node has a `tagName` (an MJML component such as `mj-section`, `mj-column`, `mj-text`, `mj-image`, or `mj-button`), optional `attributes`, and either `children` or `content`. The root node must contain a `children` array.
```bash cURL (HTML) theme={null}
curl -X POST https://api2.ecomailapp.cz/templates \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "New Template",
"html": "Template HTML"
}'
```
```bash cURL (MJML) theme={null}
curl -X POST https://api2.ecomailapp.cz/templates \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "New MJML Template",
"mjml": {
"tagName": "mj-body",
"attributes": {},
"children": [
{
"tagName": "mj-section",
"children": [
{
"tagName": "mj-column",
"children": [
{ "tagName": "mj-text", "content": "Hello from the API" }
]
}
]
}
]
}
}'
```
```php PHP (HTML) theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/templates');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'name' => 'New Template',
'html' => 'Template HTML',
]));
$response = curl_exec($ch);
curl_close($ch);
```
```php PHP (MJML) theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/templates');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'name' => 'New MJML Template',
'mjml' => [
'tagName' => 'mj-body',
'attributes' => (object) [],
'children' => [
[
'tagName' => 'mj-section',
'children' => [
[
'tagName' => 'mj-column',
'children' => [
['tagName' => 'mj-text', 'content' => 'Hello from the API'],
],
],
],
],
],
],
]));
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"id": 1,
"name": "New Template",
"html": "Template HTML"
}
```
```json 422 theme={null}
{
"error": "The mjml definition could not be rendered to html."
}
```
# Get template
Source: https://docs.ecomail.cz/api-reference/templates/get
GET https://api2.ecomailapp.cz/templates/{template_id}
Retrieve a specific template by its ID.
**template\_id** `integer` *required*
Template ID.
```bash cURL theme={null}
curl https://api2.ecomailapp.cz/templates/1234 \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/templates/1234');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"id": 1234,
"folder": 0,
"name": "Some Template Name",
"html": "Html code here...",
"campaign_id": 5678,
"created_at": "2024-02-12 15:13:16",
"updated_at": "2024-02-12 15:13:26"
}
```
# List all templates
Source: https://docs.ecomail.cz/api-reference/templates/list-all
GET https://api2.ecomailapp.cz/templates
Retrieve all email templates in your account.
```bash cURL theme={null}
curl https://api2.ecomailapp.cz/templates \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/templates');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
[
{
"id": 1234,
"folder": 0,
"name": "Some Template Name",
"html": "Html code here...",
"campaign_id": 5678,
"created_at": "2024-02-12 15:13:16",
"updated_at": "2024-02-12 15:13:26"
}
]
```
# Update template
Source: https://docs.ecomail.cz/api-reference/templates/update
PUT https://api2.ecomailapp.cz/templates/{template_id}
Update an existing email template by its ID.
**template\_id** `integer` *required*
Template ID.
**html** `string` *required*
Template HTML content.
**name** `string`
Template name.
**inline\_css** `boolean`
Whether to inline CSS styles into the HTML.
```bash cURL theme={null}
curl -X PUT https://api2.ecomailapp.cz/templates/1234 \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Update Template",
"inline_css": true,
"html": "Template HTML"
}'
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/templates/1234');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'name' => 'Update Template',
'inline_css' => true,
'html' => 'Template HTML',
]));
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"id": 1234,
"name": "Update Template",
"html": "Template HTML",
"folder": 0,
"campaign_id": null,
"created_at": "2024-02-12 15:13:16",
"updated_at": "2024-02-12 16:45:30"
}
```
# Create an event
Source: https://docs.ecomail.cz/api-reference/tracker/create-event
POST https://api2.ecomailapp.cz/tracker/events
Track a custom event for a subscriber. Supplements the JavaScript tracker.
Only the `email` field is required. All other fields (`category`, `action`, `label`, `property`, `value`) are optional — include only what makes sense for your use case.
The `value` field accepts a plain string, a JSON-encoded string, or a JSON object/array. If you pass an object or array, we will automatically JSON-encode it on our side.
> [!NOTE]
>
> `category`, `action`, `label` and `property` are each capped in length. If you send a longer value, it is **automatically truncated** to fit — the request still succeeds and the response reflects the truncated value. `email` and `value` work differently: exceeding their limit fails the whole request with a `422` validation error instead of truncating.
>
> Length caps on `category`, `action`, `label` and `property` are measured in **bytes** of the UTF-8-encoded value, not characters — accented characters, emoji, and other multi-byte characters count as more than one byte each and may be cut off earlier than the byte count suggests.
**event** `object` *required*
Event details.
**event properties**
**event.email** `string` *required*
Subscriber's email address. The subscriber must already exist in your contact list. Maximum length is **150 characters** — longer values are rejected with a `422` error, not truncated.
**event.category** `string`
Event category (e.g. `"shopping"`, `"engagement"`, `"support"`). Maximum length is **255 bytes**; longer values are truncated.
**event.action** `string`
Event action (e.g. `"product_viewed"`, `"form_submitted"`, `"review_left"`). Maximum length is **255 bytes**; longer values are truncated.
**event.label** `string`
Event label — a human-readable name or identifier (e.g. a product name, page title). Maximum length is **255 bytes**; longer values are truncated.
**event.property** `string`
Event property — a custom key or identifier (e.g. a product SKU, category slug). Maximum length is **300 bytes**; longer values are truncated.
**event.value** `string | object | array`
Event value. Can be a plain string, a JSON-encoded string, or a JSON object/array (objects and arrays will be JSON-encoded automatically on our side). Maximum length is **20,000 characters** (after JSON encoding, if applicable) — longer values are rejected with a `422` error, not truncated.
```bash cURL theme={null}
curl -X POST https://api2.ecomailapp.cz/tracker/events \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"event": {
"email": "john@example.com",
"category": "shopping",
"action": "product_viewed",
"label": "Nike Air Max 90",
"property": "nike-air-max-90",
"value": {
"product_id": 12345,
"price": 139.99,
"currency": "EUR",
"variant": "Black/White",
"url": "https://example.com/products/nike-air-max-90"
}
}
}'
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/tracker/events');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'event' => [
'email' => 'john@example.com',
'category' => 'shopping',
'action' => 'product_viewed',
'label' => 'Nike Air Max 90',
'property' => 'nike-air-max-90',
'value' => [
'product_id' => 12345,
'price' => 139.99,
'currency' => 'EUR',
'variant' => 'Black/White',
'url' => 'https://example.com/products/nike-air-max-90',
],
],
]));
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"id": 1234,
"email": "john@example.com",
"category": "shopping",
"action": "product_viewed",
"label": "Nike Air Max 90",
"property": "nike-air-max-90",
"value": "{\"product_id\":12345,\"price\":139.99,\"currency\":\"EUR\",\"variant\":\"Black/White\",\"url\":\"https://example.com/products/nike-air-max-90\"}"
}
```
# Get event by ID
Source: https://docs.ecomail.cz/api-reference/tracker/get-event
GET https://api2.ecomailapp.cz/tracker/events/{id}
Retrieve a single tracker event by its ID.
**id** `integer` *required*
Event ID.
```bash cURL theme={null}
curl "https://api2.ecomailapp.cz/tracker/events/1234" \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$id = 1234;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/tracker/events/{$id}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"id": 1234,
"duid": null,
"email": "foo@bar.cz",
"category": "ue",
"action": "Basket",
"label": "Basket",
"property": null,
"value": "{\"data\":{\"data\":{\"action\":\"Basket\",\"products\":[]}}}",
"timestamp": "2025-03-15T14:30:00.000000Z",
"campaign_attr": null,
"pipeline_attr": null
}
```
```json 404 theme={null}
{
"message": "Event not found"
}
```
# Double opt-in stats
Source: https://docs.ecomail.cz/api-reference/transactional/doi-stats
GET https://api2.ecomailapp.cz/transactional/stats/doi
Get statistics for double opt-in emails for the past 6 months.
```bash cURL theme={null}
curl https://api2.ecomailapp.cz/transactional/stats/doi \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/transactional/stats/doi');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"stats": {
"open_rate": 69.34,
"click_rate": 81.01,
"bounce_rate": 2.52,
"count_injected": 449,
"count_accepted": 437,
"count_delivered": 437,
"count_unique_rendered": 303,
"count_rendered": 545,
"count_clicked": 417,
"count_unique_clicked": 354,
"count_bounce": 11,
"count_hard_bounce": 4,
"count_soft_bounce": 1,
"count_rejected": 0,
"count_spam_complaint": 0
}
}
```
# Send transactional email
Source: https://docs.ecomail.cz/api-reference/transactional/send-message
POST https://api2.ecomailapp.cz/transactional/send-message
Send a transactional email with custom content.
> [!NOTE]
>
> Transactional emails are only available for paid accounts with a verified sending domain.
> [!NOTE]
>
> The total data limit for sent merge tags is 100,000 bytes. Message size including attachments must be under 4 MB.
> [!NOTE]
>
> Reserved variables that cannot be used as merge tag names: `address.name`, `email`, `email_id`, `address.email`, `env_from`.
> [!NOTE]
>
> When using HTML code in global merge vars, use curly braces around the tag in HTML content: `{*|htmlcode|*}` renders the HTML, while `*|htmlcode|*` shows raw HTML.
> [!NOTE]
>
> To send to multiple CC/BCC recipients, include multiple objects in the `to` array with the same email but different `cc`/`bcc` values.
**message** `object` *required*
The message object containing all email details.
**message properties**
**message.subject** `string` *required*
Email subject line.
**message.from\_name** `string` *required*
Sender's display name.
**message.from\_email** `string` *required*
Sender's email address. Must be from a verified domain.
**message.reply\_to** `string`
Reply-to email address.
**message.text** `string`
Plain text content. Either `text` or `html` is required.
**message.html** `string`
HTML content. Either `text` or `html` is required.
**message.amp\_html** `string`
AMP HTML content.
**message.to** `array` *required*
Array of recipient objects.
**recipient object properties**
**message.to\[].email** `string` *required*
Recipient's email address.
**message.to\[].name** `string`
Recipient's display name.
**message.to\[].cc** `string`
CC email address.
**message.to\[].bcc** `string`
BCC email address.
**message.global\_merge\_vars** `array`
Array of merge tag objects for personalization.
**merge var properties**
**message.global\_merge\_vars\[].name** `string`
Merge tag name.
**message.global\_merge\_vars\[].content** `string`
Merge tag value.
**message.attachments** `array`
Array of attachment objects.
**attachment properties**
**message.attachments\[].type** `string`
MIME type of the attachment.
**message.attachments\[].name** `string`
File name of the attachment.
**message.attachments\[].content** `string`
Base64 encoded file content.
**message.options** `object`
Tracking options.
**options properties**
**message.options.click\_tracking** `boolean`
Enable click tracking.
**message.options.open\_tracking** `boolean`
Enable open tracking.
```bash cURL theme={null}
curl -X POST https://api2.ecomailapp.cz/transactional/send-message \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"message": {
"subject": "Email subject",
"from_name": "Sender'\''s name",
"from_email": "foo@bar.cz",
"reply_to": "foo@bar.cz",
"text": "Plain text content",
"html": "Email HTML content",
"to": [
{
"email": "to@me.com",
"name": "Recipient'\''s name",
"cc": "cc@me.com",
"bcc": "bcc@me.com"
}
],
"global_merge_vars": [
{"name": "mergeTagName", "content": "mergeTagValue"}
],
"attachments": [
{
"type": "mime/type",
"name": "attachment-name.pdf",
"content": "base64encodedcontent"
}
],
"options": {
"click_tracking": true,
"open_tracking": true
}
}
}'
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/transactional/send-message');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'message' => [
'subject' => 'Email subject',
'from_name' => "Sender's name",
'from_email' => 'foo@bar.cz',
'reply_to' => 'foo@bar.cz',
'text' => 'Plain text content',
'html' => 'Email HTML content',
'to' => [
[
'email' => 'to@me.com',
'name' => "Recipient's name",
'cc' => 'cc@me.com',
'bcc' => 'bcc@me.com',
],
],
'global_merge_vars' => [
['name' => 'mergeTagName', 'content' => 'mergeTagValue'],
],
'attachments' => [
[
'type' => 'mime/type',
'name' => 'attachment-name.pdf',
'content' => 'base64encodedcontent',
],
],
'options' => [
'click_tracking' => true,
'open_tracking' => true,
],
],
]));
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"results": {
"total_rejected_recipients": 0,
"total_accepted_recipients": 2,
"id": 11668787484950529
}
}
```
# Send transactional template
Source: https://docs.ecomail.cz/api-reference/transactional/send-template
POST https://api2.ecomailapp.cz/transactional/send-template
Send a transactional email using a pre-defined template.
**message** `object` *required*
The message object containing all email details.
**message properties**
**message.template\_id** `integer` *required*
ID of the template to use.
**message.subject** `string` *required*
Email subject line.
**message.from\_name** `string` *required*
Sender's display name.
**message.from\_email** `string` *required*
Sender's email address. Must be from a verified domain.
**message.reply\_to** `string`
Reply-to email address.
**message.to** `array` *required*
Array of recipient objects.
**recipient object properties**
**message.to\[].email** `string` *required*
Recipient's email address.
**message.to\[].name** `string`
Recipient's display name.
**message.to\[].cc** `string`
CC email address.
**message.to\[].bcc** `string`
BCC email address.
**message.global\_merge\_vars** `array`
Array of merge tag objects for personalization.
**merge var properties**
**message.global\_merge\_vars\[].name** `string`
Merge tag name.
**message.global\_merge\_vars\[].content** `string`
Merge tag value.
**message.attachments** `array`
Array of attachment objects.
**attachment properties**
**message.attachments\[].type** `string`
MIME type of the attachment.
**message.attachments\[].name** `string`
File name of the attachment.
**message.attachments\[].content** `string`
Base64 encoded file content.
**message.options** `object`
Tracking options.
**options properties**
**message.options.click\_tracking** `boolean`
Enable click tracking.
**message.options.open\_tracking** `boolean`
Enable open tracking.
```bash cURL theme={null}
curl -X POST https://api2.ecomailapp.cz/transactional/send-template \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"message": {
"template_id": 1,
"subject": "Email subject",
"from_name": "Sender'\''s name",
"from_email": "foo@bar.cz",
"reply_to": "foo@bar.cz",
"to": [
{
"email": "to@me.com",
"name": "Recipient'\''s name"
}
],
"global_merge_vars": [
{"name": "mergeTagName", "content": "mergeTagValue"}
],
"options": {
"click_tracking": true,
"open_tracking": true
}
}
}'
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/transactional/send-template');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'message' => [
'template_id' => 1,
'subject' => 'Email subject',
'from_name' => "Sender's name",
'from_email' => 'foo@bar.cz',
'reply_to' => 'foo@bar.cz',
'to' => [
[
'email' => 'to@me.com',
'name' => "Recipient's name",
],
],
'global_merge_vars' => [
['name' => 'mergeTagName', 'content' => 'mergeTagValue'],
],
'options' => [
'click_tracking' => true,
'open_tracking' => true,
],
],
]));
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"results": {
"total_rejected_recipients": 0,
"total_accepted_recipients": 2,
"id": 11668787484950529
}
}
```
# Transactional email stats
Source: https://docs.ecomail.cz/api-reference/transactional/stats
GET https://api2.ecomailapp.cz/transactional/stats
Get statistics for transactional emails for the past 6 months.
```bash cURL theme={null}
curl https://api2.ecomailapp.cz/transactional/stats \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/transactional/stats');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"stats": {
"open_rate": 85.71,
"click_rate": 0,
"bounce_rate": 0,
"count_injected": 21,
"count_accepted": 21,
"count_delivered": 21,
"count_unique_rendered": 18,
"count_rendered": 126,
"count_clicked": 0,
"count_unique_clicked": 0,
"count_bounce": 0,
"count_hard_bounce": 0,
"count_soft_bounce": 0,
"count_rejected": 0,
"count_spam_complaint": 0
}
}
```
# Create a transaction
Source: https://docs.ecomail.cz/api-reference/transactions/create
POST https://api2.ecomailapp.cz/tracker/transaction
Create a new transaction for a subscriber.
> [!NOTE]
>
> Timestamps are saved and returned in UTC+0.
**transaction** `object` *required*
Transaction details.
**transaction properties**
**transaction.order\_id** `string` *required*
Your unique transaction ID.
**transaction.email** `string` *required*
Subscriber's email address.
**transaction.shop** `string`
Name of your shop, used in conditionals in the app. Case sensitive. An empty value results in not being able to select the shop in segments.
**transaction.amount** `number`
Total amount including tax and shipping.
**transaction.tax** `number`
Tax amount only.
**transaction.shipping** `number`
Shipping amount only.
**transaction.city** `string`
Delivery city.
**transaction.county** `string`
Delivery county.
**transaction.country** `string`
Delivery country.
**transaction.timestamp** `integer`
Unix timestamp of the transaction.
**transaction.props** `string|object`
Optional properties, used in conditionals.
**transaction.status** `string`
Transaction status. Accepted values: `processing`, `canceled`, `pending`, `completed`, `null`.
**transaction\_items** `array` *required*
Array of transaction items.
**transaction item properties**
**transaction\_items\[].code** `string`
Product code.
**transaction\_items\[].title** `string`
Product name.
**transaction\_items\[].category** `string`
Deprecated. Use `categories` instead.
**transaction\_items\[].categories** `array`
List of product categories. Limited to 100 characters per category and 20 categories per item.
**transaction\_items\[].price** `number`
Total price for the given quantity.
**transaction\_items\[].amount** `number`
Quantity of the product.
**transaction\_items\[].tags** `array`
Optional item tags. Limited to 5000 characters per account.
```bash cURL theme={null}
curl -X POST https://api2.ecomailapp.cz/tracker/transaction \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"transaction": {
"order_id": "transaction_1234",
"email": "foo@bar.cz",
"shop": "myshop.cz",
"amount": 1500,
"tax": 200,
"shipping": 100,
"city": "Praha",
"timestamp": 1441905935,
"status": "completed"
},
"transaction_items": [
{
"code": "product code",
"title": "product name",
"categories": ["my category 1", "my category 2"],
"price": 1500,
"amount": 1,
"tags": ["M", "3+", "puzzle"]
}
]
}'
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/tracker/transaction');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'transaction' => [
'order_id' => 'transaction_1234',
'email' => 'foo@bar.cz',
'shop' => 'myshop.cz',
'amount' => 1500,
'tax' => 200,
'shipping' => 100,
'city' => 'Praha',
'timestamp' => 1441905935,
'status' => 'completed',
],
'transaction_items' => [
[
'code' => 'product code',
'title' => 'product name',
'categories' => ['my category 1', 'my category 2'],
'price' => 1500,
'amount' => 1,
'tags' => ['M', '3+', 'puzzle'],
],
],
]));
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"order_id": "transaction_1234",
"email": "foo@bar.cz",
"shop": "myshop.cz",
"amount": 1500,
"timestamp": "2015-09-10 17:25:35",
"id": 1,
"status": "completed"
}
```
```json 422 theme={null}
{
"errors": {
"transaction.order_id": ["The transaction.order id has already been taken."]
}
}
```
# Create bulk transactions
Source: https://docs.ecomail.cz/api-reference/transactions/create-bulk
POST https://api2.ecomailapp.cz/tracker/transaction-bulk
Create multiple transactions in a single request.
> [!NOTE]
>
> Limited to 1000 transactions per request. Bulk imports do **not** trigger automations with the "Makes an order" trigger.
> [!NOTE]
>
> Timestamps are saved and returned in UTC+0.
**transaction\_data** `array` *required*
Array of transaction objects, each containing a `transaction` and `transaction_items` object with the same structure as the [single create endpoint](/api-reference/transactions/create).
**transaction\_data item properties**
**transaction\_data\[].transaction** `object` *required*
Transaction details. See [Create a transaction](/api-reference/transactions/create) for all available properties.
**transaction\_data\[].transaction\_items** `array` *required*
Array of transaction items. See [Create a transaction](/api-reference/transactions/create) for all available properties.
```bash cURL theme={null}
curl -X POST https://api2.ecomailapp.cz/tracker/transaction-bulk \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"transaction_data": [
{
"transaction": {
"order_id": "transaction_1001",
"email": "foo@bar.cz",
"shop": "myshop.cz",
"amount": 1000,
"timestamp": 1673342224,
"status": "completed"
},
"transaction_items": [
{
"code": "product code 1",
"title": "product name 1",
"price": 400,
"amount": "1"
}
]
}
]
}'
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/tracker/transaction-bulk');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'transaction_data' => [
[
'transaction' => [
'order_id' => 'transaction_1001',
'email' => 'foo@bar.cz',
'shop' => 'myshop.cz',
'amount' => 1000,
'timestamp' => 1673342224,
'status' => 'completed',
],
'transaction_items' => [
[
'code' => 'product code 1',
'title' => 'product name 1',
'price' => 400,
'amount' => '1',
],
],
],
],
]));
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"inserts": 2
}
```
# Delete a transaction
Source: https://docs.ecomail.cz/api-reference/transactions/delete
DELETE https://api2.ecomailapp.cz/tracker/transaction/{order_id}/delete
Delete a single transaction by order ID.
**order\_id** `string` *required*
Order ID from your shop.
**transaction\_data** `object`
Optional filter to match the transaction by shop.
**transaction\_data properties**
**transaction\_data.shop** `string`
If provided, the transaction is only deleted if it matches this shop value.
```bash cURL theme={null}
curl -X DELETE https://api2.ecomailapp.cz/tracker/transaction/transaction_1234/delete \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"transaction_data": {
"shop": "someshop.com"
}
}'
```
```php PHP theme={null}
$orderId = 'transaction_1234';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/tracker/transaction/{$orderId}/delete");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'transaction_data' => [
'shop' => 'someshop.com',
],
]));
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"deleted": true
}
```
# Delete bulk transactions
Source: https://docs.ecomail.cz/api-reference/transactions/delete-bulk
DELETE https://api2.ecomailapp.cz/tracker/transaction/delete-bulk
Delete multiple transactions in a single request.
> [!NOTE]
>
> Limited to 1000 transactions per request.
**transaction\_data** `array` *required*
Array of transaction identifiers to delete.
**transaction\_data item properties**
**transaction\_data\[].order\_id** `string` *required*
Order ID of the transaction to delete.
**transaction\_data\[].shop** `string`
If provided, the transaction is only deleted if it matches this shop value.
```bash cURL theme={null}
curl -X DELETE https://api2.ecomailapp.cz/tracker/transaction/delete-bulk \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"transaction_data": [
{"order_id": "1000001"},
{"order_id": "1000025", "shop": "someshop.com"}
]
}'
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/tracker/transaction/delete-bulk');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'transaction_data' => [
['order_id' => '1000001'],
['order_id' => '1000025', 'shop' => 'someshop.com'],
],
]));
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"deleted": 2
}
```
```json 422 theme={null}
{
"errors": {
"transaction_data": ["The transaction data may not have more than 1000 items."]
}
}
```
# Get transactions
Source: https://docs.ecomail.cz/api-reference/transactions/get
GET https://api2.ecomailapp.cz/tracker/transaction
Retrieve a paginated list of transactions with optional filters.
> [!NOTE]
>
> Timestamps are saved and returned in UTC+0.
**shop** `string`
Filter by exact shop name.
**email** `string`
Filter by email address.
**date\_from** `string`
Start date filter in `YYYY-MM-DD` format.
**date\_to** `string`
End date filter in `YYYY-MM-DD` format.
**per\_page** `integer`
Number of results per page. Maximum `500`.
**page** `integer`
Page number.
```bash cURL theme={null}
curl "https://api2.ecomailapp.cz/tracker/transaction?shop=mujshop.cz&per_page=100&page=1" \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/tracker/transaction?shop=mujshop.cz&per_page=100&page=1');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"current_page": 1,
"data": [
{
"id": 2220,
"order_id": "5301",
"email": "foo@bar.cz",
"shop": "mujshop.cz",
"amount": 2000,
"timestamp": "2023-02-15 09:40:56",
"status": null,
"items": [
{
"code": "product code 1",
"title": "product name 1",
"categories": ["product category 1"],
"price": 400,
"amount": "1"
}
]
}
],
"per_page": 100,
"total": 234
}
```
# Update a transaction
Source: https://docs.ecomail.cz/api-reference/transactions/update
PUT https://api2.ecomailapp.cz/tracker/transaction/{order_id}
Overwrite an existing transaction with new data.
> [!NOTE]
>
> This endpoint overwrites the entire order with the new data from the request.
> [!NOTE]
>
> Timestamps are saved and returned in UTC+0.
**order\_id** `string` *required*
Order ID of the transaction to update.
**transaction** `object` *required*
Transaction details. Same structure as the [Create a transaction](/api-reference/transactions/create) endpoint.
**transaction properties**
**transaction.order\_id** `string` *required*
Your unique transaction ID.
**transaction.email** `string` *required*
Subscriber's email address.
**transaction.shop** `string`
Name of your shop.
**transaction.amount** `number`
Total amount including tax and shipping.
**transaction.tax** `number`
Tax amount only.
**transaction.shipping** `number`
Shipping amount only.
**transaction.city** `string`
Delivery city.
**transaction.county** `string`
Delivery county.
**transaction.country** `string`
Delivery country.
**transaction.timestamp** `integer`
Unix timestamp of the transaction.
**transaction.props** `string|object`
Optional properties, used in conditionals.
**transaction.status** `string`
Transaction status. Accepted values: `processing`, `canceled`, `pending`, `completed`, `null`.
**transaction\_items** `array` *required*
Array of transaction items. Same structure as the [Create a transaction](/api-reference/transactions/create) endpoint.
**transaction item properties**
**transaction\_items\[].code** `string`
Product code.
**transaction\_items\[].title** `string`
Product name.
**transaction\_items\[].category** `string`
Deprecated. Use `categories` instead.
**transaction\_items\[].categories** `array`
List of product categories.
**transaction\_items\[].price** `number`
Total price for the given quantity.
**transaction\_items\[].amount** `number`
Quantity of the product.
**transaction\_items\[].tags** `array`
Optional item tags.
```bash cURL theme={null}
curl -X PUT https://api2.ecomailapp.cz/tracker/transaction/transaction_1234 \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"transaction": {
"order_id": "transaction_1234",
"email": "foo@bar.cz",
"shop": "myshop.cz",
"amount": 1500,
"tax": 200,
"shipping": 100,
"city": "Praha",
"timestamp": 1441905935,
"status": "completed"
},
"transaction_items": [
{
"code": "product code",
"title": "product name",
"categories": ["my category 1", "my category 2"],
"price": 1500,
"amount": 1,
"tags": ["M", "3+", "puzzle"]
}
]
}'
```
```php PHP theme={null}
$orderId = 'transaction_1234';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/tracker/transaction/{$orderId}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'transaction' => [
'order_id' => 'transaction_1234',
'email' => 'foo@bar.cz',
'shop' => 'myshop.cz',
'amount' => 1500,
'tax' => 200,
'shipping' => 100,
'city' => 'Praha',
'timestamp' => 1441905935,
'status' => 'completed',
],
'transaction_items' => [
[
'code' => 'product code',
'title' => 'product name',
'categories' => ['my category 1', 'my category 2'],
'price' => 1500,
'amount' => 1,
'tags' => ['M', '3+', 'puzzle'],
],
],
]));
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{}
```
# Delete webhook URL
Source: https://docs.ecomail.cz/api-reference/webhooks/delete-url
DELETE https://api2.ecomailapp.cz/account/settings/webhook
Remove the currently configured webhook URL.
```bash cURL theme={null}
curl -X DELETE https://api2.ecomailapp.cz/account/settings/webhook \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/account/settings/webhook');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"success": true
}
```
# Webhook events
Source: https://docs.ecomail.cz/api-reference/webhooks/events
Reference of all webhook event types and their payloads delivered to your webhook URL.
When you configure a webhook URL, Ecomail sends HTTP POST requests with JSON payloads for each email event in real time.
## Delivery
Each batch is sent as a **POST** request with `Content-Type: application/json`. Ecomail retries delivery for up to **8 hours** if your endpoint does not respond with a `2xx` status code. Each request has a **10-second timeout**.
Each batch includes the header `X-MessageSystems-Batch-ID` which can be used for deduplication.
## Payload structure
Every webhook payload is an array of event objects wrapped in the following structure:
```json theme={null}
[
{
"msys": {
"message_event": {
"type": "delivery",
"timestamp": "1716300000",
...
}
}
}
]
```
## Ecomail metadata
Every email sent through Ecomail includes the following custom metadata in the `rcpt_meta` field:
| Field | Type | Description |
| - | - | - |
| `campaign_id` | string | ID of the campaign this email belongs to (bulk campaigns only). |
| `pipeline_id` | string | ID of the automation pipeline (automation emails only). |
| `pipeline_action_id` | string | ID of the specific action within the automation pipeline. |
| `subaccount` | string | Your Ecomail account name. |
Example `rcpt_meta` in a payload:
```json theme={null}
{
"msys": {
"message_event": {
"type": "delivery",
"rcpt_meta": {
"campaign_id": "123",
"pipeline_id": "45",
"pipeline_action_id": "67",
"subaccount": "my-account"
},
...
}
}
}
```
***
## Event types
### Delivery
Sent when a message is successfully delivered to the recipient's mail server.
| Field | Type | Description |
| - | - | - |
| `type` | string | `delivery` |
| `timestamp` | string | Unix timestamp of the event. |
| `event_id` | string | Unique event identifier. |
| `message_id` | string | Unique message identifier. |
| `rcpt_to` | string | Recipient email address. |
| `friendly_from` | string | Friendly from address. |
| `subject` | string | Email subject line. |
| `sending_ip` | string | IP address used for sending. |
| `sending_domain` | string | Sender domain. |
| `recipient_domain` | string | Recipient domain portion. |
| `msg_size` | string | Message size in bytes. |
| `rcpt_meta` | object | Custom metadata (see above). |
| `rcpt_tags` | array | Tags applied to the recipient. |
| `delv_method` | string | Delivery protocol (e.g. `esmtp`). |
| `campaign_id` | string | Campaign identifier. |
| `template_id` | string | Template identifier. |
| `transmission_id` | string | Transmission identifier. |
| `customer_id` | string | Customer identifier. |
***
### Bounce
Sent when a message is permanently rejected by the remote mail server.
| Field | Type | Description |
| - | - | - |
| `type` | string | `bounce` |
| `timestamp` | string | Unix timestamp. |
| `event_id` | string | Unique event identifier. |
| `message_id` | string | Unique message identifier. |
| `rcpt_to` | string | Recipient email address. |
| `bounce_class` | string | Bounce classification code. |
| `error_code` | string | Remote server error code. |
| `raw_reason` | string | Exact response from the remote server. |
| `reason` | string | Canonicalized bounce reason. |
| `num_retries` | string | Number of delivery attempts before bounce. |
| `rcpt_meta` | object | Custom metadata. |
| `campaign_id` | string | Campaign identifier. |
| `template_id` | string | Template identifier. |
| `transmission_id` | string | Transmission identifier. |
***
### Spam complaint
Sent when a recipient marks the email as spam.
| Field | Type | Description |
| - | - | - |
| `type` | string | `spam_complaint` |
| `timestamp` | string | Unix timestamp. |
| `event_id` | string | Unique event identifier. |
| `message_id` | string | Unique message identifier. |
| `rcpt_to` | string | Recipient email address. |
| `friendly_from` | string | Friendly from address. |
| `subject` | string | Email subject line. |
| `rcpt_meta` | object | Custom metadata. |
| `campaign_id` | string | Campaign identifier. |
| `template_id` | string | Template identifier. |
| `transmission_id` | string | Transmission identifier. |
***
### Open
Sent when a recipient opens an email (tracked via pixel).
| Field | Type | Description |
| - | - | - |
| `type` | string | `open` |
| `timestamp` | string | Unix timestamp. |
| `event_id` | string | Unique event identifier. |
| `message_id` | string | Unique message identifier. |
| `rcpt_to` | string | Recipient email address. |
| `geo_ip` | object | Geographic info: `country`, `region`, `city`, `latitude`, `longitude`. |
| `ip_address` | string | IP address of the opener. |
| `user_agent` | string | Browser/client user agent string. |
| `rcpt_meta` | object | Custom metadata. |
| `campaign_id` | string | Campaign identifier. |
| `template_id` | string | Template identifier. |
| `transmission_id` | string | Transmission identifier. |
***
### Initial open
Sent only for the **first** open of a message (subsequent opens fire the `open` event).
Fields are identical to the [Open](#open) event with `type` set to `initial_open`.
***
### Click
Sent when a recipient clicks a tracked link in the email.
| Field | Type | Description |
| - | - | - |
| `type` | string | `click` |
| `timestamp` | string | Unix timestamp. |
| `event_id` | string | Unique event identifier. |
| `message_id` | string | Unique message identifier. |
| `rcpt_to` | string | Recipient email address. |
| `target_link_url` | string | The URL that was clicked. |
| `target_link_name` | string | Link identifier/name. |
| `geo_ip` | object | Geographic info: `country`, `region`, `city`, `latitude`, `longitude`. |
| `ip_address` | string | IP address of the clicker. |
| `user_agent` | string | Browser/client user agent string. |
| `rcpt_meta` | object | Custom metadata. |
| `campaign_id` | string | Campaign identifier. |
| `template_id` | string | Template identifier. |
| `transmission_id` | string | Transmission identifier. |
***
### Injection
Sent when a message is received by Ecomail for delivery.
| Field | Type | Description |
| - | - | - |
| `type` | string | `injection` |
| `timestamp` | string | Unix timestamp. |
| `event_id` | string | Unique event identifier. |
| `message_id` | string | Unique message identifier. |
| `rcpt_to` | string | Recipient email address. |
| `msg_from` | string | Envelope sender address. |
| `msg_size` | string | Message size in bytes. |
| `rcpt_meta` | object | Custom metadata. |
| `campaign_id` | string | Campaign identifier. |
| `template_id` | string | Template identifier. |
| `transmission_id` | string | Transmission identifier. |
***
### Delay
Sent when a message delivery is temporarily delayed.
| Field | Type | Description |
| - | - | - |
| `type` | string | `delay` |
| `timestamp` | string | Unix timestamp. |
| `event_id` | string | Unique event identifier. |
| `message_id` | string | Unique message identifier. |
| `rcpt_to` | string | Recipient email address. |
| `error_code` | string | Remote server error code. |
| `raw_reason` | string | Exact response from the remote server. |
| `reason` | string | Canonicalized delay reason. |
| `num_retries` | string | Number of delivery attempts so far. |
| `queue_time` | string | Time spent in queue (ms). |
| `rcpt_meta` | object | Custom metadata. |
| `campaign_id` | string | Campaign identifier. |
| `template_id` | string | Template identifier. |
| `transmission_id` | string | Transmission identifier. |
***
### Out of band bounce
Sent when an asynchronous bounce occurs after initial acceptance.
| Field | Type | Description |
| - | - | - |
| `type` | string | `out_of_band` |
| `timestamp` | string | Unix timestamp. |
| `event_id` | string | Unique event identifier. |
| `message_id` | string | Unique message identifier. |
| `rcpt_to` | string | Recipient email address. |
| `bounce_class` | string | Bounce classification code. |
| `error_code` | string | Remote server error code. |
| `raw_reason` | string | Exact response from the remote server. |
| `reason` | string | Canonicalized bounce reason. |
| `rcpt_meta` | object | Custom metadata. |
| `campaign_id` | string | Campaign identifier. |
***
### Policy rejection
Sent when a message is rejected due to policy rules.
| Field | Type | Description |
| - | - | - |
| `type` | string | `policy_rejection` |
| `timestamp` | string | Unix timestamp. |
| `event_id` | string | Unique event identifier. |
| `message_id` | string | Unique message identifier. |
| `rcpt_to` | string | Recipient email address. |
| `error_code` | string | Error code. |
| `reason` | string | Rejection reason. |
| `rcpt_meta` | object | Custom metadata. |
| `campaign_id` | string | Campaign identifier. |
***
### List unsubscribe
Sent when a recipient unsubscribes via the `List-Unsubscribe` email header.
| Field | Type | Description |
| - | - | - |
| `type` | string | `list_unsubscribe` |
| `timestamp` | string | Unix timestamp. |
| `event_id` | string | Unique event identifier. |
| `message_id` | string | Unique message identifier. |
| `rcpt_to` | string | Recipient email address. |
| `rcpt_meta` | object | Custom metadata. |
| `campaign_id` | string | Campaign identifier. |
| `template_id` | string | Template identifier. |
| `transmission_id` | string | Transmission identifier. |
***
### Link unsubscribe
Sent when a recipient unsubscribes by clicking an unsubscribe link in the email body.
| Field | Type | Description |
| - | - | - |
| `type` | string | `link_unsubscribe` |
| `timestamp` | string | Unix timestamp. |
| `event_id` | string | Unique event identifier. |
| `message_id` | string | Unique message identifier. |
| `rcpt_to` | string | Recipient email address. |
| `rcpt_meta` | object | Custom metadata. |
| `campaign_id` | string | Campaign identifier. |
| `template_id` | string | Template identifier. |
| `transmission_id` | string | Transmission identifier. |
***
### Generation failure
Sent when email generation (template rendering) fails.
| Field | Type | Description |
| - | - | - |
| `type` | string | `generation_failure` |
| `timestamp` | string | Unix timestamp. |
| `event_id` | string | Unique event identifier. |
| `rcpt_to` | string | Recipient email address. |
| `error_code` | string | Error code. |
| `reason` | string | Failure reason. |
| `rcpt_meta` | object | Custom metadata. |
| `template_id` | string | Template identifier. |
| `transmission_id` | string | Transmission identifier. |
***
### Generation rejection
Sent when email generation is rejected due to policy.
| Field | Type | Description |
| - | - | - |
| `type` | string | `generation_rejection` |
| `timestamp` | string | Unix timestamp. |
| `event_id` | string | Unique event identifier. |
| `rcpt_to` | string | Recipient email address. |
| `error_code` | string | Error code. |
| `reason` | string | Rejection reason. |
| `rcpt_meta` | object | Custom metadata. |
| `template_id` | string | Template identifier. |
| `transmission_id` | string | Transmission identifier. |
# Get webhook URL
Source: https://docs.ecomail.cz/api-reference/webhooks/get-url
GET https://api2.ecomailapp.cz/account/settings/webhook
Get the currently configured webhook URL.
```bash cURL theme={null}
curl https://api2.ecomailapp.cz/account/settings/webhook \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json"
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/account/settings/webhook');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"webhook": {
"url": "https://your-webhook-url.com"
}
}
```
# Set webhook URL
Source: https://docs.ecomail.cz/api-reference/webhooks/set-url
POST https://api2.ecomailapp.cz/account/settings/webhook
Set the target webhook URL for campaign statistics.
> [!NOTE]
>
> The webhook sends POST requests as JSON with a 10-second timeout.
**url** `string` *required*
Target webhook URL.
```bash cURL theme={null}
curl -X POST https://api2.ecomailapp.cz/account/settings/webhook \
-H "key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://your-webhook-url.com"
}'
```
```php PHP theme={null}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api2.ecomailapp.cz/account/settings/webhook');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'url' => 'https://your-webhook-url.com',
]));
$response = curl_exec($ch);
curl_close($ch);
```
```json 200 theme={null}
{
"success": true
}
```
# MCP server
Source: https://docs.ecomail.cz/ecomail-ai/mcp
Use the Ecomail API directly from AI tools like Claude, Cursor, and more via the Model Context Protocol.
The [Ecomail MCP server](https://github.com/Ecomailcz/ecomail-public-mcp) lets you manage lists, subscribers, campaigns, automations, transactional emails, e-commerce transactions, templates, domains, and more — directly from any MCP-compatible client like Claude Desktop, Cursor, or Claude Code.
## Requirements
The local server runs through `npx`, so you need **Node.js 20 or later** installed. Verify your version with `node --version` — if the command isn't found or the version is lower, [download the latest LTS release](https://nodejs.org).
> [!TIP]
>
> Don't want to install anything? Use the [remote MCP server](/ecomail-ai/remote-mcp) instead — it runs in the cloud and needs no Node.js.
## Setup
Before you start, obtain your API key:
1. Log in to your Ecomail account
2. Go to **Manage your account** → **For developers**
3. Click **Copy API Key**
## Claude Code
```bash theme={null}
claude mcp add ecomail -e ECOMAIL_API_KEY=your_api_key -- npx -y ecomail-mcp
```
## Cursor
Open the command palette and choose **Cursor Settings** > **MCP** > **Add new global MCP server**.
```json theme={null}
{
"mcpServers": {
"ecomail": {
"command": "npx",
"args": ["-y", "ecomail-mcp"],
"env": {
"ECOMAIL_API_KEY": "your_api_key"
}
}
}
}
```
## Claude Desktop
Open Claude Desktop settings > **Developer** tab > **Edit Config**.
```json theme={null}
{
"mcpServers": {
"ecomail": {
"command": "npx",
"args": ["-y", "ecomail-mcp"],
"env": {
"ECOMAIL_API_KEY": "your_api_key"
}
}
}
}
```
## Options
| Option | Description |
| - | - |
| `ECOMAIL_API_KEY` | Your Ecomail API key (environment variable, required) |
| `--key` | Your Ecomail API key (CLI argument, alternative to env var) |
## Available tools
The MCP server exposes all Ecomail API endpoints as tools:
| Category | Tools |
| - | - |
| **Automations** | `list-automations`, `trigger-automation`, `get-automation-stats`, `get-automation-stats-detail`, `get-automation-stats-emails` |
| **Campaigns** | `list-campaigns`, `create-campaign`, `get-campaign`, `update-campaign`, `send-campaign`, `get-campaign-stats`, `get-campaign-stats-detail`, `get-segment-stats` |
| **Discount coupons** | `import-coupons`, `delete-coupons` |
| **Domains** | `list-domains`, `create-domain`, `delete-domain` |
| **Feeds** | `refresh-product-feed`, `refresh-data-feed` |
| **Lists** | `list-lists`, `create-list`, `get-list`, `update-list`, `get-subscribers`, `get-subscriber-from-list`, `get-subscriber-by-phone`, `subscribe`, `subscribe-bulk`, `unsubscribe`, `update-subscriber`, `get-segments` |
| **Subscribers** | `get-subscriber`, `delete-subscriber`, `find-contact` |
| **Templates** | `create-template`, `get-template` |
| **Tracker events** | `create-event` |
| **Transactional emails** | `send-transactional-email`, `send-transactional-template`, `get-transactional-stats`, `get-doi-stats` |
| **Transactions** | `create-transaction`, `create-bulk-transactions`, `get-transactions`, `update-transaction`, `delete-transaction`, `delete-bulk-transactions` |
| **Webhooks** | `set-webhook-url`, `get-webhook-url`, `delete-webhook-url` |
# Example prompts
Source: https://docs.ecomail.cz/ecomail-ai/mcp-examples
Ready-to-use prompts to get the most out of Ecomail MCP in Claude.ai or ChatGPT.
Once you have the [remote MCP server](/ecomail-ai/remote-mcp) connected, you can talk to your Ecomail account in natural language. Here are some examples to get you started.
## Automations
> [accordion] List active automations
>
> ```
> Show me all active automations with their triggered counts.
> ```
> [accordion] Automation performance
>
> ```
> What are the stats for my welcome email automation? Show opens, clicks and unsubscribes.
> ```
> [accordion] Inspect automation steps
>
> ```
> List all steps in my abandoned cart automation and show me the configuration of each step.
> ```
## Campaigns
> [accordion] Review recent campaigns
>
> ```
> List my last 5 sent campaigns with their open rates and click rates.
> ```
> [accordion] Compare campaign performance
>
> ```
> Compare the open rate and click rate of my last 3 campaigns. Which one performed best?
> ```
> [accordion] Find a specific campaign
>
> ```
> Find the campaign with "Black Friday" in its title and show me the full delivery stats.
> ```
> [accordion] Top clicked links
>
> ```
> Which links got the most clicks in my last campaign?
> ```
> [accordion] Campaigns sent in a period
>
> ```
> List every campaign sent between 1 June and 31 August with its open rate, click rate and unsubscribe rate, sorted by open rate.
> ```
## Contact Lists
> [accordion] List all contact lists
>
> ```
> Show me all my contact lists with their active subscriber counts.
> ```
> [accordion] Contact list detail with segments
>
> ```
> Show me the details for contact list 1 — including sender settings, subscriber stats and all segments with their counts.
> ```
> [accordion] Compare list sizes
>
> ```
> List all my contact lists and tell me which one has the most active subscribers.
> ```
## CDP Analytics
> [!NOTE]
>
> The following examples require CDP (Customer Data Platform) to be enabled on your account.
> [accordion] CLV dashboard
>
> ```
> Show me the CLV dashboard — what is the average customer lifetime value
> and how does churn rate look?
> ```
> [accordion] CLV for a specific customer
>
> ```
> What is the predicted lifetime value for subscriber anna@example.com?
> What is their churn probability?
> ```
> [accordion] CLV segments
>
> ```
> Show me CLV segments — how many customers are in each value tier
> and what is the average CLV per segment?
> ```
> [accordion] Compare conversion periods
>
> ```
> Compare conversion stats for January vs February this year.
> Did revenue from campaigns grow or decline?
> ```
> [accordion] Conversion analytics
>
> ```
> Show me conversion analytics for the last 90 days.
> How many purchases came from campaigns vs automations?
> ```
> [accordion] Product deep-dive
>
> ```
> Show me the product analytics for product PS1000 —
> total revenue, repeat purchase timing and what customers buy next.
> ```
> [accordion] RFM overview
>
> ```
> Show me the current RFM analysis. How many customers are champions vs at risk?
> What percentage of revenue comes from loyal customers?
> ```
> [accordion] Top products
>
> ```
> What are my top 10 products by revenue in the last year?
> ```
## Deliverability
> [accordion] Deliverability overview
>
> ```
> What does my deliverability look like for the last 30 days?
> Show inbox rate, bounce rate and spam complaints.
> ```
> [accordion] Provider-specific
>
> ```
> How is my deliverability at Gmail specifically? Are there any issues I should be aware of?
> ```
> [accordion] Compare periods
>
> ```
> Compare my deliverability for the last 30 days vs the previous 30 days.
> Did bounce rate or spam complaints improve?
> ```
> [accordion] Filter by sending domain
>
> ```
> Show deliverability metrics for the last 7 days filtered to sending domain news.example.com.
> ```
> [accordion] Custom date range
>
> ```
> Show deliverability from 2026-03-01 to 2026-03-31 — focus on hard bounces and spam complaints.
> ```
> [accordion] Weekly trend
>
> ```
> Show my bounce rate and spam complaint rate week by week for the last 90 days. Is it getting better or worse?
> ```
> [accordion] Breakdown by mailbox provider
>
> ```
> Break down last month's deliverability by mailbox provider. Where is the bounce rate highest?
> ```
> [accordion] Breakdown by recipient domain
>
> ```
> Which recipient domains had the most bounces in the last 30 days?
> ```
## Feedback
```
Send feedback to Ecomail: The MCP integration is great!
I'd love to see a tool for managing contact list segments.
```
## Multi-step analysis
These examples combine multiple tools in a single conversation to get deeper insights.
> [accordion] Campaign ROI analysis
>
> ```
> I want to understand ROI of my email campaigns.
> 1. Show me the conversion analytics for campaigns only, last 90 days
> 2. List the top 5 campaigns by send date in that period
> 3. For each campaign, show the open rate and click rate
> Summarize which campaign drove the most revenue.
> ```
> [accordion] Customer health check
>
> ```
> Do a health check for subscriber john@example.com:
> - What lists are they on and what are their tags?
> - Show their recent email engagement (opens, clicks)
> - What automations have they been through?
> - What are their recent purchases?
> Give me an overall summary of this customer's engagement.
> ```
> [accordion] Monthly performance report
>
> ```
> Create a monthly performance summary for February 2026:
> - How many campaigns were sent and what were the average open/click rates?
> - What were the conversion numbers (purchases, revenue, avg order value)?
> - How does deliverability look?
> - What are the top 5 products by revenue?
> Format it as a report I can share with my team.
> ```
## Subscribers
> [accordion] Look up a subscriber
>
> ```
> Find subscriber john@example.com and show me their tags, list memberships and last activity.
> ```
> [accordion] Check email engagement
>
> ```
> Show me the email log for anna@example.com — which campaigns did she open or click in the last 30 days?
> ```
> [accordion] View purchase history
>
> ```
> What are the last 5 orders for customer david@example.com? Include order amounts and dates.
> ```
> [accordion] Search across contacts
>
> ```
> Search for all subscribers with "company.com" in their email and show me how many are subscribed vs unsubscribed.
> ```
## Templates
> [accordion] Browse templates
>
> ```
> List my email templates and find any that contain "newsletter" in the name.
> ```
> [accordion] Create a template
>
> ```
> Create a new HTML email template called "March Newsletter" with a clean, responsive layout
> that includes a header image, intro paragraph, 3 content blocks and a footer with social links.
> ```
> [accordion] Duplicate and modify
>
> ```
> Duplicate my "Welcome Email" template so I can use it as a starting point for a new version.
> ```
# MCP tools reference
Source: https://docs.ecomail.cz/ecomail-ai/mcp-tools
Complete reference of all tools available in the Ecomail remote MCP server.
The Ecomail [remote MCP server](/ecomail-ai/remote-mcp) exposes the following tools to AI assistants like Claude.ai and ChatGPT.
## Account
| Tool | Description |
| - | - |
| `account-info-tool` | Returns the current authenticated user's account name. |
## Automations
| Tool | Description |
| - | - |
| `automation-action-detail-tool` | Get detail of a specific action (node/step) in an automation, including its type and configuration. |
| `automation-actions-tool` | List all actions (nodes/steps) in an automation with their types and properties. |
| `automation-detail-tool` | Get detailed information about a specific automation, including name, list, type, status and configuration. |
| `automation-list-tool` | List all automations (pipelines) with optional filtering by active/inactive status. |
| `automation-stats-tool` | Get statistics for an automation — triggered count, sent, opens, clicks, bounces, unsubscribes, conversions and more. Optionally grouped by action nodes. |
| `automation-trigger-tool` | Trigger an automation for a specific subscriber by email address. |
## Campaigns
| Tool | Description |
| - | - |
| `campaign-detail-tool` | Get detailed information about a specific campaign, including configuration, recipient lists and delivery statistics. |
| `campaign-link-stats-tool` | Get click statistics for individual links in a campaign. Returns each tracked URL with its click count, ordered by most clicked. |
| `campaign-list-tool` | List campaigns with optional filtering by status, title or send date range (`sent_from` / `sent_to`), sorted by campaign columns or performance metrics. Each campaign carries a `stats` block — `detail=brief` (default) for rates and key counts, `detail=full` for every raw count. |
## Contact Lists
| Tool | Description |
| - | - |
| `contact-list-detail-tool` | Get detailed information about a specific contact list by ID, including sender configuration, subscriber counts by status, custom fields and segments with their subscriber counts. |
| `contact-list-list-tool` | List all contact lists with their names, sender details and active subscriber counts. |
## CDP Analytics
> [!NOTE]
>
> The following tools require CDP (Customer Data Platform) to be enabled on your account. If CDP is not active, these tools will return an error.
| Tool | Description |
| - | - |
| `clv-analysis-tool` | Get Customer Lifetime Value analysis. Supports multiple sections: dashboard (key metrics), distribution (CLV buckets), segments, timeline (monthly trend), churn rate, or individual subscriber CLV by email. |
| `conversion-analytics-tool` | Get conversion analytics — purchases, conversions, total revenue, revenue from conversions, average order value and growth percentages. Filter by scope (all, campaigns or automations) and date range. |
| `product-analytics-tool` | Get product analytics — list top products by revenue or customers, or get detail for a specific product including revenue and repeat purchase timing. Supports date range and search filtering. |
| `rfm-analysis-tool` | Get the current RFM (Recency, Frequency, Monetary) analysis — customer segments (champions, loyal, at risk, etc.) with counts, revenue and average R/F/M scores. |
## Deliverability
| Tool | Description |
| - | - |
| `deliverability-tool` | Retrieve deliverability metrics for a selected period — bounce rates, spam complaints, engagement and other delivery trends. Break the period down with `group_by` (`day`, `week`, `month`, `domain`, `sending_domain`, `mailbox_provider` or `campaign`), filter by recipient domains, sending domains or mailbox provider, and pick `detail=brief` or `detail=full`. Up to 90 days of historical data. Inbox-vs-spam folder placement is not available. |
## Feedback
| Tool | Description |
| - | - |
| `mcp-feedback-tool` | Send feedback about the MCP tools experience directly to the Ecomail team. |
## Subscribers
| Tool | Description |
| - | - |
| `search-subscriber-tool` | Search for subscribers by email, name or other query. Supports filtering by contact list and subscriber status. |
| `subscriber-automation-log-tool` | Retrieve the automation log (pipeline history) for a subscriber — all automation events, triggers and actions. |
| `subscriber-detail-tool` | Get detailed information about a subscriber by email, including personal data, tags, list memberships and last activity. |
| `subscriber-email-log-tool` | Retrieve the email log (campaign history) for a subscriber — sent emails, opens, clicks, bounces and unsubscribes. |
| `subscriber-events-tool` | Retrieve tracked web events (category, action, label, value, product) for a subscriber. |
| `subscriber-transactions-tool` | Retrieve purchase transactions (orders) for a subscriber, including order details, items and amounts. |
## Templates
| Tool | Description |
| - | - |
| `template-create-tool` | Create a new HTML email template with a name and HTML content. |
| `template-delete-tool` | Delete an email template by ID. |
| `template-detail-tool` | Get the content and details of a specific email template by ID. |
| `template-duplicate-tool` | Create a copy of an existing email template. |
| `template-list-tool` | List saved email templates with optional search filtering. |
> [!TIP]
>
> You don't need to remember tool names. Just describe what you want in natural language and the AI assistant will pick the right tool automatically. For example, ask *"Show me the open rate for my last campaign"* and it will use `campaign-list-tool` and `campaign-detail-tool` behind the scenes.
# Ecomail AI
Source: https://docs.ecomail.cz/ecomail-ai/overview
Connect your Ecomail account to AI assistants and developer tools via the Model Context Protocol (MCP).
Ecomail MCP lets you talk to your email marketing data using natural language. Ask questions, analyze performance, manage templates and more — all from your favorite AI tool.
We offer two ways to connect, depending on how you work.
## Choose your server
> [card] [Remote MCP server](/ecomail-ai/remote-mcp)
>
> **For marketers and business users**
>
> Connect directly from Claude.ai or ChatGPT — no installation, no API keys, no terminal. Just click, authorize and start chatting with your data.
>
> * One-click OAuth setup
> * Works in the browser
> * CDP analytics (RFM, CLV, conversions, products)
> * Ideal for day-to-day insights
> [card] [Local MCP server](/ecomail-ai/mcp)
>
> **For developers and power users**
>
> Run the MCP server locally via `npx` in Claude Code, Cursor, or Claude Desktop. Full API coverage with your API key.
>
> * All Ecomail API endpoints as tools
> * Works in any MCP-compatible client
> * Write and send campaigns programmatically
> * Ideal for building workflows and integrations
## What can you do?
> [card] Analyze campaigns
>
> Review open rates, click rates and delivery stats for any campaign. Compare performance across time periods.
> [card] Explore subscribers
>
> Look up any subscriber by email. See their tags, lists, engagement history, purchases and automation log.
> [card] Manage templates
>
> Browse, create, duplicate or delete email templates directly from the conversation.
> [card] Monitor automations
>
> Check automation stats, inspect individual steps, or trigger an automation for a specific subscriber.
> [card] CDP analytics
>
> Dive into RFM segmentation, customer lifetime value, conversion analytics and product performance. *(Remote server only, requires CDP)*
> [card] Track deliverability
>
> Monitor inbox placement, bounce rates and spam complaints across mailbox providers.
## Quick comparison
| | Remote server | Local server |
| - | - | - |
| **Best for** | Marketers, analysts | Developers, power users |
| **Setup** | Click + OAuth in browser | `npx` + API key in terminal |
| **Clients** | Claude.ai, ChatGPT | Claude Code, Cursor, Claude Desktop |
| **CDP analytics** | Yes | No |
| **Full API access** | Read + templates + triggers | All endpoints (read/write) |
| **Installation** | None | Node.js required |
> [!TIP]
>
> Not sure which one to pick? If you're a marketer who wants quick answers about campaign performance and customer data, start with the **Remote server**. If you're a developer building automations or integrations, go with the **Local server**.
# Remote MCP server
Source: https://docs.ecomail.cz/ecomail-ai/remote-mcp
Connect Ecomail directly to Claude.ai or ChatGPT via the hosted remote MCP server — no installation required.
The Ecomail remote MCP server lets you connect your Ecomail account to **Claude.ai** or **ChatGPT** with just a few clicks. No local installation or API keys needed — authentication is handled via OAuth.
> [!NOTE]
>
> Looking for the local MCP server for developer tools like Claude Code or Cursor? See the [Local MCP server](/ecomail-ai/mcp) guide instead.
## Claude.ai
**1. Open MCP integrations**
In any Claude.ai conversation, click the **Search and tools** icon (magnifying glass) at the bottom of the chat input, then click **Add integrations**.
**2. Add the Ecomail server**
Click **Add custom MCP server**. Enter the server URL, replacing `{your_account_name}` with your Ecomail account name:
```
https://{your_account_name}.ecomailapp.cz/mcp
```
For example, if your account name is `acme`, the URL would be `https://acme.ecomailapp.cz/mcp`.
Give it a name (e.g. `Ecomail`) and click **Add**.
**3. Authorize your account**
Claude.ai will redirect you to the Ecomail login page. Sign in with your Ecomail credentials and authorize the connection.
**4. Start using it**
Once connected, Ecomail tools will appear in the **Search and tools** panel. You can now ask Claude questions like *"Show me my latest campaigns"* or *"Find subscriber [john@example.com](mailto:john@example.com)"*.
## ChatGPT
> [!WARNING]
>
> Custom MCP connectors in ChatGPT require a **Plus** or **Pro** subscription with **Developer Mode** enabled. Developer Mode is currently in beta — when active, chat memory is automatically disabled. [Learn more](https://medium.com/@alexeylark/chatgpt-custom-mcp-connectors-with-developer-mode-d791fde17d25)
**1. Enable Developer Mode**
Go to **Settings** > **Connected apps**, open **Advanced settings** and toggle **Developer Mode** on. Accept the warning about unverified servers.
**2. Add the Ecomail server**
Enter the server URL, replacing `{your_account_name}` with your Ecomail account name:
```
https://{your_account_name}.ecomailapp.cz/mcp
```
For example, if your account name is `acme`, the URL would be `https://acme.ecomailapp.cz/mcp`.
Click **Connect**.
**3. Authorize your account**
ChatGPT will redirect you to the Ecomail login page. Sign in and authorize the connection.
**4. Start using it**
Ecomail tools are now available in your conversations. Ask ChatGPT things like *"What are my active automations?"* or *"Show deliverability stats for the last 30 days"*.
## Feedback
Have ideas or ran into issues with the MCP integration? You can send feedback directly from your AI conversation using the built-in **MCP Feedback** tool. Just ask:
> *"Send feedback to Ecomail: I'd love to see a tool for managing contact lists."*
Your message will be delivered to the Ecomail team via Slack. See the full list of available tools in the [MCP tools reference](/ecomail-ai/mcp-tools).
# Link handling
Source: https://docs.ecomail.cz/template-language/links
Control unsubscribe behavior and click tracking on individual links in your email templates.
## Unsubscribe Links
You can designate a link in your email content to generate a `link_unsubscribe` event when clicked using the `data-msys-unsubscribe` custom attribute.
```html theme={null}
Unsubscribe
```
> [!WARNING]
>
> Click tracking must be enabled for the `link_unsubscribe` event to be generated.
## Per-link Disabling of Click Tracking
When click tracking is enabled at the transmission level, you can selectively disable it for individual links using the `data-msys-clicktrack` custom attribute set to `"0"`:
```html theme={null}
Click here
```
This is useful when you want click tracking active for most links in your email, but need specific links (such as unsubscribe URLs or legal links) to remain untracked.
### App deep linking
Disabling click tracking on specific links is essential for **app deep links**. Mobile platforms like iOS and Android verify deep links by checking verification files hosted on the link's domain (e.g. `apple-app-site-association` or `assetlinks.json`). When click tracking is enabled, the link is rewritten to go through a tracking domain that doesn't host these verification files, causing the deep link to fail and open in the browser instead of the app.
By adding `data-msys-clicktrack="0"` to your deep links, the original URL is preserved, allowing the operating system to verify the domain and open the link directly in your app.