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

# Delete SIP trunk API

> Delete a SIP trunk with its gateways, carrier IPs and numbers via DELETE /trunk/trunks/{trunk_id}; inbound and outbound calls on it stop.

<Warning>
  Deleting a trunk removes its gateways, carrier IPs and numbers with it. Inbound calls to its numbers are refused, and agents can no longer place calls from them. Add the numbers to another trunk to keep using them.
</Warning>


## OpenAPI

````yaml DELETE /trunk/trunks/{trunk_id}
openapi: 3.1.0
info:
  title: Bolna API
  description: >-
    Use and leverage Bolna Voice AI using APIs through HTTP requests from any
    language in your applications and workflows.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.bolna.ai
    description: Production server
security:
  - bearerAuth: []
tags:
  - name: SIP trunks
    description: >-
      Bring-your-own-carrier SIP trunks, their gateways, carrier IPs and
      numbers.
paths:
  /trunk/trunks/{trunk_id}:
    delete:
      tags:
        - SIP trunks
      description: >
        Deletes a trunk together with its gateways, carrier IPs and numbers. Its
        carrier IPs are withdrawn from Bolna's SIP edge, so inbound calls from
        that carrier are refused unless another trunk lists the same addresses,
        and outbound calls from its numbers fail.


        The response is the deleted trunk's settings with `is_deleted: true`. It
        carries no `gateways`, `ip_acls`, `numbers`, `health` or `active_calls`.
      parameters:
        - in: path
          name: trunk_id
          required: true
          schema:
            type: string
            format: uuid
          description: The trunk's `id`
      responses:
        '200':
          description: The deleted trunk
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TrunkSettings'
        '404':
          description: No live trunk with this ID belongs to your account
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TrunkMessageError'
        '409':
          description: >-
            The trunk is being migrated from a legacy SIP trunk and cannot be
            deleted until the migration is finished or reverted
            (`convert_in_progress`)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TrunkCodedError'
components:
  schemas:
    TrunkSettings:
      type: object
      description: A SIP trunk's own settings.
      properties:
        id:
          type: string
          format: uuid
          description: Unique trunk ID.
          example: 3f2b8c1e-6d4a-4f7b-9e2c-1a5d7b9c0e21
        name:
          type: string
          description: Display name.
          example: Telnyx production
        description:
          type: string
          nullable: true
          description: Free-text note for your own reference.
        preset:
          type: string
          nullable: true
          enum:
            - plivo
            - telnyx
            - twilio
            - exotel
            - vobiz
            - vonage
            - custom
          description: The carrier the trunk was set up for.
          example: telnyx
        is_active:
          type: boolean
          description: >-
            When `false`, the trunk takes no inbound calls and places no
            outbound calls.
        inbound_enabled:
          type: boolean
          description: Whether the trunk accepts inbound calls from its carrier IPs.
        outbound_enabled:
          type: boolean
          description: Whether outbound calls can be placed from the trunk's numbers.
        channels:
          type: integer
          description: >-
            Maximum concurrent calls on the trunk, inbound and outbound
            combined.
          example: 20
        default_inbound_agent_id:
          type: string
          nullable: true
          description: >-
            Agent that answers inbound calls to any of the trunk's numbers that
            has no `agent_id` of its own.
        auth_username:
          type: string
          nullable: true
          description: >-
            Username your carrier issued, sent when the carrier challenges an
            outbound call (SIP 401/407). The password is never returned.
          example: bolna-outbound
        transport:
          type: string
          enum:
            - udp
            - tcp
          description: SIP transport used towards your carrier's gateways.
        codecs:
          type: string
          description: >-
            Codecs offered to the carrier, comma-separated, in order of
            preference.
          example: PCMU,PCMA
        outbound_leading_plus_enabled:
          type: boolean
          description: >-
            When `true`, the dialled number is sent to the carrier with a
            leading `+` (`+12025550178`); when `false`, as digits only
            (`12025550178`).
        last_inbound_at:
          type: string
          format: date-time
          nullable: true
          description: >-
            When the trunk last took an inbound call, updated at most once a
            minute. `null` until the first one.
        last_outbound_at:
          type: string
          format: date-time
          nullable: true
          description: >-
            When an outbound call was last placed through the trunk, updated at
            most once a minute. `null` until the first one.
        converted_from_byot_trunk_id:
          type: string
          nullable: true
          description: >-
            The legacy SIP trunk this trunk was migrated from, when Bolna
            migrated it for you. `null` otherwise.
        organization_id:
          type: string
          nullable: true
          description: >-
            The organisation that owns the trunk. `null` for an account outside
            an organisation.
        sub_account_id:
          type: string
          nullable: true
          description: >-
            The sub-account the trunk was created under. `null` for an
            organisation-level trunk.
        user_id:
          type: string
          nullable: true
          description: >-
            The owning user, for an account outside an organisation. `null` for
            an organisation's trunk.
        created_at:
          type: string
          format: date-time
          description: When the trunk was created.
        updated_at:
          type: string
          format: date-time
          description: When the trunk's settings last changed.
        is_deleted:
          type: boolean
          description: '`true` only in the response to a delete.'
        deleted_at:
          type: string
          format: date-time
          nullable: true
          description: When the trunk was deleted.
    TrunkMessageError:
      type: object
      description: >-
        Error body for `400`, `403` and `404` responses from the SIP trunk
        endpoints.
      required:
        - message
      properties:
        message:
          type: string
          description: >-
            Human-readable reason. On a `404` it names the ID that was not
            found.
    TrunkCodedError:
      type: object
      description: >-
        Error body for `409` responses from the SIP trunk endpoints.
        `detail.code` is stable and machine-readable.
      required:
        - detail
      properties:
        detail:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              enum:
                - number_taken
                - gateway_conflict
                - convert_in_progress
                - conflict
              description: >
                - `number_taken`: the number is already live on a trunk.

                - `gateway_conflict`: a gateway is shared with another trunk
                without carrier credentials on both.

                - `convert_in_progress`: the trunk is mid-migration from a
                legacy SIP trunk.

                - `conflict`: the change clashes with an existing record.
            message:
              type: string
              description: Human-readable reason.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

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