> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ecomail.cz/llms.txt
> Use this file to discover all available pages before exploring further.

# Update smart delivery rule

> 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."]
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.