Skip to main content
POST
/
lists
/
{list_id}
/
subscribe
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"] }
    },
    "trigger_autoresponders": false,
    "update_existing": false,
    "resubscribe": false
  }'
$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']],
    ],
    'trigger_autoresponders' => false,
    'update_existing' => false,
    'resubscribe' => false,
]));
$response = curl_exec($ch);
curl_close($ch);
{
  "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
}
{
  "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"
    ]
  }
}
list_id
integer
required
ID of the list.
subscriber_data
object
required
Information about the subscriber.
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.
If the subscriber already exists in the list, the response includes already_subscribed: true.
The inserted_at field in the response returns the time in UTC format.
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"] }
    },
    "trigger_autoresponders": false,
    "update_existing": false,
    "resubscribe": false
  }'
$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']],
    ],
    'trigger_autoresponders' => false,
    'update_existing' => false,
    'resubscribe' => false,
]));
$response = curl_exec($ch);
curl_close($ch);
{
  "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
}
{
  "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"
    ]
  }
}