Docs
Phone numbers

Phone numbers

List and manage phone numbers, provision new ones, and import numbers from your own Twilio account.

A phone number is an assistant's calling channel. Callers reach the assistant on it, and the assistant's outbound calls dial from it (from a number provisioned by dBel, on request). It is attached to at most one assistant (assistantId), and an assistant has at most one number. Attach a number with connectPhoneId on the assistant endpoints. Numbers arrive one of two ways:

  • Provisioned by dBel (provider: "dbel") — searched and bought through the provision endpoints. Billed on the workspace owner's subscription; deleting one releases it for good.
  • Imported from Twilio (provider: "twilio") — a number you already own in a Twilio account connected on the Integrations page. Deleting one only detaches it; you keep the number.

Beta. This API is documented but not yet frozen. Response fields and error codes may change without a version bump. Pin your integration to the fields you use, and expect additions.

Roles

Any member can list, read and search. Provisioning, importing and deleting need ADMIN or OWNER. Provisioning also needs a paid plan on the workspace owner's subscription, and that subscription must be active with no failed payment. Otherwise it answers FREE_PLAN_RESTRICTED or SUBSCRIPTION_ISSUE.

Provisioning is asynchronous

  1. GET /api/phones/provision?countryCode=US — search the inventory. Only US and CA are available. The search returns local numbers only, each with its monthly and per-minute prices.
  2. POST /api/phones/provision with the chosen phoneNumber, countryCode and type — you get 202 and a statusUrl (also in the Location header) at once. Before it answers, the POST charges the prorated amount to the workspace owner's subscription, and adds the number only once that payment succeeds. If the payment does not go through (the card is declined or needs authentication), nothing changes: the invoice is voided, the request ends failed, and the POST answers PURCHASE_PAYMENT_FAILED (402). Send a new clientRequestId to try again. Toll-free numbers are no longer sold: type: "tollFree", or a toll-free phoneNumber, answers PHONE_TYPE_NOT_SOLD (422) and charges nothing. To use a toll-free number, import it from your own Twilio account (below).
  3. GET the status URL until status is succeeded (then phoneId is set) or failed (error holds a code that says why). error can also be set while status is pending, for example in_progress, so branch on status, not on error. A request can stay pending for a day or more while the purchase is retried. After 5 failed purchase attempts it ends as failed, with the last attempt's code in error. Set a polling limit of your own as well.

Send a clientRequestId to make step 2 safe to retry. Generate a new UUID for each purchase. While that request is still pending, a retry of the same purchase returns it (202) instead of buying twice. Once the request has failed, the same id answers 409; send a new id to try again. A number that any workspace already holds, or that another workspace has pending, answers 409 (RESOURCE_CONFLICT) whatever id you send. ?dryRun=1 checks your role, the body and the owner's plan, then answers 202 with dryRun: true. It does not price, buy or bill. It skips the checks for a number that is already taken, and its statusUrl answers NOT_FOUND.

# A new id for each purchase. Reuse it only to retry this one.
REQUEST_ID=$(uuidgen)
 
curl -X POST "https://dbel.ai/api/phones/provision" \
  -H "Authorization: Bearer $DBEL_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "phoneNumber": "+14155550123",
    "countryCode": "US",
    "type": "local",
    "clientRequestId": "'"$REQUEST_ID"'"
  }'
 
# → 202 { "requestId": "<your REQUEST_ID>", "status": "pending", "statusUrl": "/api/phones/provision/<your REQUEST_ID>" }

Importing from Twilio

With a Twilio account connected, GET /api/phones/import lists the US, Canadian and Australian numbers in that account that no dBel workspace has imported yet. To import one, POST /api/phones/import with { "sid": "<twilioSid from a list row>" }. A number from any other country answers PHONE_COUNTRY_NOT_ALLOWED (422), and nothing changes in your Twilio account. Without a connected account both answer TWILIO_NOT_CONFIGURED. The import returns no body; the number then appears in the phone list. Before the first import, a workspace owner or admin must confirm STOP handling in Settings, once. Until then the import answers STOP_HANDLING_NOT_CONFIRMED (403). The API can check this confirmation but cannot give it.

US texting registration

Each number carries smsRegistrationStatus and smsRegistrationReason. They say whether the number may text US mobiles. Your assistant texts a US mobile only from an imported number whose status is registered, and only after the caller says yes on the call. See the US texting guide.

  • registered — the number's US texting registration (A2P 10DLC campaign, or toll-free verification) is approved in its Twilio account. This is not a promise that every text delivers: a carrier can still refuse one, and then the status changes.
  • pending — the registration is waiting for approval.
  • unregistered — the number may not text US mobiles. smsRegistrationReason says why: for example not_in_campaign (not in an approved campaign), tollfree_unverified, not_us_sender (a number from outside the US and Canada), dbel_number (texts to US numbers are off for numbers bought through dBel for now) or carrier_blocked (a carrier refused a text).
  • unknown — not checked yet, or dBel could not read the Twilio account (no_twilio_access).

