> ## 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.

# Update instruction restrictions

> Update instruction restrictions — Set the contact-segment and/or channel restrictions for an instruction without changing its content.



## OpenAPI

````yaml put /training/{id}/restrictions
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:
  /training/{id}/restrictions:
    put:
      summary: Update instruction restrictions
      description: >-
        Set the contact-segment and/or channel restrictions for an instruction
        without changing its content. An empty array clears that restriction
        (available everywhere).
      operationId: updateTrainingRestrictions
      parameters:
        - schema:
            type: string
          in: path
          name: id
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateTrainingRestrictionsDto'
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TrainingPublicResponseDto'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
components:
  schemas:
    UpdateTrainingRestrictionsDto:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/UpdateTrainingRestrictionsDtoInput'
      type: object
      properties:
        restricted_to_channels:
          description: >-
            Channels this instruction applies to. Pass [] to make it available
            on all channels.
          type: array
          items:
            $ref: '#/components/schemas/SessionChannel'
        restricted_to_segments:
          description: >-
            Contact segment ids this instruction applies to. Pass [] to make it
            available to all contacts.
          type: array
          items:
            type: string
    TrainingPublicResponseDto:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/TrainingPublicResponseDto'
      type: object
      properties:
        id:
          type: string
          description: Unique training ID
        title:
          type: string
          description: The scenario title or trigger phrase (last published version)
        content:
          type: string
          description: >-
            The instruction body — how the AI should respond (last published
            version)
        draft_title:
          description: >-
            Draft title being edited (null if no draft exists). Use draft_title
            ?? title.
          type:
            - string
            - 'null'
        draft_content:
          description: >-
            Draft body being edited (null if no draft exists). Use draft_content
            ?? content.
          type:
            - string
            - 'null'
        type:
          type: string
          enum:
            - BEHAVIORAL
            - SCENARIO_SPECIFIC
          description: BEHAVIORAL (always active) or SCENARIO_SPECIFIC (semantic match)
        is_draft:
          type: boolean
          description: Draft trainings are saved but not used by the AI
        directory_id:
          description: Directory this training belongs to
          type:
            - string
            - 'null'
        restricted_to_channels:
          type: array
          items:
            $ref: '#/components/schemas/SessionChannel'
          description: Channels this applies to (empty = all)
        restricted_to_segments:
          type: array
          items:
            type: string
          description: Contact segments this applies to (empty = all)
        current_version:
          description: Active published version number (null if unpublished draft)
          type:
            - number
            - 'null'
        metadata:
          anyOf:
            - type: object
              propertyNames:
                type: string
              additionalProperties: {}
            - type: 'null'
          description: Arbitrary key-value metadata for external integrations
        published_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          description: When the current version was published
        start_time:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          description: Active window start (UTC). Null = no start bound.
        end_time:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          description: Active window end (UTC). Null = no end bound.
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      required:
        - id
        - title
        - content
        - draft_title
        - draft_content
        - type
        - is_draft
        - directory_id
        - restricted_to_channels
        - restricted_to_segments
        - current_version
        - metadata
        - published_at
        - start_time
        - end_time
        - created_at
        - updated_at
      additionalProperties: false
    ErrorDto:
      type: object
      properties:
        statusCode:
          type: integer
        message:
          type: string
        error:
          type: string
    SessionChannel:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/SessionChannel'
      type: string
      enum:
        - web
        - email
        - phone_voice
        - slack
        - sms
        - whatsapp
        - instagram
        - messenger
        - api
        - web_voice
        - twitter
        - twitter_mentions
        - app_review
        - internal
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

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