跳到导航

分配电话号码

为接待员分配电话号码。优先使用工作区已持有但尚未关联的号码。否则,在美国和加拿大,会从号码池中获取或购买带有所请求 area_codes 之一的号码;如不可用,则使用商家所在国家/地区的任意号码。在需要提交材料的国家/地区,号码会立即签发,但仅在工作区自身的注册获批后才能接听公众来电(参见 accepts_public_calls)。这会计入套餐的电话号码上限,免费套餐每天只能获取少量新号码。无可用号码时返回 404;若经销商通过其自身的 Twilio 账户或 SIP 中继提供工作区号码,且无空闲号码,则返回 403 telephony_managed_by_reseller。

请求头

xi-api-keystring可选
xi-workspace-idstring必需

经销商 API 密钥操作的客户工作区。

请求

This endpoint expects an object.
customer_facing_agent_idstring必需

接听该号码来电的接待员。

area_codeslist of strings or null可选

首选的美国或加拿大区号,例如 ["415", "628"]。将忽略企业所在国家/地区以外的区号;如果这些区号均不可用,则会提供任意号码。

number_typeenum or null可选
Local or mobile, in a country that requires paperwork before a number takes calls. Leave unset to try mobile first. Ignored in the US and Canada.
允许的值:
idempotency_keystring or null可选<=255 characters

Client-generated key that makes a retry safe. The same key and body within 24 hours returns the first result without running again. While that first request is still running, a retry gets 409 idempotency_key_in_progress; a different body with the same key gets 400 idempotency_key_reused. A request that fails is not saved, so it can be retried with the same key.

响应

成功响应

idstring

电话号码分配 ID。

is_activeboolean只读

号码是否启用;已停用号码在释放前的 14 天内为 false。

accepts_public_callsboolean只读

公众呼入电话是否可以转接至接待员。

phone_numberstring or null可选
Phone number in E.164 format.
is_byoboolean可选默认为 false

电话为自带号码时为 true:工作区通过自己的电话服务提供商(Twilio 凭据或 SIP 中继)注册。BYO 电话永不属于共享号码池,不计入套餐的电话号码上限,并会在释放时删除而非归还至号码池。

providerenum可选默认为 twilio

此电话号码的电话服务提供商。

允许的值:
nanp_area_codeinteger可选默认为 0

美国/加拿大 NANP 区号(NPA),为整数。

customer_facing_agent_idstring or null可选

接听此号码来电的接待员。工作区持有该号码但尚无接待员接听时为 null。

deactivated_at_unixinteger or null可选

此号码停用时的 Unix 时间戳;14 天后将释放。处于活跃状态时为 null。

deactivation_reasonenum or null可选

该号码被停用的原因。启用时为 Null。

允许的值:
regulatory_statusenum or null可选

Null for numbers that need no paperwork. held while the workspace’s own application is under review, approved once it passed and the number is fully usable.

允许的值:
regulatory_number_typeenum or null可选

该号码签发时所属的受监管号码类型。无需提交材料的号码为 null。

允许的值:
regulatory_countrystring or null可选
ISO country the regulated number was issued in. Null for numbers that need no paperwork.
created_at_unixinteger可选

创建时间,以秒为单位的 Unix 时间戳。

updated_at_unixinteger可选

上次更新时间,以秒为单位的 Unix 时间戳。

错误

422
Unprocessable Entity Error