Skip to main content
POST
/
coupons
/
import
curl -X POST https://api2.ecomailapp.cz/coupons/import \
  -H "key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "folderId": 1,
    "codes": ["kod1", "kod2", "kod3", "kod4"],
    "valid_until": "2025-12-31",
    "update_existing": false
  }'
$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' => ['kod1', 'kod2', 'kod3', 'kod4'],
    'valid_until' => '2025-12-31',
    'update_existing' => false,
]));
$response = curl_exec($ch);
curl_close($ch);
{
  "imported": 4,
  "duplicated": 0,
  "totalCount": 4
}
folderId
integer
Folder ID. If not provided, coupons are imported into the default folder.
codes
array
required
Array of coupon code strings.
valid_until
string
Expiration date in YYYY-MM-DD format.
update_existing
boolean
default:"false"
Update existing coupons if they already exist.
curl -X POST https://api2.ecomailapp.cz/coupons/import \
  -H "key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "folderId": 1,
    "codes": ["kod1", "kod2", "kod3", "kod4"],
    "valid_until": "2025-12-31",
    "update_existing": false
  }'
$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' => ['kod1', 'kod2', 'kod3', 'kod4'],
    'valid_until' => '2025-12-31',
    'update_existing' => false,
]));
$response = curl_exec($ch);
curl_close($ch);
{
  "imported": 4,
  "duplicated": 0,
  "totalCount": 4
}