> ## 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 phone agent knowledge sources

> Update phone agent knowledge sources — Select the instructions and knowledge the agent can use.



## OpenAPI

````yaml put /phone/{phone_agent_id}/knowledge-sources
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:
  /phone/{phone_agent_id}/knowledge-sources:
    put:
      summary: Update phone agent knowledge sources
      description: >-
        Select the instructions and knowledge the agent can use. Nothing else
        reaches the agent: an empty list means none. New items inside a selected
        folder are included; new folders and items outside selected folders are
        not. When the selection fits, the agent loads it at the start of each
        call; otherwise it searches it during calls. Saved to the agent’s draft;
        publish to make it live.
      operationId: updatePhoneAgentKnowledgeSources
      parameters:
        - schema:
            type: string
          in: path
          name: phone_agent_id
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateKnowledgeSourcesDto'
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateKnowledgeSourcesResponseDto'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
components:
  schemas:
    UpdateKnowledgeSourcesDto:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/UpdateKnowledgeSourcesDtoInput'
      type: object
      properties:
        instructionMode:
          description: >-
            Deprecated; omit. "all" (with empty instructionIds and directoryIds)
            selects every instruction folder and every instruction outside a
            folder available now. New folders and new instructions outside a
            folder are not selected.
          type: string
          enum:
            - all
            - selected
        knowledgeMode:
          description: >-
            Deprecated; omit. "all" (with empty knowledge selections) selects
            every knowledge folder available now. New folders are not selected.
          type: string
          enum:
            - all
            - selected
        instructionIds:
          type: array
          items:
            type: string
          description: >-
            IDs of individual instructions to select (outside of selected
            directories)
        directoryIds:
          type: array
          items:
            type: string
          description: >-
            IDs of directories to select (all instructions in these directories
            are included)
        knowledgeItemIds:
          description: >-
            IDs of individual knowledge items to search. Omit to leave knowledge
            selections unchanged.
          type: array
          items:
            type: string
        knowledgeFolderKeys:
          description: >-
            Canonical knowledge folder keys to search. Omit to leave knowledge
            selections unchanged.
          type: array
          items:
            type: string
            minLength: 1
            maxLength: 500
      required:
        - instructionIds
        - directoryIds
    UpdateKnowledgeSourcesResponseDto:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/UpdateKnowledgeSourcesResponseDto'
      type: object
      properties:
        success:
          type: boolean
        totalTokens:
          type: number
          description: >-
            Estimated tokens of the selected instructions and knowledge
            documents
        instructionMode:
          type: string
          enum:
            - all
            - selected
          description: 'Deprecated: always selected.'
        knowledgeMode:
          type: string
          enum:
            - all
            - selected
          description: 'Deprecated: always selected.'
        knowledgePlan:
          anyOf:
            - $ref: '#/components/schemas/PhoneAgentKnowledgePlanDto'
            - type: 'null'
          description: >-
            How the agent gets the selected sources during calls; null for
            agents on another runtime
        selectedInstructionIds:
          type: array
          items:
            type: string
        selectedDirectoryIds:
          type: array
          items:
            type: string
        selectedKnowledgeItemIds:
          type: array
          items:
            type: string
        selectedKnowledgeFolderKeys:
          type: array
          items:
            type: string
      required:
        - success
        - totalTokens
        - instructionMode
        - knowledgeMode
        - knowledgePlan
        - selectedInstructionIds
        - selectedDirectoryIds
        - selectedKnowledgeItemIds
        - selectedKnowledgeFolderKeys
      additionalProperties: false
    ErrorDto:
      type: object
      properties:
        statusCode:
          type: integer
        message:
          type: string
        error:
          type: string
    PhoneAgentKnowledgePlanDto:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/PhoneAgentKnowledgePlanDto'
      type: object
      properties:
        mode:
          type: string
          enum:
            - none
            - preload
            - search
          description: >-
            How a save now would give the agent its selection. none: nothing is
            selected, so the agent only follows its own instructions. preload:
            every selected source is loaded at the start of each call. search:
            the selection is too large to load, so the agent searches it during
            calls.
        searchEnabled:
          type: boolean
          description: >-
            Whether the agent searches during calls now. Set when the agent is
            saved; differs from mode when the selected sources changed size
            since.
        selectedSourceCount:
          type: integer
          minimum: 0
          maximum: 9007199254740991
          description: >-
            Selected instructions and knowledge documents currently available to
            voice calls
        capacityUsedPercent:
          type: integer
          minimum: 0
          maximum: 9007199254740991
          description: >-
            Share of the room for loading sources at call start that the agent's
            instructions and selection would use. Above 100, the agent searches
            instead.
      required:
        - mode
        - searchEnabled
        - selectedSourceCount
        - capacityUsedPercent
      additionalProperties: false
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

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