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

# assign an agent to a sip trunk

> choose which agent answers calls to the number (UUID or handle). the number is detached from any previous agent; `agentId: null` unassigns. only a deployed agent can take a number.



## OpenAPI

````yaml /openapi.json post /v1/sip-trunks/{trunk_id}/assign
openapi: 3.1.0
info:
  title: silk api
  version: 1.0.0
  description: >-
    rumik ai's speech api. synthesize speech with the expressive `muga` model,
    the faster `mulberry` model or the multilingual `mulberry-1.6` model over
    http or a streaming websocket session, run conversational voice agents over
    webrtc, a realtime pcm socket or the phone, and manage everything the agents
    playground does — agents, voices, variables, tools, phone numbers, sip
    trunks and outbound calls — with the same api key.
  contact:
    name: rumik ai
    url: https://rumik.ai
servers:
  - url: https://silk-api.rumik.ai
    description: production
security:
  - bearerAuth: []
tags:
  - name: speech
    description: text-to-speech over HTTP and WebSocket.
  - name: voice agents
    description: start calls with a deployed agent from your own app.
  - name: agents
    description: build, configure, deploy and inspect your agents.
  - name: calls
    description: place outbound phone calls and read call history.
  - name: voices
    description: the voices, languages and styles an agent may use.
  - name: variables
    description: account-wide `{name}` prompt variables and their defaults.
  - name: tools
    description: HTTP tools agents call before or during a call.
  - name: phone numbers
    description: 'numbers rented through rumik: search, rent, connect, release.'
  - name: sip trunks
    description: bring your own numbers over SIP.
paths:
  /v1/sip-trunks/{trunk_id}/assign:
    post:
      tags:
        - sip trunks
      summary: assign an agent to a sip trunk
      description: >-
        choose which agent answers calls to the number (UUID or handle). the
        number is detached from any previous agent; `agentId: null` unassigns.
        only a deployed agent can take a number.
      operationId: assignSipTrunk
      parameters:
        - name: trunk_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: the SIP trunk's id.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AssignAgentRequest'
            examples:
              default:
                value:
                  agentId: ua_fe3277d8
      responses:
        '200':
          description: ok.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SipTrunk'
              examples:
                default:
                  value:
                    id: 019f7c10-2b4e-7d5f-8a6b-7c8d9e0f1a2b
                    phoneNumber: '+919876543210'
                    displayName: support line
                    terminationUri: sip:pstn.example-carrier.in
                    authUsername: silk
                    hasAuth: true
                    originationUri: sip:sip.silk.rumik.ai;transport=tcp
                    assignedAgentId: 019f6a2e-7c1d-7b3a-9e4f-1a2b3c4d5e6f
                    assignedAgentName: support
                    status: active
                    createdAt: '2026-09-11T10:00:00Z'
                    updatedAt: '2026-09-11T10:00:00Z'
        '401':
          description: >-
            `unauthorized` — key missing, malformed, unknown, revoked or
            expired.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                unauthorized:
                  value:
                    error: Invalid API key
                    code: unauthorized
        '403':
          description: '`forbidden_scope` — the key was created without the `agent` scope.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                forbidden_scope:
                  value:
                    error: This API key lacks the 'agent' scope
                    code: forbidden_scope
        '404':
          description: >-
            `sip_trunk_not_found` — no such SIP trunk on this account (or it
            cannot place calls). `agent_not_found` — no such agent on this
            account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                sip_trunk_not_found:
                  value:
                    error: Phone number not found
                    code: sip_trunk_not_found
                agent_not_found:
                  value:
                    error: Agent not found
                    code: agent_not_found
        '409':
          description: >-
            `agent_not_deployed` — only a deployed agent (one with a live
            version) can answer a number or take a call.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                agent_not_deployed:
                  value:
                    error: Deploy the agent before assigning a phone number to it
                    code: agent_not_deployed
        '429':
          description: >-
            `rate_limited` — the key's per-minute budget is spent. `Retry-After`
            says how long to wait; the body carries `limit` and `current`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                rate_limited:
                  value:
                    error: Rate limit exceeded
                    code: rate_limited
                    limit: 100
                    current: 101
          headers:
            Retry-After:
              description: seconds to wait before retrying (per-key rate limit only).
              schema:
                type: integer
components:
  schemas:
    AssignAgentRequest:
      properties:
        agentId:
          anyOf:
            - type: string
              maxLength: 64
            - type: 'null'
          description: the agent's UUID or `ua_…` handle; `null` unassigns.
      type: object
      title: AssignAgentRequest
      description: Which agent answers a number; ``null`` detaches it.
    SipTrunk:
      properties:
        id:
          type: string
          format: uuid
          description: the trunk's id — `fromTrunkId` on `POST /v1/calls`.
        phoneNumber:
          type: string
          description: the number, E.164.
        displayName:
          type: string
        terminationUri:
          type: string
        authUsername:
          anyOf:
            - type: string
            - type: 'null'
        hasAuth:
          type: boolean
          description: whether credentials are stored.
        originationUri:
          anyOf:
            - type: string
            - type: 'null'
          description: the SIP address your carrier must send inbound calls to.
        assignedAgentId:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          description: the agent answering the number, or null.
        assignedAgentName:
          anyOf:
            - type: string
            - type: 'null'
          description: that agent's name.
        status:
          type: string
          description: '`active`.'
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
      type: object
      required:
        - id
        - phoneNumber
        - displayName
        - terminationUri
        - hasAuth
        - status
        - createdAt
        - updatedAt
      title: SipTrunk
      description: one of your own numbers registered on the platform.
    Error:
      type: object
      properties:
        error:
          type: string
          description: human-readable error message.
        code:
          type: string
          description: machine-readable error code.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        your rumik api key, e.g. `rk_live_...`. create one in the rumik
        dashboard.

````