Phone numbers
Searching, buying, attaching an agent, and what each status means.
Updated
A phone number is a line. It belongs to an organization, is globally unique across the platform, and may have an agent attached to it.
Finding one
cURL
curl "https://api.voxcore.net/api/v1/orgs/<org_id>/phone-numbers/available/?country=US&area_code=512" \
-H "Authorization: Bearer vox_sk_live_..."Python
import os, httpx
BASE, ORG = "https://api.voxcore.net", os.environ["VOXCORE_ORG"]
AUTH = {"Authorization": f"Bearer {os.environ['VOXCORE_API_KEY']}"}
available = httpx.get(
f"{BASE}/api/v1/orgs/{ORG}/phone-numbers/available/",
headers=AUTH,
params={"country": "US", "area_code": "512"},
).json()Python (voxcore)
from voxcore import Voxcore
vox = Voxcore()
available = vox.request(
"GET",
f"/api/v1/orgs/{vox.org}/phone-numbers/available/",
params={"country": "US", "area_code": "512"},
)It accepts country (default US),
area_code, contains, locality and
limit (default 20). It asks the carrier live, which means it can
fail. A carrier that is unreachable or not configured comes back as
502 with code carrier_unavailable or
not_configured.
Each row carries monthly_cost_cents at your price
rather than the carrier's, upfront_cost_cents of 0, and
currency.
Buying one
cURL
curl -X POST https://api.voxcore.net/api/v1/orgs/<org_id>/phone-numbers/buy/ \
-H "Authorization: Bearer vox_sk_live_..." \
-H "Content-Type: application/json" \
-d '{"phone_number": "+15125550123", "label": "Front desk", "direction": "both"}'Python
import os, httpx
BASE, ORG = "https://api.voxcore.net", os.environ["VOXCORE_ORG"]
AUTH = {"Authorization": f"Bearer {os.environ['VOXCORE_API_KEY']}"}
line = httpx.post(
f"{BASE}/api/v1/orgs/{ORG}/phone-numbers/buy/",
headers=AUTH,
json={
"phone_number": "+15125550123",
"label": "Front desk",
"direction": "both",
},
).json()Python (voxcore)
from voxcore import Voxcore
vox = Voxcore()
line = vox.request(
"POST",
f"/api/v1/orgs/{vox.org}/phone-numbers/buy/",
json={
"phone_number": "+15125550123",
"label": "Front desk",
"direction": "both",
},
)Buying needs agent:update. The number has to be one you picked
out of the search results, and it must not already be registered. On success you
get 201 and the row, with no agent attached yet.
Carriers are not always quick. If the order was accepted but provisioning
hasn't finished, the row lands with status: "pending". Ask
again later:
cURL
curl -X POST https://api.voxcore.net/api/v1/orgs/<org_id>/phone-numbers/<id>/recheck/ \
-H "Authorization: Bearer vox_sk_live_..."Python
import os, httpx
BASE, ORG = "https://api.voxcore.net", os.environ["VOXCORE_ORG"]
AUTH = {"Authorization": f"Bearer {os.environ['VOXCORE_API_KEY']}"}
line = httpx.post(
f"{BASE}/api/v1/orgs/{ORG}/phone-numbers/{number_id}/recheck/",
headers=AUTH,
).json()Python (voxcore)
from voxcore import Voxcore
vox = Voxcore()
line = vox.request(
"POST", f"/api/v1/orgs/{vox.org}/phone-numbers/{number_id}/recheck/"
)That does nothing at all unless the status is pending.
An iMessage line
cURL
curl -X POST https://api.voxcore.net/api/v1/orgs/<org_id>/phone-numbers/buy-line/ \
-H "Authorization: Bearer vox_sk_live_..." \
-H "Content-Type: application/json" \
-d '{"label": "iMessage line"}'Python
import os, httpx
BASE, ORG = "https://api.voxcore.net", os.environ["VOXCORE_ORG"]
AUTH = {"Authorization": f"Bearer {os.environ['VOXCORE_API_KEY']}"}
line = httpx.post(
f"{BASE}/api/v1/orgs/{ORG}/phone-numbers/buy-line/",
headers=AUTH,
json={"label": "iMessage line"},
).json()Python (voxcore)
from voxcore import Voxcore
vox = Voxcore()
line = vox.request(
"POST",
f"/api/v1/orgs/{vox.org}/phone-numbers/buy-line/",
json={"label": "iMessage line"},
)There's no search step for these. The provider assigns the number. If what
comes back is already yours, you get 200 and the existing row
rather than a duplicate.
The fields
| Field | Values | Default |
|---|---|---|
number | E.164, starting + | required |
label | free text | empty |
country | two letters | US |
provider | telnyx, sendblue, twilio, bandwidth, byo | telnyx |
direction | both, inbound, outbound | both |
status | active, pending, released, blocked | active |
agent | an agent id, or null | null |
The read payload also carries compliance, which describes
whether the line may send messages yet. It holds state,
label, detail, can_send and
waiting. A Sendblue line short-circuits to an imessage
state that can always send. An SMS line depends on the carrier registration.
Attaching an agent
cURL
curl -X PATCH https://api.voxcore.net/api/v1/orgs/<org_id>/phone-numbers/<id>/ \
-H "Authorization: Bearer vox_sk_live_..." \
-H "Content-Type: application/json" \
-d '{"agent": "agt__..."}'Python
import os, httpx
BASE, ORG = "https://api.voxcore.net", os.environ["VOXCORE_ORG"]
AUTH = {"Authorization": f"Bearer {os.environ['VOXCORE_API_KEY']}"}
line = httpx.patch(
f"{BASE}/api/v1/orgs/{ORG}/phone-numbers/{number_id}/",
headers=AUTH,
json={"agent": agent_id},
).json()Python (voxcore)
from voxcore import Voxcore
vox = Voxcore()
line = vox.phone_numbers.update(number_id, agent=agent_id)Attaching an agent has one side effect worth knowing about: every SMS thread on that number is repointed to the new agent. Detaching does not push nulls back onto those threads, and a thread pinned to a specific agent is left alone either way.
Releasing
DELETE is a soft delete on our side. It does not
tell the carrier to release the number.
Everything on this page except the two GETs is dashboard-only
for now. An API key gets a 403 or a 500 on the
writes.