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

# Unlink Bot from Phone Number

> Unlink a bot (agent) from a phone number.



## OpenAPI

````yaml post /v1/phone-numbers/unlink-agent
openapi: 3.1.0
info:
  title: OpenMic v1 External API
  description: >-
    API specification for OpenMic v1 External API, providing endpoints for bot
    management, call handling, and phone number operations.
  version: 1.0.0
servers:
  - url: https://api.openmic.ai
    description: Production Environment
security:
  - api_key: []
tags:
  - name: Calls
    description: Endpoints related to phone call creation and management.
  - name: Bots
    description: Endpoints related to bot management and configuration.
  - name: Phone Numbers
    description: Endpoints related to phone number management and bot linking.
  - name: Knowledge Bases
  - name: FAQs
  - name: Campaigns
  - name: Tools
  - name: Contact Lists
  - name: Contacts
  - name: Voices
    description: >-
      Endpoints for browsing available text-to-speech voices. Voices are
      read-only and can be filtered by gender, provider, language, and accent.
  - name: SMS
    description: Endpoints for sending SMS messages.
paths:
  /v1/phone-numbers/unlink-agent:
    post:
      tags:
        - Phone Numbers
      summary: Unlink Bot from Phone Number
      description: Unlink a bot (agent) from a phone number.
      requestBody:
        description: Bot unlinking details
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                phone_number_id:
                  type: string
                  description: The unique identifier of the phone number
                direction:
                  type: string
                  enum:
                    - inbound
                    - outbound
                    - both
                  description: Direction to unlink (inbound, outbound, or both)
              required:
                - phone_number_id
                - direction
            example:
              phone_number_id: ybhb8wzi487w02m2bc7dh0ev
              direction: inbound
      responses:
        '200':
          description: Bot unlinked from phone number successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LinkBotToPhoneNumberResponse'
              example:
                phone_number_id: ybhb8wzi487w02m2bc7dh0ev
                phone_number: '+15551112222'
                inbound_agent_id: null
                outbound_agent_id: bvrg8wzi487w02m2bc7dh0ev
                message: Bot unlinked successfully for inbound calls.
        '400':
          description: Bad request - validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: Invalid request body.
        '401':
          description: Unauthorized - missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: Unauthorized
                message: Invalid or expired API key
        '404':
          description: Phone number not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: Phone number with the specified UID was not found.
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: An unexpected error occurred. Please try again later.
components:
  schemas:
    LinkBotToPhoneNumberResponse:
      type: object
      properties:
        phone_number_id:
          type: string
          description: Unique identifier of the phone number
        phone_number:
          type: string
          description: Phone number in E.164 format
        inbound_agent_id:
          type: string
          description: Bot ID for inbound calls
        outbound_agent_id:
          type: string
          description: Bot ID for outbound calls
        message:
          type: string
          description: Success message
      required:
        - phone_number_id
        - phone_number
        - message
    Error:
      type: object
      properties:
        error:
          type: string
          description: Error message
        message:
          type: string
          description: Additional error message (for certain error types)
      required:
        - error
  securitySchemes:
    api_key:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        API key authentication. Include your API key in the Authorization header
        as: `Authorization: Bearer <your-api-key>`

````