Phone numbers API

List phone numbers

GET/v1/phone-numbers

Returns

200.

curl "https://api.dialgem.com/v1/phone-numbers" \
  -H "X-API-Key: $DIALGEM_API_KEY"
Response 200
[
  {
    "id": "string",
    "status": "string",
    "provider": "string",
    "phone_number": "+14155550123",
    "phone_number_pretty": "string",
    "phone_number_type": "string",
    "nickname": "string",
    "inbound_agent_id": "inbound_agent_123",
    "inbound_agent_version": 0,
    "outbound_agent_id": "outbound_agent_123",
    "outbound_agent_version": 0,
    "inbound_agents": [
      {
        "agent_id": {},
        "agent_version": {},
        "weight": {}
      }
    ]
  }
]

Register phone number

POST/v1/phone-numbers

Request body application/json

phone_numberstring
numberstring
nicknamestring
phone_number_typestring

Default "custom"

inbound_agent_idstring
inbound_agent_versioninteger | string

Default 0

outbound_agent_idstring
outbound_agent_versioninteger | string

Default 0

inbound_agentsarray<object>
3 properties
agent_idstringrequired
agent_versioninteger | string

Default 0

weightinteger

Default 1

outbound_agentsarray<object>
3 properties
agent_idstringrequired
agent_versioninteger | string

Default 0

weightinteger

Default 1

Show 6 more parameters
custom_sms_enabledboolean

Default false

flow_sms_sender_enabledboolean

Default false

sip_outbound_trunk_configobject
4 properties
termination_uristring
transportstring
auth_usernamestring
auth_passwordstring
providerstring

Default "twilio"

provider_sidstring
inbound_webhook_urlstring

Returns

201 with the fields below.

idstringrequired

Dialgem's id for the number. Use it in the `/v1/phone-numbers/{number_id}` routes.

statusstringrequired

`active` while the number is in use. A released number is no longer listed.

providerstringrequired

The carrier that holds the number, such as `twilio`.

phone_numberstringrequired

The number in E.164 format, such as `+14155550100`.

phone_number_prettystringrequired

The number formatted for display. Numbers outside the US and Canada are returned unchanged.

phone_number_typestringrequired

Where the number came from, such as `custom` for a number you brought.

nicknamestringrequired

Your label for the number. An empty string when none is set.

inbound_agent_versioninteger | stringrequired

The version the inbound agent runs: a published version, `0` for the live draft, or `latest_published`.

outbound_agent_versioninteger | stringrequired

The version the outbound agent runs: a published version, `0` for the live draft, or `latest_published`.

inbound_agentsarray<object>required

Weighted routing for inbound calls. Empty when no agent is assigned.

3 properties
agent_idstringrequired

The agent that takes the call.

agent_versioninteger | stringrequired

The published version to run, `0` for the live draft, or `latest_published` to follow the newest publish.

weightinteger

Relative share of calls sent to this agent. Calls are split in proportion to the weights.

Default 1

Show 13 more parameters
outbound_agentsarray<object>required

Weighted routing for outbound calls. Empty when no agent is assigned.

3 properties
agent_idstringrequired

The agent that takes the call.

agent_versioninteger | stringrequired

The published version to run, `0` for the live draft, or `latest_published` to follow the newest publish.

weightinteger

Relative share of calls sent to this agent. Calls are split in proportion to the weights.

Default 1

custom_sms_enabledbooleanrequired

Whether the number can send and receive text messages through your own integration.

flow_sms_sender_enabledbooleanrequired

Whether flow agents may send text messages from this number.

creation_timestampintegerrequired

When the number was added, in milliseconds since the Unix epoch.

last_modification_timestampintegerrequired

When the number last changed, in milliseconds since the Unix epoch.

inbound_agent_idstring

The agent that answers calls to this number. Null when none is assigned.

outbound_agent_idstring

The agent that places calls from this number. Null when none is assigned.

sip_outbound_trunk_configobject

Outbound SIP trunk settings. Null when the number has none.

3 properties
termination_uristring

The SIP address calls from this number are sent to.

transportstring

SIP transport, such as `TCP`, `UDP` or `TLS`.

auth_usernamestring

Username the trunk authenticates with. The password is never returned here.

inbound_webhook_urlstring

A URL asked how to handle each inbound call before it is answered. Null when not set.

