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

# Set contact restricted channels

> Replace the channels a contact asked not to be contacted on. Use to honor a confidential communications request or a one-channel opt-out synced from your own system.

Send the contact's full list of restricted channels: it replaces the current one. Channels are any of `email`, `sms`, `whatsapp` and `phone_voice` (phone calls). Duplicates are dropped and the response lists the channels sorted. Send an empty list to lift every restriction.

```bash theme={"dark"}
curl -X PUT "https://api.open.cx/contacts/3f6c1e2a-8b4d-4c7e-9a10-5d2b7e4f9c01/restricted-channels" \
  -H "Authorization: Bearer $OPENCX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "restricted_channels": ["sms", "phone_voice"] }'
```

```json theme={"dark"}
{
  "contact_id": "3f6c1e2a-8b4d-4c7e-9a10-5d2b7e4f9c01",
  "restricted_channels": ["phone_voice", "sms"]
}
```

To add or lift a single channel, read `restricted_channels` from [Get contact](https://docs.open.cx/api-reference/contacts/get.md) first, then send the new full list.

* The API key needs the `contacts:write` scope.
* A contact ID that isn't in your organization returns `404`.
* A change moves the contact's `updated_at` forward, so [List contacts](https://docs.open.cx/api-reference/contacts/list.md) with `updated_after` picks it up. Sending the list the contact already has changes and records nothing.
* Every change is recorded in the audit log with the before and after lists, who made it and from where. See [Audit Logs API](https://docs.open.cx/api-reference/audit-logs/index.md#contact-channel-restrictions).
* Changing restricted channels doesn't fire the **Contact Updated** workflow trigger.

Once a channel is restricted, a send to the contact on it is refused with HTTP `422` and `error: "contact_channel_restricted"`; see [refused sends](https://docs.open.cx/api-reference/contacts/introduction.md#refused-sends). Replies in a session the contact started on that channel are still delivered. [Restricted channels](https://docs.open.cx/contacts/manage-contacts.md#restricted-channels) explains what a restriction stops and what still goes through.


## OpenAPI

````yaml put /contacts/{contact_id}/restricted-channels
openapi: 3.1.0
info:
  title: OpenCX API
  description: >

    OpenCX is an AI-powered, all-in-one platform for customer support and
    outbound communications.


    Use this API to manage your OpenCX organization's AI agents, actions,
    conversations, contacts, and more.


    To get started, generate a new API key from the dashboard.


    ## Authentication

    All API endpoints require authentication using a Bearer token. You can
    generate an API key from your OpenCX dashboard.


    ## Rate Limiting

    API requests are rate limited to ensure fair usage. The current limits are:

    - 100 requests per minute for standard endpoints

    - 1000 requests per minute for streaming endpoints


    ## Error Handling

    The API uses standard HTTP status codes and returns detailed error messages
    in the response body.
  version: 1.0-beta
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: http://localhost:8080
    description: Development
  - url: https://api.open.cx
    description: Production
security:
  - bearerAuth: []
paths:
  /contacts/{contact_id}/restricted-channels:
    put:
      summary: Set contact restricted channels
      description: >-
        Replaces the channels this contact asked not to be contacted on: any of
        `email`, `sms`, `whatsapp`, `phone_voice`. Use it to honor a request for
        confidential communications or an opt-out from one channel. On a
        restricted channel nothing your team, workflows, sequences or the API
        start is sent to the contact; such a send is refused with the error
        `contact_channel_restricted`. AI replies to the contact's messages and
        your team's replies in a session on that channel are still delivered.
        Send an empty list to lift every restriction. Every change is recorded
        in the audit log with who made it and from where. Read the current list
        from `restricted_channels` on the contact.
      operationId: setContactRestrictedChannels
      parameters:
        - schema:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
          in: path
          name: contact_id
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SetContactRestrictedChannelsInput'
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactRestrictedChannelsOutput'
        '404':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  statusCode:
                    type: number
                    enum:
                      - 404
                  message:
                    type: string
                  error:
                    type: string
                required:
                  - statusCode
                  - message
                additionalProperties: false
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
components:
  schemas:
    SetContactRestrictedChannelsInput:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/SetContactRestrictedChannelsInputInput'
      type: object
      properties:
        restricted_channels:
          description: >-
            Channels this contact asked not to be contacted on: any of `email`,
            `sms`, `whatsapp`, `phone_voice`. Replaces the current list; send an
            empty list to lift every restriction.
          maxItems: 4
          type: array
          items:
            $ref: '#/components/schemas/RestrictableChannel'
      required:
        - restricted_channels
    ContactRestrictedChannelsOutput:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/ContactRestrictedChannelsOutput'
      type: object
      properties:
        contact_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        restricted_channels:
          type: array
          items:
            $ref: '#/components/schemas/RestrictableChannel'
          description: >-
            Channels this contact asked not to be contacted on: any of `email`,
            `sms`, `whatsapp`, `phone_voice`. Nothing your team, workflows,
            sequences or the API start goes out to the contact on a listed
            channel; AI replies to the contact's messages and your team's
            replies in a session on that channel are still delivered. Empty when
            nothing is restricted.
      required:
        - contact_id
        - restricted_channels
      additionalProperties: false
    ErrorDto:
      type: object
      properties:
        statusCode:
          type: integer
        message:
          type: string
        error:
          type: string
    RestrictableChannel:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/RestrictableChannel'
      type: string
      enum:
        - email
        - sms
        - whatsapp
        - phone_voice
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

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