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

# Archive SIP trunk

> Archive a SIP trunk and best-effort delete its LiveKit outbound trunk. Refused while any live (non-archived) numbers remain on the trunk. Requires the admin-tier `phone_numbers:write` scope (customer/platform admins, or an API key bearing the scope). Scope `phone_numbers:write`.



## OpenAPI

````yaml /api-reference/openapi.json post /phone-numbers/sip-trunks/{trunk_id}/archive
openapi: 3.1.0
info:
  title: Lehar API
  version: v0
  description: >-
    Customer-facing REST API for the Lehar voice-AI platform. Platform-admin
    endpoints are intentionally excluded from this reference. Regenerate with
    `npm run sync:openapi`.
servers:
  - url: https://api.lehar.ai/ca/api/v0
security:
  - ApiKeyAuth: []
  - BearerAuth: []
paths:
  /phone-numbers/sip-trunks/{trunk_id}/archive:
    post:
      tags:
        - Phone Numbers
      summary: Archive SIP trunk
      description: >-
        Archive a SIP trunk and best-effort delete its LiveKit outbound trunk.
        Refused while any live (non-archived) numbers remain on the trunk.
        Requires the admin-tier `phone_numbers:write` scope (customer/platform
        admins, or an API key bearing the scope). Scope `phone_numbers:write`.
      operationId: >-
        archive_sip_trunk_ca_api_v0_phone_numbers_sip_trunks__trunk_id__archive_post
      parameters:
        - name: trunk_id
          in: path
          required: true
          description: The SIP trunk id.
          schema:
            type: string
      responses:
        '200':
          description: Trunk archived.
          content:
            application/json:
              example:
                trunk:
                  id: trunk_x1y2z3
                  name: Acme SIP
                  kind: byo
                  provider: acme-telecom
                  sip_address: sip.acme.example.com
                  sip_transport: tls
                  auth_username: acme_user
                  auth_password_last4: '7788'
                  livekit_outbound_trunk_id: ST_abc123
                  status: archived
                  created_at: '2026-09-01T12:00:00Z'
                  updated_at: '2026-09-02T09:30:00Z'
        '401':
          description: Authentication required.
          content:
            application/json:
              example:
                error:
                  code: unauthorized
                  message: Authentication required
        '403':
          description: Missing scope, or a role that cannot manage phone numbers.
          content:
            application/json:
              example:
                error:
                  code: forbidden
                  message: This role cannot manage phone numbers
        '404':
          description: SIP trunk not found.
          content:
            application/json:
              example:
                error:
                  code: not_found
                  message: SIP trunk not found
        '409':
          description: The trunk still has live phone numbers on it.
          content:
            application/json:
              example:
                error:
                  code: conflict
                  message: >-
                    Archive or move this trunk's phone numbers before archiving
                    it
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
    BearerAuth:
      type: http
      scheme: bearer

````