inbound_webhook_secret_hintstring

The last four characters of the webhook signing secret, so you can tell secrets apart. Null when no webhook is set.

inbound_webhook_secretstring

The signing secret for the inbound webhook. Present only in the response that creates or rotates it, and shown that once. Store it then.

sip_outbound_auth_passwordstring

The SIP password for the number's outbound trunk, or an empty string when none is set. Present only when looking a number up by its phone number.

own_twilioboolean

True when the number belongs to your own connected Twilio account. Present only when looking a number up by its phone number.

curl -X POST "https://api.dialgem.com/v1/phone-numbers" \
  -H "X-API-Key: $DIALGEM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "phone_number": "+14155550123"
  }'
Response 201
{
  "id": "string",
  "status": "string",
  "provider": "string",
  "phone_number": "+14155550123",
  "phone_number_pretty": "string",
  "phone_number_type": "string",
  "nickname": "string",
  "inbound_agent_id": "inbound_agent_123",
  "inbound_agent_version": 0,
  "outbound_agent_id": "outbound_agent_123",
  "outbound_agent_version": 0,
  "inbound_agents": [
    {
      "agent_id": "agent_123",
      "agent_version": 0,
      "weight": 1
    }
  ]
}

Update phone number

PATCH/v1/phone-numbers/{number_id}

Path parameters

number_idstringrequired

Request body application/json

nicknamestring
phone_number_typestring
custom_sms_enabledboolean
flow_sms_sender_enabledboolean
inbound_agent_idstring
inbound_agent_versioninteger | string
set_inbound_agentboolean

Default false

outbound_agent_idstring
outbound_agent_versioninteger | string
set_outbound_agentboolean

Default false

Show 4 more parameters
inbound_agentsarray<object>
3 properties
agent_idstringrequired
agent_versioninteger | string

Default 0

weightinteger

Default 1

outbound_agentsarray<object>
3 properties
agent_idstringrequired
agent_versioninteger | string

Default 0

weightinteger

Default 1

sip_outbound_trunk_configobject
4 properties
termination_uristring
transportstring
auth_usernamestring
auth_passwordstring
inbound_webhook_urlstring

Returns

200 with the fields below.

idstringrequired

Dialgem's id for the number. Use it in the `/v1/phone-numbers/{number_id}` routes.

statusstringrequired

`active` while the number is in use. A released number is no longer listed.

providerstringrequired

The carrier that holds the number, such as `twilio`.

phone_numberstringrequired

The number in E.164 format, such as `+14155550100`.

phone_number_prettystringrequired

The number formatted for display. Numbers outside the US and Canada are returned unchanged.

phone_number_typestringrequired

Where the number came from, such as `custom` for a number you brought.

nicknamestringrequired

Your label for the number. An empty string when none is set.

inbound_agent_versioninteger | stringrequired

The version the inbound agent runs: a published version, `0` for the live draft, or `latest_published`.

outbound_agent_versioninteger | stringrequired

The version the outbound agent runs: a published version, `0` for the live draft, or `latest_published`.

inbound_agentsarray<object>required

Weighted routing for inbound calls. Empty when no agent is assigned.

3 properties
agent_idstringrequired

The agent that takes the call.

agent_versioninteger | stringrequired

The published version to run, `0` for the live draft, or `latest_published` to follow the newest publish.

weightinteger

Relative share of calls sent to this agent. Calls are split in proportion to the weights.

Default 1

Show 13 more parameters
outbound_agentsarray<object>required

Weighted routing for outbound calls. Empty when no agent is assigned.

3 properties
agent_idstringrequired

The agent that takes the call.

agent_versioninteger | stringrequired

The published version to run, `0` for the live draft, or `latest_published` to follow the newest publish.

weightinteger

Relative share of calls sent to this agent. Calls are split in proportion to the weights.

Default 1

custom_sms_enabledbooleanrequired

Whether the number can send and receive text messages through your own integration.

flow_sms_sender_enabledbooleanrequired

Whether flow agents may send text messages from this number.

creation_timestampintegerrequired

When the number was added, in milliseconds since the Unix epoch.

last_modification_timestampintegerrequired

When the number last changed, in milliseconds since the Unix epoch.

inbound_agent_idstring

The agent that answers calls to this number. Null when none is assigned.

