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

# Marketing Compliance Rules

> Learn about the compliance rules and regulations that apply to marketing messages in different countries.

When sending marketing messages through the Notify API, Prelude automatically enforces compliance rules based on local regulations in the destination country. These rules help ensure your messages comply with local laws and carrier requirements.

## Content restrictions

Certain message categories are restricted or forbidden in specific countries. When you configure a marketing template with our Customer Success team, you'll specify the category to ensure compliance.

<Warning>
  If you attempt to send a marketing message with a forbidden category, the API will return an error before sending the message.
</Warning>

## Time window restrictions

Marketing messages can only be sent during specific time windows based on local regulations. If you attempt to send a message outside these windows, it will automatically be scheduled for the next available time slot.

### Automatic scheduling

When you send a marketing message outside allowed time windows:

1. The message is **not rejected** - it's automatically scheduled for delivery
2. The next available time slot is calculated based on the recipient's timezone
3. The API response includes a `schedule_at` field showing when the message will be sent
4. You'll receive webhook events when the message is actually delivered

<Info>
  Time windows are enforced based on the **recipient's local timezone**, not your timezone. Prelude automatically handles timezone conversion.
</Info>

## Public holidays

Marketing messages are blocked on public holidays in certain jurisdictions. Prelude maintains an up-to-date database of public holidays for each country and automatically schedules messages accordingly.

If a marketing message is scheduled for a public holiday, it will be automatically rescheduled for the next business day during allowed hours.

## Scheduling marketing messages

You can schedule marketing messages up to **90 days in advance** using the `schedule_at` parameter:

```json theme={null}
{
  "template_id": "template_01k8ap1btqf5r9fq2c8ax5fhc9",
  "to": "+33612345678",
  "schedule_at": "2024-12-25T10:00:00Z",
  "variables": {
    "promotion": "Holiday Sale"
  }
}
```

The scheduled message will be validated against time window restrictions when it's about to be sent, and automatically delayed if necessary.

## Error codes

When marketing compliance rules prevent immediate delivery:

| Error Code           | Description                                                  |
| -------------------- | ------------------------------------------------------------ |
| `category_forbidden` | The message category is forbidden in the destination country |
| `unsubscribed`       | The provided phone number is unsubscribed                    |

<Note>
  Time window restrictions don't generate errors - messages are automatically scheduled for the next available time slot.
</Note>
