Skip to main content
POST
/
v1
/
phone-numbers
Register Phone Number
curl --request POST \
  --url https://api.oneinbox.ai/v1/phone-numbers \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "phone_number": "<string>",
  "agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "friendly_name": "<string>",
  "provider_config": {
    "trunk_address": "<string>",
    "auth_username": "<string>",
    "auth_password": "<string>"
  },
  "inbound_routing": {
    "agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "fallback": {
      "agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
    },
    "voicemail_message": "<string>"
  },
  "credential_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'
{
  "id": "<string>",
  "phone_number": "<string>",
  "friendly_name": "<string>",
  "provider": "<string>",
  "agent_id": "<string>",
  "status": "<string>",
  "inbound_trunk_id": "<string>",
  "outbound_trunk_id": "<string>",
  "dispatch_rule_id": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z",
  "inbound_routing": {
    "agent_id": "<string>",
    "fallback": {
      "agent_id": "<string>"
    },
    "voicemail_message": "<string>"
  }
}

Authorizations

Authorization
string
header
required

Your API key sent as a Bearer credential — Authorization: Bearer <api_key>, where <api_key> starts with oi_sk_ (create one via POST /v1/api-keys). Although the field is labelled 'token', paste your API key here. A dashboard JWT is also accepted on this header for the same endpoints.

Body

application/json
phone_number
string
required
Pattern: ^\+[1-9]\d{1,14}$
provider
enum<string>
required
Available options:
twilio,
telnyx
agent_id
string<uuid>
required
friendly_name
string | null
provider_config
SipProviderConfig · object

SIP digest credentials for outbound trunk auth.

Same three fields for Twilio and Telnyx — they both speak SIP and need a username/password pair plus the trunk address. The values differ per provider:

twilio: trunk_address: '.pstn.twilio.com' auth_username: Twilio Elastic SIP Trunk credential username auth_password: matching password (never logged, stripped from DB)

telnyx: trunk_address: 'sip.telnyx.com' (or your region-specific edge) auth_username: Telnyx SIP connection auth username auth_password: matching password

All fields are OPTIONAL at the schema layer because the service falls back to env vars ({PROVIDER}_TRUNK_ADDRESS, {PROVIDER}_SIP_USERNAME, {PROVIDER}_SIP_PASSWORD) when omitted. The service raises 400 SIP_TRUNK_PROVISION_FAILED if neither path provides all three.

extra="allow" preserves forward-compat — future provider-specific knobs (e.g. Twilio's messaging_service_sid) can be added by callers without us bumping the API.

inbound_routing
InboundRouting · object

Per-number routing override. Stored as JSONB so we can extend with business-hours and caller-id rules later without a schema change.

credential_id
string<uuid> | null

Response

Successful Response

id
string
required
phone_number
string
required
friendly_name
string | null
required
provider
string
required
agent_id
string
required
status
string
required
inbound_trunk_id
string | null
required
outbound_trunk_id
string | null
required
dispatch_rule_id
string | null
required
created_at
string<date-time>
required
updated_at
string<date-time>
required
inbound_routing
InboundRouting · object

Per-number routing override. Stored as JSONB so we can extend with business-hours and caller-id rules later without a schema change.