outbound_agent_idstring

The agent that places calls from this number. Null when none is assigned.

sip_outbound_trunk_configobject

Outbound SIP trunk settings. Null when the number has none.

3 properties
termination_uristring

The SIP address calls from this number are sent to.

transportstring

SIP transport, such as `TCP`, `UDP` or `TLS`.

auth_usernamestring

Username the trunk authenticates with. The password is never returned here.

inbound_webhook_urlstring

A URL asked how to handle each inbound call before it is answered. Null when not set.

inbound_webhook_secret_hintstring

The last four characters of the webhook signing secret, so you can tell secrets apart. Null when no webhook is set.

inbound_webhook_secretstring

The signing secret for the inbound webhook. Present only in the response that creates or rotates it, and shown that once. Store it then.

sip_outbound_auth_passwordstring

The SIP password for the number's outbound trunk, or an empty string when none is set. Present only when looking a number up by its phone number.

own_twilioboolean

True when the number belongs to your own connected Twilio account. Present only when looking a number up by its phone number.

curl -X PATCH "https://api.dialgem.com/v1/phone-numbers/NUMBER_ID" \
  -H "X-API-Key: $DIALGEM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "nickname": "string"
  }'
Response 200
{
  "id": "string",
  "status": "string",
  "provider": "string",
  "phone_number": "+14155550123",
  "phone_number_pretty": "string",
  "phone_number_type": "string",
  "nickname": "string",
  "inbound_agent_id": "inbound_agent_123",
  "inbound_agent_version": 0,
  "outbound_agent_id": "outbound_agent_123",
  "outbound_agent_version": 0,
  "inbound_agents": [
    {
      "agent_id": "agent_123",
      "agent_version": 0,
      "weight": 1
    }
  ]
}

Release phone number

DELETE/v1/phone-numbers/{number_id}

Path parameters

number_idstringrequired

Returns

204 with the resulting object.

curl -X DELETE "https://api.dialgem.com/v1/phone-numbers/NUMBER_ID" \
  -H "X-API-Key: $DIALGEM_API_KEY"

Assign phone number

PATCH/v1/phone-numbers/{number_id}/assign

Back-compat: assigns the INBOUND agent.

Path parameters

number_idstringrequired

Request body application/json

agent_idstring
agent_versioninteger | string

Returns

200 with the fields below.

idstringrequired

Dialgem's id for the number. Use it in the `/v1/phone-numbers/{number_id}` routes.

statusstringrequired

`active` while the number is in use. A released number is no longer listed.

providerstringrequired

The carrier that holds the number, such as `twilio`.

phone_numberstringrequired

The number in E.164 format, such as `+14155550100`.

phone_number_prettystringrequired

The number formatted for display. Numbers outside the US and Canada are returned unchanged.

phone_number_typestringrequired

Where the number came from, such as `custom` for a number you brought.

nicknamestringrequired

Your label for the number. An empty string when none is set.

inbound_agent_versioninteger | stringrequired

The version the inbound agent runs: a published version, `0` for the live draft, or `latest_published`.

outbound_agent_versioninteger | stringrequired

The version the outbound agent runs: a published version, `0` for the live draft, or `latest_published`.

inbound_agentsarray<object>required

Weighted routing for inbound calls. Empty when no agent is assigned.

3 properties
agent_idstringrequired

The agent that takes the call.

agent_versioninteger | stringrequired

The published version to run, `0` for the live draft, or `latest_published` to follow the newest publish.

weightinteger

Relative share of calls sent to this agent. Calls are split in proportion to the weights.

Default 1

Show 13 more parameters
outbound_agentsarray<object>required

Weighted routing for outbound calls. Empty when no agent is assigned.

3 properties
agent_idstringrequired

The agent that takes the call.

agent_versioninteger | stringrequired

The published version to run, `0` for the live draft, or `latest_published` to follow the newest publish.

weightinteger

Relative share of calls sent to this agent. Calls are split in proportion to the weights.

Default 1

custom_sms_enabledbooleanrequired

Whether the number can send and receive text messages through your own integration.

flow_sms_sender_enabledbooleanrequired

Whether flow agents may send text messages from this number.

creation_timestampintegerrequired

When the number was added, in milliseconds since the Unix epoch.

last_modification_timestampintegerrequired

