Skip to content
TriedDocs
Phone numbers

Provision phone number

Retry or re-apply SIP provisioning for a number.

POSThttps://api.tried.com.au/provision-phone-number/{n}

Needs keys Runs SIP provisioning for a number again. Use it when provisioning_status is error, or after you change something outside Tried (for example the trunk on your carrier). Real provisioning needs LiveKit (LIVEKIT_URL), plus Telnyx or Twilio for numbers bought there. Without keys, mock mode records each request in List telephony operations and returns mock IDs.

What it does depends on the number:

  • Attached to a SIP trunk (sip_trunk_id set): syncs the shared trunk's LiveKit resources and copies their IDs onto the number.
  • Telnyx: makes sure the Telnyx FQDN connection exists, assigns the number to it, then creates or updates the LiveKit trunks and dispatch rule.
  • Twilio, bought through Tried: makes sure the workspace's Twilio Elastic SIP trunk exists and attaches the number, then the LiveKit steps.
  • Custom or imported Twilio: creates or updates the LiveKit inbound trunk, outbound trunk (to termination_uri) and dispatch rule.

Existing LiveKit trunks are updated in place, so calling this more than once is safe.

Request#

Path parameter Type Required Description
n string Yes The number in E.164, with + encoded as %2B.

This endpoint takes no query or body parameters.

Example request#

curl -X POST https://api.tried.com.au/provision-phone-number/%2B61290001234 \
  -H "Authorization: Bearer $TRIED_API_KEY"
const n = encodeURIComponent("+61290001234");
const res = await fetch(`https://api.tried.com.au/provision-phone-number/${n}`, {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.TRIED_API_KEY}` },
});
const number = await res.json();
import os, requests
from urllib.parse import quote

res = requests.post(
    f"https://api.tried.com.au/provision-phone-number/{quote('+61290001234')}",
    headers={"Authorization": f"Bearer {os.environ['TRIED_API_KEY']}"},
)
number = res.json()

Response#

200 OK

The number after provisioning. See Get phone number for every field. When provisioning fails, the response is 502 with error_code provisioning_failed and the reason in message. The number keeps provisioning_status error and provisioning_error until a retry succeeds.

{
  "phone_number": "+61290001234",
  "phone_number_pretty": "+61 2 9000 1234",
  "nickname": "Head office",
  "provider": "custom",
  "inbound_agents": [{ "agent_id": "agent_8d2f61c0a94b3e57d1f0c2a6", "weight": 1 }],
  "outbound_agents": [],
  "inbound_webhook_url": null,
  "allowed_inbound_country_list": null,
  "allowed_outbound_country_list": null,
  "termination_uri": "sip.example.com",
  "sip_trunk_auth_username": "tried",
  "last_modification_timestamp": 1792404000000,
  "fallback_number": null,
  "transport": "TCP",
  "media_encryption": "allowed",
  "sip_trunk_id": null,
  "cps_limit": null,
  "livekit_inbound_trunk_id": "ST_4kQm8vWz2RfT",
  "livekit_outbound_trunk_id": "ST_9pLx3cHn7YbD",
  "livekit_dispatch_rule_id": "SDR_6tJe1sGa5UoK",
  "provisioning_status": "provisioned",
  "provisioning_error": null,
  "spam_flagged": false,
  "country_code": null
}

Errors#

Status When
401 Missing or invalid API key.
403 The key's IP allowlist or scopes reject the request. This route needs the numbers scope. Members get The member role is read-only.
404 Phone number ... not found in this workspace.
502 Provisioning failed: <reason>, with error_code provisioning_failed.
429 Rate limit exceeded. See Rate limits.

See Errors for the body format.