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

# Get the draft of an AI phone agent

> Read the settings an agent will use after its next publish, whether they differ from what is live, and the revision to publish them with.

Requires the `phone:read` scope.

Every change you make to an agent through the API (`PATCH /phone/{phone_agent_id}` and the knowledge sources, workflows and caller number endpoints) is saved to its draft. Calls keep using the live settings until you [publish](https://docs.open.cx/api-reference/phone/publish.md). Agents on the older runtimes have no draft: their changes still apply immediately, and the draft endpoints answer `400` for them. The SIP endpoints (inbound numbers, outbound trunk, transfer destinations) change the live agent immediately, and the same change is copied into its draft.

* `published` is `false` for an agent that was never published. It takes no calls yet.
* `has_unpublished_changes` tells you whether the draft differs from what is live.
* `field_changes` records, for each setting edited in the draft, who changed it and when.
* `revision` changes with every edit. Pass it to the publish endpoint so that only the draft you reviewed goes live.

`GET /phone/{phone_agent_id}` returns the published settings, or, for an agent that was never published, its draft with `published: false`. This endpoint shows the pending changes of a published agent.


## OpenAPI

````yaml get /phone/{phone_agent_id}/draft
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}/draft:
    get:
      summary: Get the draft of an AI phone agent
      description: >-
        The settings that will go live on the next publish, which every edit
        through this API changes. `revision` changes with every edit: send it to
        POST /phone/{phone_agent_id}/publish.
      operationId: getPhoneAgentDraft
      parameters:
        - schema:
            type: string
          in: path
          name: phone_agent_id
          required: true
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicPhoneAgentDraftDto'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
components:
  schemas:
    PublicPhoneAgentDraftDto:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/PublicPhoneAgentDraftDto'
      type: object
      properties:
        agent_id:
          type: string
        published:
          type: boolean
          description: False until the agent is published for the first time.
        revision:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: >-
            Increases on every change to the draft. Send it back when
            publishing; compare it to tell whether the draft changed since it
            was read.
        has_unpublished_changes:
          type: boolean
        live_version:
          anyOf:
            - type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
          description: The version currently live; null until the first publish.
        config:
          $ref: '#/components/schemas/PublicPhoneAgentConfigDto'
        field_changes:
          type: object
          propertyNames:
            type: string
          additionalProperties:
            type: object
            properties:
              user_id:
                anyOf:
                  - type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                  - type: 'null'
              at:
                type: string
                format: date-time
                pattern: >-
                  ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
            required:
              - user_id
              - at
            additionalProperties: false
          description: Who last changed each setting of the draft, and when.
      required:
        - agent_id
        - published
        - revision
        - has_unpublished_changes
        - live_version
        - config
        - field_changes
      additionalProperties: false
    ErrorDto:
      type: object
      properties:
        statusCode:
          type: integer
        message:
          type: string
        error:
          type: string
    PublicPhoneAgentConfigDto:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/PublicPhoneAgentConfigDto'
      type: object
      properties:
        name:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
        type:
          type: string
          enum:
            - inbound
            - outbound
        instructions:
          anyOf:
            - type: array
              items:
                type: string
            - type: 'null'
        first_message:
          type:
            - string
            - 'null'
        language:
          type: array
          items:
            type: string
        accent:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
        handoff_phone_number:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
        speed:
          anyOf:
            - type: number
              minimum: 0
              maximum: 999.99
              multipleOf: 0.01
            - type: 'null'
        interruptible:
          type: boolean
        flow:
          anyOf:
            - {}
            - type: 'null'
        data_collection_fields:
          anyOf:
            - type: array
              items:
                type: string
            - type: 'null'
        data_collection_webhook_url:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
        use_org_knowledgebase:
          type: boolean
        voice_mode:
          type: string
          enum:
            - modular
            - live
        voice_id:
          type:
            - string
            - 'null'
        tts_provider:
          type: string
          enum:
            - elevenlabs
            - cartesia
            - hamsa
        tts_speed_pct:
          anyOf:
            - type: integer
              minimum: 1
              maximum: 100
            - type: 'null'
        background_noise_preset:
          anyOf:
            - type: string
              enum:
                - office
                - bar
                - city-street
            - type: 'null'
        background_volume_pct:
          type: integer
          minimum: 1
          maximum: 200
        typing_sound_enabled:
          type: boolean
        recording_enabled:
          type: boolean
        stt_keyterms:
          type: array
          items:
            type: string
        stt_model:
          anyOf:
            - type: string
              enum:
                - deepgram/flux-general
                - deepgram/nova-3
                - deepgram/nova-3-medical
                - cartesia/ink-whisper
                - elevenlabs/scribe_v2_realtime
                - xai/stt-1
                - assemblyai/universal-3-5-pro
                - speechmatics/enhanced
                - google/gemini-3.5-transcribe-live
                - soniox/stt-rt-v6
                - openai/gpt-live-transcribe
            - type: 'null'
        failover_transfer_destination_id:
          type:
            - string
            - 'null'
        outbound_trunk_id:
          type:
            - string
            - 'null'
        outbound_caller_number:
          type:
            - string
            - 'null'
        outbound_number_pool_id:
          type:
            - string
            - 'null'
        outbound_pool_max_attempts:
          type: integer
          minimum: 1
          maximum: 3
        outbound_pool_retry_delay_minutes:
          type: integer
          minimum: 1
          maximum: 1440
        action_ids:
          type: array
          items:
            type: string
        workflow_ids:
          type: array
          items:
            type: string
        transfer_destination_ids:
          type: array
          items:
            type: string
        instruction_ids:
          type: array
          items:
            type: string
        instruction_directory_ids:
          type: array
          items:
            type: string
        knowledge_item_ids:
          type: array
          items:
            type: string
        knowledge_folder_keys:
          type: array
          items:
            type: string
        inbound_number_ids:
          type: array
          items:
            type: string
      required:
        - name
        - type
        - instructions
        - first_message
        - language
        - accent
        - handoff_phone_number
        - speed
        - interruptible
        - flow
        - data_collection_fields
        - data_collection_webhook_url
        - use_org_knowledgebase
        - voice_mode
        - voice_id
        - tts_provider
        - tts_speed_pct
        - background_noise_preset
        - background_volume_pct
        - typing_sound_enabled
        - recording_enabled
        - stt_keyterms
        - stt_model
        - failover_transfer_destination_id
        - outbound_trunk_id
        - outbound_caller_number
        - outbound_number_pool_id
        - outbound_pool_max_attempts
        - outbound_pool_retry_delay_minutes
        - action_ids
        - workflow_ids
        - transfer_destination_ids
        - instruction_ids
        - instruction_directory_ids
        - knowledge_item_ids
        - knowledge_folder_keys
        - inbound_number_ids
      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.