When the number last changed, in milliseconds since the Unix epoch.

inbound_agent_idstring

The agent that answers calls to this number. Null when none is assigned.

outbound_agent_idstring

The agent that places calls from this number. Null when none is assigned.

sip_outbound_trunk_configobject

Outbound SIP trunk settings. Null when the number has none.

3 properties
termination_uristring

The SIP address calls from this number are sent to.

transportstring

SIP transport, such as `TCP`, `UDP` or `TLS`.

auth_usernamestring

Username the trunk authenticates with. The password is never returned here.

inbound_webhook_urlstring

A URL asked how to handle each inbound call before it is answered. Null when not set.

inbound_webhook_secret_hintstring

The last four characters of the webhook signing secret, so you can tell secrets apart. Null when no webhook is set.

inbound_webhook_secretstring

The signing secret for the inbound webhook. Present only in the response that creates or rotates it, and shown that once. Store it then.

sip_outbound_auth_passwordstring

The SIP password for the number's outbound trunk, or an empty string when none is set. Present only when looking a number up by its phone number.

own_twilioboolean

True when the number belongs to your own connected Twilio account. Present only when looking a number up by its phone number.

curl -X PATCH "https://api.dialgem.com/v1/phone-numbers/NUMBER_ID/assign" \
  -H "X-API-Key: $DIALGEM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "agent_123"
  }'
Response 200
{
  "id": "string",
  "status": "string",
  "provider": "string",
  "phone_number": "+14155550123",
  "phone_number_pretty": "string",
  "phone_number_type": "string",
  "nickname": "string",
  "inbound_agent_id": "inbound_agent_123",
  "inbound_agent_version": 0,
  "outbound_agent_id": "outbound_agent_123",
  "outbound_agent_version": 0,
  "inbound_agents": [
    {
      "agent_id": "agent_123",
      "agent_version": 0,
      "weight": 1
    }
  ]
}

Test inbound webhook

POST/v1/phone-numbers/{number_id}/inbound-webhook/test

Send the routing webhook a sample call and say what the answer would do. Nothing is created or recorded.

Path parameters

number_idstringrequired

Returns

200 with the fields below.

okbooleanrequired

True when your webhook answered with a usable response in time.

latency_msintegerrequired

How long your webhook took to answer, in milliseconds.

budget_msintegerrequired

How long a real call waits for your webhook, in milliseconds.

within_budgetbooleanrequired

Whether your webhook answered inside that time.

requestobjectrequired

The sample request that was sent to your webhook. It carries `test: true`.

decisionobjectrequired

What a real call would do with your webhook's answer.

status_codeinteger

The HTTP status your webhook returned. Null when it could not be reached.

errorstring

What went wrong, when `ok` is false. Null otherwise.

curl -X POST "https://api.dialgem.com/v1/phone-numbers/NUMBER_ID/inbound-webhook/test" \
  -H "X-API-Key: $DIALGEM_API_KEY"
Response 200
{
  "ok": false,
  "status_code": 0,
  "latency_ms": 0,
  "error": "string",
  "budget_ms": 0,
  "within_budget": false,
  "request": {},
  "decision": {
    "outcome": "string",
    "note": "string",
    "ignored": {},
    "reject_reason": "string",
    "agent_id": "agent_123",
    "agent_version": null,
    "variables": [
      "string"
    ],
    "metadata_keys": [
      "string"
    ]
  }
}

Rotate inbound webhook secret

POST/v1/phone-numbers/{number_id}/inbound-webhook/rotate-secret

A new signing secret for the routing webhook, returned once. The old one stops working at once.

Path parameters

number_idstringrequired

Returns

200 with the fields below.

idstringrequired

Dialgem's id for the number. Use it in the `/v1/phone-numbers/{number_id}` routes.

statusstringrequired

`active` while the number is in use. A released number is no longer listed.

providerstringrequired

The carrier that holds the number, such as `twilio`.

phone_numberstringrequired

The number in E.164 format, such as `+14155550100`.

phone_number_prettystringrequired

The number formatted for display. Numbers outside the US and Canada are returned unchanged.

phone_number_typestringrequired

Where the number came from, such as `custom` for a number you brought.

nicknamestringrequired

Your label for the number. An empty string when none is set.

inbound_agent_versioninteger | stringrequired

