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

# Apply recipient contact controls

> Preview recipient contact hours, manage business suppressions and handle locked opt-outs with the Nixflex API without treating a preview as permission to send.

**FIXED · account** An incoming STOP blocks voice and SMS across the owning account. The receiving business number is evidence only.

**NOT OFFERED → do this instead · number** A number or a separate agent does not create its own STOP boundary. Businesses on a platform share its STOP list. Honour the suppression across their numbers.

**YOU CAN CHANGE · account** Add a do-not-contact entry for all channels, voice or SMS. Check the selected owner and recipient before any change.

**SCOPE · recipient** Preview local contact rules before outreach. Report the reason when a recipient is held and resolve the underlying policy or missing data. `needs_timezone`, `timezone_policy_paused`, `contact_policy_paused`, `consent_required`, `consent_withdrawn`, `do_not_contact`, `outside_hours`, `not_due_local`, `policy_migration_required`, `country_policy_review`, `holiday_data_unavailable`, `public_holiday`.

Keyword STOP works independently. AI recognition of a sender’s clear objection in a verified incoming SMS is off by default. Customers have no switch for it. Where enabled on eligible automatic replies, it blocks calls and texts account-wide and may send one goodbye.

On `GET /v1/contact-suppressions`, business\_number alone selects keyword evidence. Add source=attributed for keyword and AI entries. To correct an eligible AI mistake, the Owner or account key sends phone\_number, channel=all, current review\_version and a reason to `POST /v1/contact-suppressions/ai-corrections`. Reload on review\_changed. Keyword STOP and independent restrictions stay locked. Correction never supplies consent.