dBel checks each number when you import it, again from time to time after that, and when a carrier reports a problem with a text.

Deleting a number

DELETE /api/phones/{phoneId} first sets the number count on the workspace owner's subscription from a fresh count, then removes the number from the workspace, then releases or detaches it. If the billing update or the removal fails, the number is kept, nothing is released or detached yet, and the call answers PHONE_DELETE_FAILED (502). Retry it. A retry is safe: it counts again, so it never takes a second number off the bill. A 204 means the number is gone from the workspace and off the bill. Some steps are best-effort and do not change a 204: removing the number from our call routing, detaching an imported number from your Twilio trunk, and releasing a provisioned number at Twilio (we retry the release later). A released number can't be recovered: see When a number is released.

Endpoints

GET/api/phones

List the workspace's phone numbers.

Auth: Bearer token · any workspace member

Query parameters

FieldTypeNotes
limitinteger 1–100Rows per page. Default 20.
cursorstringThe nextCursor from the previous page.

Responses

200 JSON body:

FieldTypeNotes
phonesobject[]capabilities uses lowercase keys (voice, sms, mms); older rows can carry SMS / MMS. Read both spellings. smsRegistrationStatus is registered when the number's US texting registration is approved in its Twilio account — not a promise that every text delivers; smsRegistrationReason says why a number is not registered.
phones[].idstring
phones[].friendlyNamestring
phones[].phoneNumberstring
phones[].countryCodestring
phones[].assistantIdstring | null
phones[].providerenum: dbel | twilio | ringcentral | telnyx | custom
phones[].capabilitiesjson
phones[].smsRegistrationStatusenum: unknown | unregistered | pending | registered
phones[].smsRegistrationReasonenum: not_in_campaign | campaign_pending | campaign_failed | sole_prop_shared | tollfree_pending | tollfree_unverified | not_us_sender | dbel_number | carrier_blocked | carrier_pending | no_twilio_access | null
phones[].createdAtdatetime
phones[].updatedAtdatetime
hasMoreboolean
nextCursorstring | null

Errors

Problem Details (RFC 9457). Each code links to its reference page.

Plus the auth-layer codes every endpoint can return

GET/api/phones/{phoneId}

Fetch one phone number.

Auth: Bearer token · any workspace member

Responses

200 JSON body:

FieldTypeNotes
phoneobjectcapabilities uses lowercase keys (voice, sms, mms); older rows can carry SMS / MMS. Read both spellings. smsRegistrationStatus is registered when the number's US texting registration is approved in its Twilio account — not a promise that every text delivers; smsRegistrationReason says why a number is not registered.
phone.idstring
phone.friendlyNamestring
phone.phoneNumberstring
phone.countryCodestring
phone.assistantIdstring | null
phone.providerenum: dbel | twilio | ringcentral | telnyx | custom
phone.capabilitiesjson
phone.smsRegistrationStatusenum: unknown | unregistered | pending | registered
phone.smsRegistrationReasonenum: not_in_campaign | campaign_pending | campaign_failed | sole_prop_shared | tollfree_pending | tollfree_unverified | not_us_sender | dbel_number | carrier_blocked | carrier_pending | no_twilio_access | null
phone.createdAtdatetime
phone.updatedAtdatetime

Errors

Problem Details (RFC 9457). Each code links to its reference page.

Plus the auth-layer codes every endpoint can return

DELETE/api/phones/{phoneId}

Release (dBel-provisioned) or detach (imported) a phone number.

Auth: Bearer token · workspace ADMIN or OWNER

Responses

204 No body.

Errors

Problem Details (RFC 9457). Each code links to its reference page.

Plus the auth-layer codes every endpoint can return

GET/api/phones/provision

Search numbers available to provision in a country.

Auth: Bearer token · any workspace member

Query parameters

FieldTypeNotes
countryCode *`US` | `CA`Country to search. Any other code answers INVALID_REQUEST_QUERY.
requireSmsbooleantrue limits results to SMS-capable numbers (the pool decides type).
areaCodestring — 3 digits, first digit 2–9A US or Canadian area code.
limitinteger 1–100Rows per page. Default 50.
cursorstringThe nextCursor from the previous page.

Responses

200 JSON body:

FieldTypeNotes
phonesobject[]
phones[].phoneNumberstring
phones[].friendlyNamestring
phones[].capabilitiesobject
phones[].capabilities.voiceboolean
phones[].capabilities.SMSboolean
phones[].capabilities.MMSboolean
phones[].addressRequirementsenum: none | any | local | foreign
phones[].localitystring | null
phones[].regionstring | null
phones[].isoCountrystring
phones[].postalCodestring | null
phones[].monthlyPricenumber
phones[].perMinPricenumber
phones[].typeenum: local
totalPhonesnumber
hasMoreboolean
nextCursorstring | null

totalPhones counts the rows on this page only. The search returns local numbers today.

Errors

Problem Details (RFC 9457). Each code links to its reference page.

Plus the auth-layer codes every endpoint can return

POST/api/phones/provision

