Skip to content
V2 (Legacy) API ReferenceGet started

List phone numbers

client.PhoneNumbers.List(ctx) (*PhoneNumberListResponse, error)
GET/v3/phone_numbers

Returns all phone numbers assigned to the authenticated partner. Use this endpoint to discover which phone numbers are available for use as the from field when creating a chat, listing chats, or sending a voice memo.

ReturnsExpand Collapse
type PhoneNumberListResponse struct{…}
PhoneNumbers []PhoneNumberListResponsePhoneNumber

List of phone numbers assigned to the partner

ID string

Unique identifier for the phone number

formatuuid
PhoneNumber string

Phone number in E.164 format

List phone numbers

package main

import (
  "context"
  "fmt"

  "github.com/linq-team/linq-go"
  "github.com/linq-team/linq-go/option"
)

func main() {
  client := linqgo.NewClient(
    option.WithAPIKey("My API Key"),
  )
  phoneNumbers, err := client.PhoneNumbers.List(context.TODO())
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", phoneNumbers.PhoneNumbers)
}
{
  "phone_numbers": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "phone_number": "+12025551234"
    }
  ]
}
{
  "error": {
    "status": 401,
    "code": 2004,
    "message": "Unauthorized - missing or invalid authentication token"
  },
  "success": false
}
{
  "error": {
    "status": 500,
    "code": 3006,
    "message": "Internal server error"
  },
  "success": false
}
Returns Examples
{
  "phone_numbers": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "phone_number": "+12025551234"
    }
  ]
}
{
  "error": {
    "status": 401,
    "code": 2004,
    "message": "Unauthorized - missing or invalid authentication token"
  },
  "success": false
}
{
  "error": {
    "status": 500,
    "code": 3006,
    "message": "Internal server error"
  },
  "success": false
}