The version the inbound agent runs: a published version, `0` for the live draft, or `latest_published`.

outbound_agent_versioninteger | stringrequired

The version the outbound agent runs: a published version, `0` for the live draft, or `latest_published`.

inbound_agentsarray<object>required

Weighted routing for inbound calls. Empty when no agent is assigned.

3 properties
agent_idstringrequired

The agent that takes the call.

agent_versioninteger | stringrequired

The published version to run, `0` for the live draft, or `latest_published` to follow the newest publish.

weightinteger

Relative share of calls sent to this agent. Calls are split in proportion to the weights.

Default 1

Show 13 more parameters
outbound_agentsarray<object>required

Weighted routing for outbound calls. Empty when no agent is assigned.

3 properties
agent_idstringrequired

The agent that takes the call.

agent_versioninteger | stringrequired

The published version to run, `0` for the live draft, or `latest_published` to follow the newest publish.

weightinteger

Relative share of calls sent to this agent. Calls are split in proportion to the weights.

Default 1

custom_sms_enabledbooleanrequired

Whether the number can send and receive text messages through your own integration.

flow_sms_sender_enabledbooleanrequired

Whether flow agents may send text messages from this number.

creation_timestampintegerrequired

When the number was added, in milliseconds since the Unix epoch.

last_modification_timestampintegerrequired

When the number last changed, in milliseconds since the Unix epoch.

inbound_agent_idstring

The agent that answers calls to this number. Null when none is assigned.

outbound_agent_idstring

The agent that places calls from this number. Null when none is assigned.

sip_outbound_trunk_configobject

Outbound SIP trunk settings. Null when the number has none.

3 properties
termination_uristring

The SIP address calls from this number are sent to.

transportstring

SIP transport, such as `TCP`, `UDP` or `TLS`.

auth_usernamestring

Username the trunk authenticates with. The password is never returned here.

inbound_webhook_urlstring

A URL asked how to handle each inbound call before it is answered. Null when not set.

inbound_webhook_secret_hintstring

The last four characters of the webhook signing secret, so you can tell secrets apart. Null when no webhook is set.

inbound_webhook_secretstring

The signing secret for the inbound webhook. Present only in the response that creates or rotates it, and shown that once. Store it then.

sip_outbound_auth_passwordstring

The SIP password for the number's outbound trunk, or an empty string when none is set. Present only when looking a number up by its phone number.

own_twilioboolean

True when the number belongs to your own connected Twilio account. Present only when looking a number up by its phone number.

curl -X POST "https://api.dialgem.com/v1/phone-numbers/NUMBER_ID/inbound-webhook/rotate-secret" \
  -H "X-API-Key: $DIALGEM_API_KEY"
Response 200
{
  "id": "string",
  "status": "string",
  "provider": "string",
  "phone_number": "+14155550123",
  "phone_number_pretty": "string",
  "phone_number_type": "string",
  "nickname": "string",
  "inbound_agent_id": "inbound_agent_123",
  "inbound_agent_version": 0,
  "outbound_agent_id": "outbound_agent_123",
  "outbound_agent_version": 0,
  "inbound_agents": [
    {
      "agent_id": "agent_123",
      "agent_version": 0,
      "weight": 1
    }
  ]
}

Get phone number by number

GET/v1/phone-numbers/by-number/{number}

Path parameters

numberstringrequired

Returns

200 with the fields below.

idstringrequired

Dialgem's id for the number. Use it in the `/v1/phone-numbers/{number_id}` routes.

statusstringrequired

`active` while the number is in use. A released number is no longer listed.

providerstringrequired

The carrier that holds the number, such as `twilio`.

phone_numberstringrequired

The number in E.164 format, such as `+14155550100`.

phone_number_prettystringrequired

The number formatted for display. Numbers outside the US and Canada are returned unchanged.

phone_number_typestringrequired

Where the number came from, such as `custom` for a number you brought.

nicknamestringrequired

Your label for the number. An empty string when none is set.

inbound_agent_versioninteger | stringrequired

The version the inbound agent runs: a published version, `0` for the live draft, or `latest_published`.

outbound_agent_versioninteger | stringrequired

The version the outbound agent runs: a published version, `0` for the live draft, or `latest_published`.

inbound_agentsarray<object>required

Weighted routing for inbound calls. Empty when no agent is assigned.

