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

# Make a VoiceLink DID call-ready

> Runs the safe outbound call-ready workflow for a purchased VoiceLink DID: import the DID into Vocobase if missing, optionally map an unmapped DID to an explicitly supplied `client_id`, ensure an active VoiceLink WebSocket bot for the mapped client, and ensure outbound routing points to that bot. Existing inbound routing is preserved on routing updates. DID mapping happens only with an explicit `client_id` and only when the DID is currently unmapped — a DID mapped to a different client is never re-mapped, and clients are never auto-created. This endpoint does not purchase, renew, run KYC, or allocate wallet credit. Pass `connection_id` when the partner has more than one active VoiceLink connection.



## OpenAPI

````yaml /openapi.json post /voicelink/call-ready
openapi: 3.1.0
info:
  title: Vocobase Partner API
  version: '2.0'
  description: >-
    API for managing voice AI agents, documents, and calls on the Vocobase
    platform.
servers:
  - url: https://api.vocobase.com/api/v2
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Config
    description: >-
      Read and update partner configuration, webhook settings, and telephony
      credentials.
  - name: Agents
    description: Create, read, update, and delete voice AI agents.
  - name: Voices
    description: >-
      List voice tiers, available voices, and stream preview audio for agent
      configuration.
  - name: Documents
    description: Upload, manage, and delete knowledge base documents.
  - name: Agent Documents
    description: Link and unlink documents to agents for knowledge base integration.
  - name: Calls
    description: Initiate outbound calls and view call history.
  - name: Phone Numbers
    description: >-
      Import DIDs, assign agents for inbound routing, and re-sync carrier
      Application bindings.
  - name: Inbound Routing Policies
    description: >-
      Define pre-answer routing decisions for inbound calls before AI sessions
      are created.
  - name: Telephony Connections
    description: Create, list, rename, and disconnect named V2 telephony connections.
  - name: VoiceLink Management
    description: Manage VoiceLink reseller clients, DID mapping, and readiness sync.
  - name: Projects
    description: Organize agents into projects. Every agent belongs to exactly one project.
  - name: Dictionaries
    description: Speech-recognition dictionary CRUD and agent attachment.
  - name: Sessions
    description: Browser-initiated WebRTC voice sessions for in-app voice agents.
