message.comDevelopers

Phone numbers Live

Search our carrier-grade SIP network for available phone numbers, claim them, configure inbound routing, and release them. Every claimed number generates an E.164 identifier you can attach to a department or specific agent.

POST/api/v1/phone-numbers/availableAuth: Bearer

Returns DIDs (Direct Inward Dial numbers) available for claim from our SIP network in the requested area code.

FieldTypeDescription
areaCoderequiredstringThree-digit area code (US/Canada). For non-NANP, pass country + city code in one field.
limitoptionalintegerMaximum results. Default 10, maximum 50.
kindoptionalenumOne of local, tollfree, international. Defaults to local.
Body
{ "areaCode": "415", "limit": 10 }
200 OK
{
  "available": [
    { "e164": "+14155550100", "monthlyCost": "1.00", "locality": "San Francisco, CA" },
    { "e164": "+14155550199", "monthlyCost": "1.00", "locality": "San Francisco, CA" }
  ]
}

Claim a number

POST/api/v1/phone-numbersAuth: Bearer

Claims an available DID and provisions it on our voice infrastructure. Inbound calls begin routing to your workspace within ~60 seconds. Returns the persisted record.

FieldTypeDescription
e164requiredstringThe number as returned by /available.
displayNamerequiredstringInternal label shown in the dashboard.
routingStrategyrequiredenumOne of all_agents, department, specific_agent.
routingTargetIdoptionaluuidRequired when strategy is <code>department</code> or <code>specific_agent</code>.
recordCallsoptionalbooleanWhen true, all calls are recorded by default. Consent disclosure must be enabled in regulated regions.
smartHoldEnabledoptionalbooleanActivate Smart Hold on this number. Defaults to false.
voiceProfileIdoptionaluuidReference to a voice profile for AI TTS on this number.
Body
{
  "e164": "+14155550100",
  "displayName": "Main support",
  "routingStrategy": "all_agents",
  "recordCalls": false,
  "smartHoldEnabled": true
}

List claimed numbers

GET/api/v1/phone-numbersAuth: Bearer

Cursor-paginated list of numbers owned by this workspace.

Code samples

cURL
curl 'https://app.message.com/api/v1/phone-numbers' \
  -H 'Authorization: Bearer YOUR_WORKSPACE_JWT'
JavaScript
const res = await fetch('https://app.message.com/api/v1/phone-numbers', {
  headers: { Authorization: 'Bearer ' + token }
});
const { numbers } = await res.json();
Python
import requests
r = requests.get(
    "https://app.message.com/api/v1/phone-numbers",
    headers={"Authorization": f"Bearer {token}"},
)
numbers = r.json()["numbers"]
Ruby
require "net/http"
require "json"
uri = URI("https://app.message.com/api/v1/phone-numbers")
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
  req = Net::HTTP::Get.new(uri)
  req["Authorization"] = "Bearer #{token}"
  http.request(req)
end
numbers = JSON.parse(res.body)["numbers"]
PHP
<?php
$ctx = stream_context_create([
  "http" => ["method" => "GET", "header" => "Authorization: Bearer $token"]
]);
$numbers = json_decode(file_get_contents("https://app.message.com/api/v1/phone-numbers", false, $ctx), true)["numbers"];

Get one number

GET/api/v1/phone-numbers/:idAuth: Bearer
200 OK
{
  "id": "uuid",
  "version": 1,
  "e164": "+14155550100",
  "displayName": "Main support",
  "routingStrategy": "all_agents",
  "routingTargetId": null,
  "recordCalls": false,
  "smartHoldEnabled": true,
  "voiceProfileId": null,
  "businessHoursOverride": null,
  "monthlyCost": "1.00",
  "createdAt": "2026-05-13T15:00:00Z"
}

Update routing and settings

PATCH/api/v1/phone-numbers/:idAuth: Bearer

Updates routing strategy, recording policy, Smart Hold flag, voice profile, business-hours override. Requires expectedVersion.

Release a number

DELETE/api/v1/phone-numbers/:idAuth: Bearer

Releases the DID back to the carrier pool. Billing prorates to end of month. Open calls on the number are routed to voicemail before release completes.

Released numbers are not recoverable. Once back in the carrier pool, anyone can claim them. Treat release as permanent.

Errors

CodeWhen
400 invalid_bodyPayload validation failed (e.g., bad E.164 format).
402 plan_limitWorkspace plan does not include the phone channel.
403 forbiddenAgent role is not admin.
404 not_foundNumber not owned by this workspace.
409 number_takenAnother workspace claimed the number between search and claim.

Common pitfalls

  • Routing to a specific agent without backup. If that agent is offline the call goes straight to voicemail. Prefer department routing with a small queue.
  • Enabling recording without consent disclosure. Set the inbound greeting to include the consent text in two-party-consent regions.
  • Reusing a number across workspaces. Not supported. A DID belongs to exactly one workspace at a time.