3 properties
agent_idstringrequired

The agent that takes the call.

agent_versioninteger | stringrequired

The published version to run, `0` for the live draft, or `latest_published` to follow the newest publish.

weightinteger

Relative share of calls sent to this agent. Calls are split in proportion to the weights.

Default 1

Show 13 more parameters
outbound_agentsarray<object>required

Weighted routing for outbound calls. Empty when no agent is assigned.

3 properties
agent_idstringrequired

The agent that takes the call.

agent_versioninteger | stringrequired

The published version to run, `0` for the live draft, or `latest_published` to follow the newest publish.

weightinteger

Relative share of calls sent to this agent. Calls are split in proportion to the weights.

Default 1

custom_sms_enabledbooleanrequired

Whether the number can send and receive text messages through your own integration.

flow_sms_sender_enabledbooleanrequired

Whether flow agents may send text messages from this number.

creation_timestampintegerrequired

When the number was added, in milliseconds since the Unix epoch.

last_modification_timestampintegerrequired

When the number last changed, in milliseconds since the Unix epoch.

inbound_agent_idstring

The agent that answers calls to this number. Null when none is assigned.

outbound_agent_idstring

The agent that places calls from this number. Null when none is assigned.

sip_outbound_trunk_configobject

Outbound SIP trunk settings. Null when the number has none.

3 properties
termination_uristring

The SIP address calls from this number are sent to.

transportstring

SIP transport, such as `TCP`, `UDP` or `TLS`.

auth_usernamestring

Username the trunk authenticates with. The password is never returned here.

inbound_webhook_urlstring

A URL asked how to handle each inbound call before it is answered. Null when not set.

inbound_webhook_secret_hintstring

The last four characters of the webhook signing secret, so you can tell secrets apart. Null when no webhook is set.

inbound_webhook_secretstring

The signing secret for the inbound webhook. Present only in the response that creates or rotates it, and shown that once. Store it then.

sip_outbound_auth_passwordstring

The SIP password for the number's outbound trunk, or an empty string when none is set. Present only when looking a number up by its phone number.

own_twilioboolean

True when the number belongs to your own connected Twilio account. Present only when looking a number up by its phone number.

curl "https://api.dialgem.com/v1/phone-numbers/by-number/NUMBER" \
  -H "X-API-Key: $DIALGEM_API_KEY"
Response 200
{
  "id": "string",
  "status": "string",
  "provider": "string",
  "phone_number": "+14155550123",
  "phone_number_pretty": "string",
  "phone_number_type": "string",
  "nickname": "string",
  "inbound_agent_id": "inbound_agent_123",
  "inbound_agent_version": 0,
  "outbound_agent_id": "outbound_agent_123",
  "outbound_agent_version": 0,
  "inbound_agents": [
    {
      "agent_id": "agent_123",
      "agent_version": 0,
      "weight": 1
    }
  ]
}

List available numbers

GET/v1/phone-numbers/available

Query parameters

countrystring

Default "US"

typestring

Default "local"

area_codestring
containsstring
limitinteger

Default 20

Returns

200 with the fields below.

numbersarray<object>required

Numbers you can buy, up to the requested limit.

9 properties
phone_numberstringrequired

The number in E.164 format. Pass it to the buy route.

friendly_namestringrequired

The number formatted for display.

typestringrequired

The kind of number, such as `local` or `toll_free`.

voicebooleanrequired

Whether the number can take voice calls.

smsbooleanrequired

Whether the number can send and receive text messages.

mmsbooleanrequired

Whether the number can send and receive picture messages.

localitystring

City or locality, when the carrier reports one.

regionstring

State or region, when the carrier reports one.

countrystring

Two-letter country code.

monthly_price_unitsintegerrequired

Monthly rent for this kind of number, in credit units.

monthly_price_usdnumberrequired

Monthly rent for this kind of number, in US dollars.

curl "https://api.dialgem.com/v1/phone-numbers/available" \
  -H "X-API-Key: $DIALGEM_API_KEY"
Response 200
{
  "numbers": [
    {
      "phone_number": "+14155550123",
      "friendly_name": "string",
      "type": "string",
      "locality": "string",
      "region": "string",
      "country": "string",
      "voice": false,
      "sms": false,
      "mms": false
    }
  ],
  "monthly_price_units": 0,
  "monthly_price_usd": 0
}