Provision a number from the search results. Asynchronous — poll the status URL.

Auth: Bearer token · workspace ADMIN or OWNER · plan: a paid subscription

Query parameters

FieldTypeNotes
dryRun`1`Check the role, body and plan without provisioning or billing. Returns no price and skips the already-taken checks; the statusUrl answers NOT_FOUND. Also accepted as an x-dry-run: 1 header. Not read from the body.

Request body

application/json

type: send local. Toll-free numbers are no longer sold: tollFree, or a toll-free phoneNumber, answers PHONE_TYPE_NOT_SOLD (422), and you can import a toll-free number from your own Twilio account instead. clientRequestId (a UUID) becomes the requestId. A retry while that request is pending returns it; once it has succeeded or failed, the same id answers RESOURCE_CONFLICT.

FieldTypeNotes
countryCode *string
type *enum: local | tollFree
phoneNumber *string
clientRequestIdstringUUID

Responses

202 JSON body:

FieldTypeNotes
requestIdstring
statusenum: pending | succeeded | error_pending | failed
statusUrlstring
dryRuntrue — present only on a dry run

A POST for a number this workspace already has pending returns that request's requestId and statusUrl, whatever clientRequestId you send. A Location header carries statusUrl.

Errors

Problem Details (RFC 9457). Each code links to its reference page.

  • 402 FREE_PLAN_RESTRICTED — This action is not available on the free plan.
  • 403 INSUFFICIENT_PRIVILEGES — You do not have sufficient privileges to edit this resource.
  • 400 INVALID_REQUEST_BODY — The request body is invalid.
  • 422 PHONE_TYPE_NOT_SOLD — This type of number is no longer sold. Toll-free numbers can be imported from your own Twilio account instead.
  • 402 PURCHASE_PAYMENT_FAILED — The payment did not go through, so the number was not bought and nothing was charged. Check the card in Account → Manage Billing, then try again.
  • 409 RESOURCE_CONFLICT — The request conflicts with the current state of the target resource.
  • 402 SUBSCRIPTION_ISSUE — Your subscription is inactive or incomplete or has a payment issue.
  • 500 UNKNOWN_ERROR — An unexpected server error occurred. Please try again later.
Plus the auth-layer codes every endpoint can return

GET/api/phones/provision/{requestId}

Poll a provisioning request.

An id from another workspace answers WORKSPACE_NOT_FOUND_OR_UNAUTHORIZED, not NOT_FOUND.

Auth: Bearer token · any workspace member

Responses

200 JSON body:

FieldTypeNotes
requestIdstring
statusenum: pending | succeeded | error_pending | failed
errorstring | null
stripeSubscriptionIdstring | null
phoneIdstring | null
createdAtdatetime
updatedAtdatetime

phoneId is set once the phone exists. error can be set on a pending or succeeded request too. No code sets status to error_pending today. After 5 failed purchase attempts a request ends failed. A request still waiting on entitlement after 24 hours, or holding its number after 7 days, ends failed with the error provisioning_expired. A purchase whose payment did not go through ends failed with the error stripe_payment_failed (the POST answered PURCHASE_PAYMENT_FAILED).

Errors

Problem Details (RFC 9457). Each code links to its reference page.

Plus the auth-layer codes every endpoint can return

GET/api/phones/import

List the US, Canadian and Australian numbers in the connected Twilio account that are not imported yet.

Auth: Bearer token · any workspace member

Query parameters

FieldTypeNotes
limitinteger 1–100Rows per page. Default 50.
cursorstringThe nextCursor from the previous page.
friendlyNamestringFilter by Twilio friendly name.
phoneNumberstringFilter by number (Twilio pattern match).
originenum: twilio | hostedFilter by Twilio origin.
betabooleanFilter by Twilio beta flag.

Responses

200 JSON body:

FieldTypeNotes
phonesobject[]
phones[].twilioSidstring
phones[].phoneNumberstring
phones[].friendlyNamestring
phones[].capabilitiesobject
phones[].capabilities.voiceboolean
phones[].capabilities.SMSboolean
phones[].capabilities.MMSboolean
phones[].addressRequirementsenum: none | any | local | foreign
totalPhonesnumber
hasMoreboolean
nextCursorstring | null

totalPhones counts the rows on this page only. Numbers already imported, and numbers from other countries, are dropped after paging, so a page can be short or empty while hasMore is true — keep paging until it is false.

Errors

Problem Details (RFC 9457). Each code links to its reference page.

Plus the auth-layer codes every endpoint can return

POST/api/phones/import

Import a Twilio number by its SID.

Returns no body. Find the new number with GET /api/phones. Only a US, Canadian or Australian number imports; any other answers PHONE_COUNTRY_NOT_ALLOWED (422) and nothing changes in your Twilio account or the workspace.

Auth: Bearer token · workspace ADMIN or OWNER

Request body

application/json

FieldTypeNotes
sid *stringmin 34, max 34

Responses

204 No body.

Errors

Problem Details (RFC 9457). Each code links to its reference page.

Plus the auth-layer codes every endpoint can return