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

# Generate a Twilio Voice SDK token

> Mints a Twilio AccessToken with a VoiceGrant for the calling user using the org's Twilio API key / TwiML app SID. Returns the JWT plus the user's Twilio phone number as the SDK identity. Required for the Twilio Voice SDK to register and place PSTN calls.



## OpenAPI

````yaml /api-reference/openapi.yaml get /api/calls/token/twilio
openapi: 3.0.3
info:
  title: Tether Relay and Tether API
  version: 1.0.0
  description: >-
    Route-derived OpenAPI contract generated from tether-relay backend sources.
    Regenerate with scripts/sync-openapi-from-backend.mjs.
servers:
  - url: https://your-instance.example.com
    description: Production
  - url: http://localhost:2212
    description: Local API service
security: []
tags:
  - name: AI
  - name: Applications
  - name: Approval
  - name: Auth
  - name: Automations
  - name: Calls
  - name: Campaigns
  - name: Contact Analytics
  - name: Contact Metrics
  - name: Contact Notes
  - name: Contacts
  - name: Conversation Monitor
  - name: Conversations
  - name: Departments
  - name: Email
  - name: Escalation Dashboard
  - name: Event Logs
  - name: Google Sheets
  - name: Marketplace
  - name: Messages
  - name: Notification Sounds
  - name: Notifications
  - name: Org Snapshots
  - name: Organizations
  - name: Outreach
  - name: Outreach Metrics
  - name: Outreach Sources
  - name: Pipelines
  - name: Processes
  - name: Prompts
  - name: Reminders
  - name: Sms
  - name: Templates
  - name: Traces
  - name: Training
  - name: Upload
  - name: User Snapshots
  - name: Users
  - name: Vertical
  - name: Webchats
  - name: Webhook
paths:
  /api/calls/token/twilio:
    get:
      tags:
        - Calls
      summary: Generate a Twilio Voice SDK token
      description: >-
        Mints a Twilio AccessToken with a VoiceGrant for the calling user using
        the org's Twilio API key / TwiML app SID. Returns the JWT plus the
        user's Twilio phone number as the SDK identity. Required for the Twilio
        Voice SDK to register and place PSTN calls.
      operationId: get_calls_token_twilio
      responses:
        '200':
          description: Twilio access token + identity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CallsTwilioTokenResponse'
        '400':
          description: Twilio credentials missing or user has no Twilio number
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CallsTwilioTokenErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CallsErrorResponse'
        '500':
          description: Failed to generate token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CallsErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    CallsTwilioTokenResponse:
      type: object
      properties:
        token:
          type: string
          description: Twilio AccessToken JWT with VoiceGrant.
        identity:
          type: string
          description: User's Twilio phone number used as the SDK identity.
        userId:
          type: string
      required:
        - token
        - identity
        - userId
      additionalProperties: true
      example:
        token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.example.twilio
        identity: '+14165550100'
        userId: 64f0a1b2c3d4e5f6a7b8c9d4
    CallsTwilioTokenErrorResponse:
      type: object
      description: >-
        Twilio-credentials-missing error includes a `missing` map so the UI can
        show which fields are unset.
      properties:
        error:
          type: string
        missing:
          type: object
          properties:
            accountSid:
              type: boolean
            apiKeySid:
              type: boolean
            apiKeySecret:
              type: boolean
            twimlAppSid:
              type: boolean
          additionalProperties: true
      additionalProperties: true
      example:
        error: Twilio credentials missing
        missing:
          accountSid: false
          apiKeySid: true
          apiKeySecret: true
          twimlAppSid: false
    CallsErrorResponse:
      type: object
      description: >-
        Error envelope used across most calls endpoints. Some endpoints wrap a
        string error; validation endpoints (parseContractInput) return a
        structured `error` object with `code` and `details`.
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          oneOf:
            - type: string
            - type: object
              properties:
                code:
                  type: string
                message:
                  type: string
                details:
                  type: array
                  items:
                    type: object
                    additionalProperties: true
              additionalProperties: true
        code:
          type: string
          description: >-
            Stable error code on certain errors (e.g. `NUMBER_NOT_ON_TRUNK`,
            `AGENT_NOT_SYNCED`, `OUTBOUND_IN_FLIGHT`).
      additionalProperties: true
      example:
        success: false
        error: Call not found
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````