Buy a phone number

POST/v1/phone-numbers/buy

Request body application/json

phone_numberstringrequired

E.164, as returned by the search

typestring

Default "local"

nicknamestring

Returns

201 with the fields below.

idstringrequired

Dialgem's id for the number. Use it in the `/v1/phone-numbers/{number_id}` routes.

statusstringrequired

`active` while the number is in use. A released number is no longer listed.

providerstringrequired

The carrier that holds the number, such as `twilio`.

phone_numberstringrequired

The number in E.164 format, such as `+14155550100`.

phone_number_prettystringrequired

The number formatted for display. Numbers outside the US and Canada are returned unchanged.

phone_number_typestringrequired

Where the number came from, such as `custom` for a number you brought.

nicknamestringrequired

Your label for the number. An empty string when none is set.

inbound_agent_versioninteger | stringrequired

The version the inbound agent runs: a published version, `0` for the live draft, or `latest_published`.

outbound_agent_versioninteger | stringrequired

The version the outbound agent runs: a published version, `0` for the live draft, or `latest_published`.

inbound_agentsarray<object>required

Weighted routing for inbound calls. Empty when no agent is assigned.

3 properties
agent_idstringrequired

The agent that takes the call.

agent_versioninteger | stringrequired

The published version to run, `0` for the live draft, or `latest_published` to follow the newest publish.

weightinteger

Relative share of calls sent to this agent. Calls are split in proportion to the weights.

Default 1

Show 15 more parameters
outbound_agentsarray<object>required

Weighted routing for outbound calls. Empty when no agent is assigned.

3 properties
agent_idstringrequired

The agent that takes the call.

agent_versioninteger | stringrequired

The published version to run, `0` for the live draft, or `latest_published` to follow the newest publish.

weightinteger

Relative share of calls sent to this agent. Calls are split in proportion to the weights.

Default 1

custom_sms_enabledbooleanrequired

Whether the number can send and receive text messages through your own integration.

flow_sms_sender_enabledbooleanrequired

Whether flow agents may send text messages from this number.

creation_timestampintegerrequired

When the number was added, in milliseconds since the Unix epoch.

last_modification_timestampintegerrequired

When the number last changed, in milliseconds since the Unix epoch.

monthly_price_unitsintegerrequired

Monthly rent in credit units, charged to your balance.

monthly_price_usdnumberrequired

Monthly rent in US dollars.

inbound_agent_idstring

The agent that answers calls to this number. Null when none is assigned.

outbound_agent_idstring

The agent that places calls from this number. Null when none is assigned.

sip_outbound_trunk_configobject

Outbound SIP trunk settings. Null when the number has none.

3 properties
termination_uristring

The SIP address calls from this number are sent to.

transportstring

SIP transport, such as `TCP`, `UDP` or `TLS`.

auth_usernamestring

Username the trunk authenticates with. The password is never returned here.

inbound_webhook_urlstring

A URL asked how to handle each inbound call before it is answered. Null when not set.

inbound_webhook_secret_hintstring

The last four characters of the webhook signing secret, so you can tell secrets apart. Null when no webhook is set.

inbound_webhook_secretstring

The signing secret for the inbound webhook. Present only in the response that creates or rotates it, and shown that once. Store it then.

sip_outbound_auth_passwordstring

The SIP password for the number's outbound trunk, or an empty string when none is set. Present only when looking a number up by its phone number.

own_twilioboolean

True when the number belongs to your own connected Twilio account. Present only when looking a number up by its phone number.

curl -X POST "https://api.dialgem.com/v1/phone-numbers/buy" \
  -H "X-API-Key: $DIALGEM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "phone_number": "+14155550123"
  }'
Response 201
{
  "id": "string",
  "status": "string",
  "provider": "string",
  "phone_number": "+14155550123",
  "phone_number_pretty": "string",
  "phone_number_type": "string",
  "nickname": "string",
  "inbound_agent_id": "inbound_agent_123",
  "inbound_agent_version": 0,
  "outbound_agent_id": "outbound_agent_123",
  "outbound_agent_version": 0,
  "inbound_agents": [
    {
      "agent_id": "agent_123",
      "agent_version": 0,
      "weight": 1
    }
  ]
}