[Read the compact AI rules](https://docs.nixflex.com/ai-rules.md#contact-controls)

Preview recipient-local contact hours and enforce suppression decisions before requesting calls or messages.

Preview: **1–20 recipients** · Validity: **60 seconds** · Dispatch: **Checks again**

**The important part**

* **STOP applies across the account.** A recognised opt-out suppresses that recipient for calls and texts across the account’s sending numbers. The receiving business number is recorded as evidence. Keep one account for platform-managed businesses. Only an independently signed-up business has its own STOP list.

* A preview sends nothing and does not authorise later dispatch.

* Use known recipient location; do not substitute the business time zone.

* Recipient opt-outs remain enforced and cannot be removed as business entries.

[Business guide](https://docs.nixflex.com/guides/business/contact-controls.md) · [API reference](https://docs.nixflex.com/api-reference/introduction.md) · [Glossary](https://docs.nixflex.com/guides/glossary.md)

A platform uses one Nixflex account for all its businesses. Give each business an agent or share one agent across several numbers. Use separate accounts only when each business signs up itself. Do not build an account-creation loop. Sub-accounts are not offered. STOP for calls and texts and the simultaneous-call budget both apply across the account.

Preview contact hours for the actual recipient. Country policy, local time, holidays and missing location data can affect the result. The engine checks again at dispatch. The public API offers no configurable per-recipient frequency cap. The shipped UK default is Monday to Friday, 09:00–18:00 recipient-local time. Set a narrower campaign window for a 17:00 cutoff. Enforce your own weekly recipient and daily offer caps before submitting work. A country under policy review can still be held.

## Prerequisites

Use an owning account credential and active agent. Replace fixture IDs and numbers with owned test values. Country and time zone are optional overrides when you know the recipient’s location; never substitute the business’s time zone for an unknown recipient.

## 1. Request a bounded preview

SDK and CLI examples require Node/CLI 0.11.0 or later or Python 0.4.0 or later. See [installation and supported clients](https://docs.nixflex.com/sdks/ecosystem.md).

```bash cURL theme={"dark"}
curl --request POST \
  --url "https://api.nixflex.com/v1/contact-hours/preview" \
  --header "Authorization: Bearer $NIXFLEX_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{"agent_id":"agent_fixture","recipients":[{"phone":"+12025550101","country":"US","timezone":"America/New_York"}]}'
```

```javascript Node theme={"dark"}
import Nixflex from 'nixflex';

const c = new Nixflex({
  apiKey: process.env.NIXFLEX_API_KEY,
  baseUrl: 'https://api.nixflex.com',
  maxRetries: 0,
});
const result = await c.contacts.preview({"agent_id": "agent_fixture", "recipients": [{"phone": "+12025550101", "country": "US", "timezone": "America/New_York"}]});
```

```python Python theme={"dark"}
import os
from nixflex import Nixflex

with Nixflex(
    api_key=os.environ["NIXFLEX_API_KEY"],
    base_url="https://api.nixflex.com",
    max_retries=0,
) as c:
    result = c.contacts.preview(agent_id='agent_fixture', recipients=[{'phone': '+12025550101', 'country': 'US', 'timezone': 'America/New_York'}])
```

```powershell CLI (PowerShell) theme={"dark"}
$body = @'
{
  "agent_id": "agent_fixture",
  "recipients": [
    {
      "phone": "+12025550101",
      "country": "US",
      "timezone": "America/New_York"
    }
  ]
}
'@
[IO.File]::WriteAllText('request-98.json', $body, (New-Object Text.UTF8Encoding $false))
nixflex contacts preview --body '@request-98.json' --json --base-url "https://api.nixflex.com"
```

## 2. Read the server result

Use `as_of`, `expires_at`, `hold_reason`, `display_reason`, `message`, `next_allowed` and `next_unavailable`. A next time can be null. The preview covers 1–20 recipients, expires after 60 seconds and has a bounded future search. Multiple possible zones can constrain the result.

## 3. Read suppressions

GET `/v1/contact-suppressions` for the intended channel. `both`, `voice` and `sms` are separate scopes. Distinguish owner-added entries from `sms_optout`, and preserve `removal_locked` rather than offering a remove button for every row.

## 4. Change business entries deliberately

Use the documented POST/DELETE routes for business-added suppressions. A locked recipient opt-out cannot be removed by the business. If management is paused, existing opt-outs stay enforced; a refusal must not be displayed as removal.

Inbound SMS checks the normalised whole message before any AI reply or its billing. Recognised English keywords are `stop`, `stopall`, `unsubscribe`, `cancel`, `end`, `quit`, `revoke` and `optout`. Arabic keywords are `توقف`, `وقف`, `ايقاف`, `الغاء`, `الغاء الاشتراك`, `وقف الرسائل` and `ايقاف الرسائل`. The check normalises case, spacing, selected punctuation and Arabic spelling marks; it is not a substring search. A match records a locked opt-out for both voice and SMS and sends no Nixflex confirmation reply. Handle free-text withdrawal requests through a separate review process; do not treat a non-match as consent.

## 5. Handle dispatch refusals

Single calls and SMS can refuse with `do_not_contact`, `needs_timezone` or `outside_hours`; campaigns hold affected recipients. Show the reason. Use `not_sent`/`charged:false` only when the response explicitly proves a pre-dispatch refusal. Unknown results need reconciliation, not automatic resend.

## Example response

Preview replies describe current guidance and any next allowed time. `advisory_only` identifies that this is not dispatch permission. Render the safe `message` as text and refresh after expiry; do not replace a failed preview with a local guess.

## Errors and limits

| Condition | Handling |
| - | - |
| Preview expired/unavailable | Request fresh guidance; retain unknown state. |
| Invalid country/time zone | Correct the supplied override. |
| 409 contact refusal | Respect the hold and correct the source information. |
| 503 `feature_paused` | Management is paused; existing opt-outs still apply. |
| Wider-hours request | Use only with permission and a valid reason; hard limits still apply. |

## Next steps

* [Contact preview](https://docs.nixflex.com/api-reference/contact-controls/post-contact-hours-preview.md)
* [List restrictions](https://docs.nixflex.com/api-reference/contact-controls/get-contact-suppressions.md)
* [Remove business restriction](https://docs.nixflex.com/api-reference/contact-controls/delete-contact-suppressions.md)

## Single-SMS suppression response change

Single `POST /v1/sms` now returns **409 `do_not_contact`**, type `conflict`, when the recipient is suppressed. It previously returned **400 `invalid_request`**. Nothing was sent. Stop and respect the opt-out; never automatically retry or remove the suppression. SMS campaigns still hold affected recipients individually with `hold_reason: do_not_contact`.


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