Skip to content
DhvaneeDocs
Dashboard
On this page

Phone numbers API

List the numbers of your workspace, bring in a number you already own, and choose which agent answers each one.

This API works with phone numbers your workspace already has. You can list them, import a number you own at your own carrier, and point a number at an agent or take it off one. It cannot buy, search for or release a number; for those, use the dashboard.

The machine-readable contract is openapi.public.yaml. Download it for clients and codegen. This site has no live Try-it console.

Scopes

  • numbers:read for GET
  • numbers:write for import, attach and detach

The phone number object

FieldTypeNotes
idstring (UUID)Set by Dhvanee. Use it in the attach and detach paths.
phone_numberstringIn international format, for example +14155550134.
labelstring or nullYour own name for the number.
providerstringThe carrier the number is on: twilio or exotel.
byobooleantrue for a number you imported from your own carrier account.
boundbooleantrue when the carrier has been set up to send this number's calls to Dhvanee.
agent_idstring (UUID) or nullThe agent that answers calls to this number. null when none is chosen.
created_atstring or nullISO 8601.
bind_messagestring or nullOnly in the import, attach and detach responses: a note from the carrier set-up, when there is one.
{"id": "e937600f-a705-46c7-8c9f-250ad670fc94", "phone_number": "+14155550134", "label": "US patients line", "provider": "twilio", "byo": true, "bound": true, "agent_id": null, "created_at": "2026-11-22T09:09:40+00:00"}

List numbers

Oldest first. The response holds every number in the workspace; there is no paging.

curl -sS -X GET "https://api.stage.dhvanee.com/v1/phone-numbers" \
  -H "Authorization: Bearer dhvanee_live_YOUR_KEY"
{"items": [{"id": "13f9f9a2-...", "phone_number": "+918045678101", "label": "Main clinic line", "provider": "exotel", "byo": false, "bound": true, "agent_id": "60ebc27a-...", "created_at": "2026-11-07T09:09:40+00:00"}]}

Import a number you own

Brings in a number from your own carrier account. Dhvanee checks the details with the carrier and sets the number up to send its calls to your workspace, so this call can take a moment and fails if the carrier refuses. Returns 201 with the number.

curl -sS -X POST "https://api.stage.dhvanee.com/v1/phone-numbers/import" \
  -H "Authorization: Bearer dhvanee_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"provider":"twilio","phone_number":"+14155550134","account_sid":"ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","auth_token":"YOUR_CARRIER_AUTH_TOKEN","label":"Support"}'
FieldRequiredRules
provideryestwilio or exotel.
phone_numberyes5 to 32 characters. Twilio: any country, written with + and the country code. Exotel: an Indian number (+91).
account_sidyesYour account id at the carrier, up to 64 characters. Twilio: AC followed by 32 hexadecimal characters.
auth_tokenTwilioUp to 128 characters.
api_key, api_token, subdomain, app_idExotelAll four are required. subdomain must be the carrier's API host, for example api.in.exotel.com. account_sid and app_id may contain only letters, digits, - and _.
labelnoUp to 128 characters.
workspace_agent_idnoAn agent of this workspace to answer the number straight away. Note the name: attach and detach use agent_id, import uses workspace_agent_id.
  • A number can belong to one workspace only. Importing a number that is already in any workspace answers 409, however it is written (+1 (415) 555-0134 and +14155550134 are the same number).
  • Your carrier credentials are stored sealed and are never returned in any response.
  • If setting up the carrier fails, nothing is saved and the carrier's reason comes back as a 400, for example that the number was not found in that account.

Attach a number to an agent

Makes the agent answer calls to the number. If another agent was set, it is replaced.

curl -sS -X POST "https://api.stage.dhvanee.com/v1/phone-numbers/NUMBER_ID/attach" \
  -H "Authorization: Bearer dhvanee_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"agent_id":"AGENT_ID"}'

Detach a number from its agent

Leaves the number with no agent. The number stays in the workspace and stays set up with the carrier; it just has no agent to answer.

curl -sS -X POST "https://api.stage.dhvanee.com/v1/phone-numbers/NUMBER_ID/detach" \
  -H "Authorization: Bearer dhvanee_live_YOUR_KEY"
  • Both return 200 with the updated number.
  • Attach and detach only change which agent is chosen. They do not contact the carrier and do not change bound.
  • Campaigns that dial from the number are not checked or changed here; check them before you detach a number they use.

Buying and searching

POST /v1/phone-numbers exists only to refuse. A body that asks to buy or search (it contains a key such as buy, purchase, search, shop, area_code, country_code, quantity or order) answers 422, and any other body answers 404 pointing you to import or attach.

Errors

StatusWhen
400Import: Enter the number in international format, starting with + and the country code., Exotel numbers must be from IN (+91)., or the carrier refused the set-up (its reason is the message).
401No key, or an unknown or revoked key (Valid API key is required).
403The key lacks the scope (API key needs numbers:write scope).
404Phone number not found or Agent not found (also on import with an unknown workspace_agent_id).
409Import: Phone number already mapped to a workspace.
422 (import)A missing field, Twilio Account SID must look like AC followed by 32 hex characters, Missing required field(s): auth_token (or the missing Exotel fields), Subdomain must be an Exotel API host such as api.in.exotel.com, a provider that is not twilio or exotel, or an id that is not a UUID.
422 (buy or search)POST /v1/phone-numbers with a buy or search key: Buying and searching numbers is not available on the public API. List owned numbers, attach one to an agent, or import a number you already own.
429Too many requests. See Rate limits.

Agents are managed through the Agents API. Limits and keys: Authentication, Rate limits.

Phone numbers API · Dhvanee Docs