paths:
  /voicelink/call-ready:
    post:
      tags:
        - VoiceLink Management
      summary: Make a VoiceLink DID call-ready
      description: >-
        Runs the safe outbound call-ready workflow for a purchased VoiceLink
        DID: import the DID into Vocobase if missing, optionally map an unmapped
        DID to an explicitly supplied `client_id`, ensure an active VoiceLink
        WebSocket bot for the mapped client, and ensure outbound routing points
        to that bot. Existing inbound routing is preserved on routing updates.
        DID mapping happens only with an explicit `client_id` and only when the
        DID is currently unmapped — a DID mapped to a different client is never
        re-mapped, and clients are never auto-created. This endpoint does not
        purchase, renew, run KYC, or allocate wallet credit. Pass
        `connection_id` when the partner has more than one active VoiceLink
        connection.
      operationId: makeVoiceLinkDidCallReady
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VoiceLinkCallReadyRequest'
            example:
              connection_id: 9b7f1c44-c87f-4f0c-9124-3c802a9c1a20
              did_id: 812
              client_id: 415
              agent_id: f4df9f8c-df95-46d8-bb0e-6f9f83fd4f55
              bot_name: Vocobase +918011223344
      responses:
        '200':
          description: Call-ready workflow result.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VoiceLinkCallReadyResponse'
              example:
                success: true
                data:
                  phone_number: '+918011223344'
                  key: '918011223344'
                  ready: true
                  steps:
                    - step: resolve_did
                      status: done
                      detail: Resolved DID +918011223344
                      data:
                        did_id: 812
                        client_id: 415
                    - step: ensure_routing
                      status: done
                      detail: >-
                        Updated routing for DID +918011223344 to outbound
                        bot_id=93
                      data:
                        routing_id: 120
                  readiness_before:
                    key: '918011223344'
                    phone_number: '+918011223344'
                    state: NO_BOT
                    issues:
                      - NO_BOT
                      - ROUTING_MISSING
                    remote_did:
                      id: 812
                      did_id: 812
                      did_number: '918011223344'
                      phone_number: '+918011223344'
                      client_id: 415
                      status: active
                      is_expired: false
                      raw: {}
                    local_phone_number: null
                    routing: null
                    bot: null
                    actions:
                      - >-
                        Create an active VoiceLink WebSocket bot for the mapped
                        client
                      - Create VoiceLink call routing for this DID
                    action_items:
                      - code: NO_BOT
                        label: >-
                          Create an active VoiceLink WebSocket bot for the
                          mapped client
                      - code: ROUTING_MISSING
                        label: Create VoiceLink call routing for this DID
                  readiness:
                    key: '918011223344'
                    phone_number: '+918011223344'
                    state: READY
                    issues: []
                    remote_did:
                      id: 812
                      did_id: 812
                      did_number: '918011223344'
                      phone_number: '+918011223344'
                      client_id: 415
                      status: active
                      is_expired: false
                      raw: {}
                    local_phone_number:
                      id: 0be141f3-f72c-4630-b3bc-a0a5f59bf970
                      phone_number: '+918011223344'
                      friendly_name: '918011223344'
                      status: ACTIVE
                      is_default: false
                      inbound_enabled: true
                      agent:
                        id: f4df9f8c-df95-46d8-bb0e-6f9f83fd4f55
                        name: Sales Agent
                      created_at: '2026-06-09T10:30:00.000Z'
                      updated_at: '2026-06-09T10:35:00.000Z'
                    routing:
                      id: 120
                      phone_number: '+918011223344'
                      for_inbound_call: 1
                      for_outbound_call: 3
                      outbound_websocket_bot_id: 93
                      raw: {}
                    bot:
                      id: 93
                      name: Vocobase +918011223344
                      status: 1
                      raw: {}
                    actions: []
                    action_items: []
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    VoiceLinkCallReadyRequest:
      type: object
      description: >-
        Request for the safe outbound call-ready workflow. Provide either
        `did_id` or `did_number`. `connection_id` is optional unless multiple
        active VoiceLink connections exist.
      anyOf:
        - required:
            - did_id
        - required:
            - did_number
      properties:
        connection_id:
          type: string
          format: uuid
          description: Optional unless multiple active VoiceLink connections exist.
        did_id:
          type: integer
          description: VoiceLink DID ID from `/voicelink/dids/purchased`.
        did_number:
          type: string
          description: Purchased DID number. Used when `did_id` is not available.
        client_id:
          type: integer
          minimum: 1
          description: >-
            Optional VoiceLink client ID. Maps the DID to this client only when
            the DID is currently unmapped — a DID already mapped to a different
            client is never re-mapped, and clients are never auto-created.
            Composer-initiated mapping uses `call_recording=0`.
        agent_id:
          type: string
          format: uuid
          description: >-
            Optional Vocobase agent ID to assign to the imported local
            PhoneNumber row. Ownership is enforced by Vocobase.
        bot_name:
          type: string
          description: >-
            Optional name to use if a new VoiceLink WebSocket bot must be
            created.
        websocket_url:
          type: string
          format: uri
          description: >-
            Optional WebSocket URL override for bot creation. Omit to use the
            backend default.
    VoiceLinkCallReadyResponse:
      type: object
      properties:
        success:
          type: boolean
          const: true
        data:
          $ref: '#/components/schemas/VoiceLinkCallReadyResult'
      required:
        - success
        - data
    VoiceLinkCallReadyResult:
      type: object
      properties:
        phone_number:
          type:
            - string
            - 'null'
          description: >-
            Resolved normalized phone number, or null when the DID could not be
            resolved.
        key:
          type:
            - string
            - 'null'
          description: Digit-only matching key used by readiness comparison.
        ready:
          type: boolean
          description: '`true` only when recomputed readiness is `READY` after all steps.'
        steps:
          type: array
          items:
            $ref: '#/components/schemas/VoiceLinkCallReadyStep'
        readiness_before:
          oneOf:
            - $ref: '#/components/schemas/VoiceLinkReadinessItem'
            - type: 'null'
          description: >-
            Readiness snapshot captured before provisioning ran; null when the
            DID could not be resolved.
        readiness:
          oneOf:
            - $ref: '#/components/schemas/VoiceLinkReadinessItem'
            - type: 'null'
          description: >-
            Recomputed readiness after provisioning and optional agent
            assignment.
      required:
        - phone_number
        - key
        - ready
        - steps
        - readiness_before
        - readiness
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          const: false
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
          required:
            - code
            - message
      required:
        - success
        - error
    VoiceLinkCallReadyStep:
      type: object
      properties:
        step:
          $ref: '#/components/schemas/VoiceLinkCallReadyStepName'
        status:
          $ref: '#/components/schemas/VoiceLinkCallReadyStepStatus'
        detail:
          type: string
        data:
          type: object
          additionalProperties: true
      required:
        - step
        - status
        - detail
    VoiceLinkReadinessItem:
      type: object
      properties:
        key:
          type: string
          description: >-
            Stable digit-only join key (no `+`) linking the remote DID, routing,
            and local PhoneNumber rows for this number.
        phone_number:
          type: string
        state:
          $ref: '#/components/schemas/VoiceLinkReadinessState'
        issues:
          type: array
          items:
            $ref: '#/components/schemas/VoiceLinkReadinessState'
        remote_did:
          oneOf:
            - $ref: '#/components/schemas/VoiceLinkNormalizedDid'
            - type: 'null'
        local_phone_number:
          oneOf:
            - $ref: '#/components/schemas/VoiceLinkLocalPhoneNumber'
            - type: 'null'
        routing:
          oneOf:
            - $ref: '#/components/schemas/VoiceLinkNormalizedRouting'
            - type: 'null'
        bot:
          oneOf:
            - $ref: '#/components/schemas/VoiceLinkNormalizedRow'
            - type: 'null'
        actions:
          type: array
          items:
            type: string
          description: Human-readable remediation strings (one per issue).
        action_items:
          type: array
          items:
            $ref: '#/components/schemas/VoiceLinkActionItem'
          description: >-
            Same remediation steps as `{ code, label }` objects for programmatic
            use.
        inbound:
          type: object
          description: Direction-specific readiness for DID-to-agent inbound calling.
          properties:
            state:
              $ref: '#/components/schemas/VoiceLinkInboundReadinessState'
            ready:
              type: boolean
            issues:
              type: array
              items:
                $ref: '#/components/schemas/VoiceLinkInboundReadinessState'
            actions:
              type: array
              items:
                type: string
            bot:
              oneOf:
                - $ref: '#/components/schemas/VoiceLinkNormalizedRow'
                - type: 'null'
            runtime:
              type: object
              properties:
                enabled:
                  type: boolean
                configured:
                  type: boolean
                issues:
                  type: array
                  items:
                    type: string
                    enum:
                      - RUNTIME_DISABLED
                      - SIGNING_SECRET_MISSING
                      - INBOUND_WSS_URL_MISSING
              required:
                - enabled
                - configured
                - issues
          required:
            - state
            - ready
            - issues
            - actions
            - bot
            - runtime
      required:
        - key
        - phone_number
        - state
        - issues
        - remote_did
        - local_phone_number
        - routing
        - bot
        - actions
        - action_items
        - inbound
    VoiceLinkCallReadyStepName:
      type: string
      enum:
        - resolve_did
        - verify_inbound_runtime
        - import_did
        - enable_inbound
        - assign_agent
        - client_mapping
        - ensure_bot
        - ensure_routing
    VoiceLinkCallReadyStepStatus:
      type: string
      enum:
        - done
        - already
        - skipped
        - failed
    VoiceLinkReadinessState:
      type: string
      enum:
        - READY
        - NOT_IMPORTED
        - NO_CLIENT_MAPPING
        - NO_BOT
        - ROUTING_MISSING
        - ROUTING_CHANGED
        - NO_VOCOBASE_AGENT
        - REMOTE_DID_EXPIRED
        - REMOTE_DID_RELEASED
        - REMOTE_DID_DELETED
    VoiceLinkNormalizedDid:
      allOf:
        - $ref: '#/components/schemas/VoiceLinkNormalizedRow'
        - type: object
          properties:
            did_id:
              type: integer
            did_number:
              type: string
            phone_number:
              type:
                - string
                - 'null'
              description: Normalized E.164 DID when Vocobase can infer it.
            is_expired:
              type: boolean
            is_released:
              type: boolean
          required:
            - phone_number
            - is_expired
            - is_released
    VoiceLinkLocalPhoneNumber:
      type: object
      properties:
        id:
          type: string
          format: uuid
        phone_number:
          type: string
        friendly_name:
          type:
            - string
            - 'null'
        status:
          type: string
        is_default:
          type: boolean
        inbound_enabled:
          type: boolean
        agent:
          type:
            - object
            - 'null'
          properties:
            id:
              type: string
              format: uuid
            name:
              type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      required:
        - id
        - phone_number
        - status
        - is_default
        - inbound_enabled
        - agent
    VoiceLinkNormalizedRouting:
      allOf:
        - $ref: '#/components/schemas/VoiceLinkNormalizedRow'
        - type: object
          properties:
            did_id:
              type: integer
            did_number:
              type: string
            phone_number:
              type:
                - string
                - 'null'
            for_inbound_call:
              type: integer
              description: 'VoiceLink mode: 1 mobile, 2 SIP, 3 WebSocket bot.'
            for_outbound_call:
              type: integer
              description: 'VoiceLink mode: 2 SIP, 3 WebSocket bot, 4 only-answer.'
            inbound_websocket_bot_id:
              type: integer
            inbound_sip_trunk_id:
              type: integer
            outbound_websocket_bot_id:
              type: integer
            outbound_sip_trunk_id:
              type: integer
          required:
            - phone_number
    VoiceLinkNormalizedRow:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        status:
          oneOf:
            - type: string
            - type: integer
        client_id:
          type: integer
        websocket_url:
          type: string
          format: uri
          description: >-
            Present for ordinary bot rows. Omitted when the URL contains the
            signed inbound token.
        websocket_configured:
          type: boolean
          description: >-
            True when a signed inbound bot URL is configured but redacted from
            the response.
        raw:
          type: object
          additionalProperties: true
          description: >-
            Original VoiceLink row. Omitted for bot rows containing a signed
            inbound URL.
    VoiceLinkActionItem:
      type: object
      description: >-
        A machine code plus human label for one remediation step. `code` is the
        readiness issue the step resolves.
      properties:
        code:
          $ref: '#/components/schemas/VoiceLinkReadinessState'
        label:
          type: string
      required:
        - code
        - label
    VoiceLinkInboundReadinessState:
      type: string
      enum:
        - READY
        - NOT_IMPORTED
        - NO_CLIENT_MAPPING
        - NO_BOT
        - ROUTING_MISSING
        - ROUTING_CHANGED
        - NO_VOCOBASE_AGENT
        - REMOTE_DID_EXPIRED
        - REMOTE_DID_RELEASED
        - REMOTE_DID_DELETED
        - INBOUND_RUNTIME_DISABLED
        - INBOUND_ORIGIN_AUTH_NOT_CONFIGURED
        - INBOUND_NOT_ENABLED_LOCALLY
        - INBOUND_BOT_URL_CHANGED
  responses:
    ValidationError:
      description: Validation error in request body or parameters.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: VALIDATION_ERROR
              message: agent_name is required and must be max 50 characters
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: UNAUTHORIZED
              message: Invalid or missing API key
    NotFound:
      description: Resource not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: NOT_FOUND
              message: Resource not found
    InternalError:
      description: Unexpected server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: INTERNAL_ERROR
              message: An unexpected error occurred
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key in format: `rg_live_xxxx`. Pass as a Bearer token in the
        Authorization header.

````