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

# Update an extension



## OpenAPI

````yaml PATCH /v1/accounts/{account_id}/telephony/sip-trunks/{trunk_id}/extensions/{extension}
openapi: 3.0.3
info:
  title: PolyAI SIP Trunking API
  version: 1.0.0
  description: Management API for PolyAI SIP Trunks and their Extensions.
servers:
  - url: https://api.us.poly.ai
    description: US region
  - url: https://api.eu.poly.ai
    description: EU region
  - url: https://api.uk.poly.ai
    description: UK region
security:
  - polyApiKey: []
tags:
  - name: SIP Trunks
    description: >-
      A SIP Trunk is a virtual connection between your telephony platform and
      PolyAI. It authenticates callers, accepts inbound calls, and holds the
      list of Extensions that map a dialed number to a PolyAI agent.
  - name: SIP Trunk Extensions
    description: >-
      An Extension binds a dialed number on a trunk to a PolyAI agent. When a
      call reaches a trunk, the dialed user part is matched against that trunk's
      extensions to pick the agent.
  - name: Outbound Calls
    description: Place and query outbound calls that route over a SIP Trunk.
paths:
  /v1/accounts/{account_id}/telephony/sip-trunks/{trunk_id}/extensions/{extension}:
    parameters:
      - $ref: '#/components/parameters/account_id'
      - $ref: '#/components/parameters/trunk_id'
      - $ref: '#/components/parameters/extension'
    patch:
      tags:
        - SIP Trunk Extensions
      summary: Update an extension
      operationId: updateExtension
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateExtensionRequest'
      responses:
        '200':
          description: The updated extension.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Extension'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  parameters:
    account_id:
      name: account_id
      in: path
      required: true
      description: ID of the account that owns the SIP Trunk.
      schema:
        type: string
    trunk_id:
      name: trunk_id
      in: path
      required: true
      description: The SIP Trunk ID.
      schema:
        type: string
    extension:
      name: extension
      in: path
      required: true
      description: The dialed number or extension (URL-encoded).
      schema:
        type: string
  schemas:
    UpdateExtensionRequest:
      type: object
      additionalProperties: false
      properties:
        agent:
          $ref: '#/components/schemas/AgentRequest'
      required:
        - agent
    Extension:
      type: object
      description: An Extension binds a dialed number on a trunk to a PolyAI agent.
      properties:
        extension:
          type: string
          description: The dialed number or extension.
        agent:
          $ref: '#/components/schemas/Agent'
        created_at:
          type: string
          format: date-time
          description: RFC 3339 timestamp of when the extension was created.
        updated_at:
          type: string
          format: date-time
          description: RFC 3339 timestamp of when the extension was last updated.
      required:
        - extension
        - agent
        - created_at
        - updated_at
    AgentRequest:
      type: object
      additionalProperties: false
      description: The PolyAI agent to bind an extension to.
      properties:
        agent_id:
          type: string
          description: PolyAI Agent / Project ID to route to.
          minLength: 1
          maxLength: 255
          pattern: \S
        client_env:
          type: string
          description: One of sandbox, pre-release, live.
          enum:
            - sandbox
            - pre-release
            - live
        variant_id:
          type: string
          description: Agent variant to route to.
          maxLength: 255
      required:
        - agent_id
        - client_env
    Agent:
      type: object
      description: The PolyAI agent an extension routes calls to.
      properties:
        agent_id:
          type: string
          description: PolyAI Agent / Project ID to route to.
        client_env:
          type: string
          description: One of sandbox, pre-release, live.
          enum:
            - sandbox
            - pre-release
            - live
        variant_id:
          type: string
          description: Agent variant to route to.
      required:
        - agent_id
        - client_env
        - variant_id
    Error:
      type: object
      description: Error response body.
      properties:
        success:
          type: boolean
        error:
          type: string
        message:
          type: string
      required:
        - success
        - error
        - message
  responses:
    BadRequest:
      description: Validation error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing or invalid credential.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: Caller is not a telephony admin on the account.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Resource not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    polyApiKey:
      type: apiKey
      in: header
      name: X-API-Key

````