telnyx-numbers-compliance-curl

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
<!-- Auto-generated from Telnyx OpenAPI specs. Do not edit. -->
<!-- Auto-generated from Telnyx OpenAPI specs. Do not edit. -->

Telnyx Numbers Compliance - curl

Telnyx号码合规 - curl

Installation

安装

text
undefined
text
undefined

curl is pre-installed on macOS, Linux, and Windows 10+

curl is pre-installed on macOS, Linux, and Windows 10+

undefined
undefined

Setup

配置

bash
export TELNYX_API_KEY="YOUR_API_KEY_HERE"
All examples below use
$TELNYX_API_KEY
for authentication.
bash
export TELNYX_API_KEY="YOUR_API_KEY_HERE"
以下所有示例均使用
$TELNYX_API_KEY
进行身份验证。

Error Handling

错误处理

All API calls can fail with network errors, rate limits (429), validation errors (422), or authentication errors (401). Always handle errors in production code:
bash
undefined
所有API调用都可能失败,原因包括网络错误、速率限制(429)、验证错误(422)或身份验证错误(401)。在生产代码中请务必做好错误处理:
bash
undefined

Check HTTP status code in response

Check HTTP status code in response

response=$(curl -s -w "\n%{http_code}"
-X POST "https://api.telnyx.com/v2/messages"
-H "Authorization: Bearer $TELNYX_API_KEY"
-H "Content-Type: application/json"
-d '{"to": "+13125550001", "from": "+13125550002", "text": "Hello"}')
http_code=$(echo "$response" | tail -1) body=$(echo "$response" | sed '$d')
case $http_code in 2*) echo "Success: $body" ;; 422) echo "Validation error — check required fields and formats" ;; 429) echo "Rate limited — retry after delay"; sleep 1 ;; 401) echo "Authentication failed — check TELNYX_API_KEY" ;; *) echo "Error $http_code: $body" ;; esac

Common error codes: `401` invalid API key, `403` insufficient permissions,
`404` resource not found, `422` validation error (check field formats),
`429` rate limited (retry with exponential backoff).
response=$(curl -s -w "\n%{http_code}"
-X POST "https://api.telnyx.com/v2/messages"
-H "Authorization: Bearer $TELNYX_API_KEY"
-H "Content-Type: application/json"
-d '{"to": "+13125550001", "from": "+13125550002", "text": "Hello"}')
http_code=$(echo "$response" | tail -1) body=$(echo "$response" | sed '$d')
case $http_code in 2*) echo "Success: $body" ;; 422) echo "Validation error — check required fields and formats" ;; 429) echo "Rate limited — retry after delay"; sleep 1 ;; 401) echo "Authentication failed — check TELNYX_API_KEY" ;; *) echo "Error $http_code: $body" ;; esac

常见错误码:`401` API密钥无效,`403` 权限不足,`404` 资源不存在,`422` 验证错误(请检查字段格式),`429` 触发速率限制(请使用指数退避策略重试)。

Important Notes

重要说明

  • Phone numbers must be in E.164 format (e.g.,
    +13125550001
    ). Include the
    +
    prefix and country code. No spaces, dashes, or parentheses.
  • Pagination: List endpoints return paginated results. Use
    page[number]
    and
    page[size]
    query parameters to navigate pages. Check
    meta.total_pages
    in the response.
  • 电话号码必须采用E.164格式(例如
    +13125550001
    )。需包含
    +
    前缀和国家代码,不得包含空格、短横线或括号。
  • 分页: 列表类接口返回分页结果。可使用
    page[number]
    page[size]
    查询参数翻页,可在响应中查看
    meta.total_pages
    获取总页数。

Retrieve Bundles

查询套餐列表

Get all allowed bundles.
GET /bundle_pricing/billing_bundles
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/bundle_pricing/billing_bundles"
Returns:
cost_code
(string),
created_at
(date),
currency
(string),
id
(uuid),
is_public
(boolean),
mrc_price
(float),
name
(string),
slug
(string),
specs
(array[string])
获取所有可用套餐。
GET /bundle_pricing/billing_bundles
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/bundle_pricing/billing_bundles"
返回参数:
cost_code
(字符串)、
created_at
(日期)、
currency
(字符串)、
id
(UUID)、
is_public
(布尔值)、
mrc_price
(浮点数)、
name
(字符串)、
slug
(字符串)、
specs
(字符串数组)

Get Bundle By Id

根据ID查询套餐

Get a single bundle by ID.
GET /bundle_pricing/billing_bundles/{bundle_id}
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/bundle_pricing/billing_bundles/8661948c-a386-4385-837f-af00f40f111a"
Returns:
active
(boolean),
bundle_limits
(array[object]),
cost_code
(string),
created_at
(date),
id
(uuid),
is_public
(boolean),
name
(string),
slug
(string)
根据ID查询单个套餐详情。
GET /bundle_pricing/billing_bundles/{bundle_id}
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/bundle_pricing/billing_bundles/8661948c-a386-4385-837f-af00f40f111a"
返回参数:
active
(布尔值)、
bundle_limits
(对象数组)、
cost_code
(字符串)、
created_at
(日期)、
id
(UUID)、
is_public
(布尔值)、
name
(字符串)、
slug
(字符串)

Get User Bundles

查询用户套餐列表

Get a paginated list of user bundles.
GET /bundle_pricing/user_bundles
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/bundle_pricing/user_bundles"
Returns:
active
(boolean),
billing_bundle
(object),
created_at
(date),
id
(uuid),
resources
(array[object]),
updated_at
(date),
user_id
(uuid)
获取分页的用户套餐列表。
GET /bundle_pricing/user_bundles
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/bundle_pricing/user_bundles"
返回参数:
active
(布尔值)、
billing_bundle
(对象)、
created_at
(日期)、
id
(UUID)、
resources
(对象数组)、
updated_at
(日期)、
user_id
(UUID)

Create User Bundles

批量创建用户套餐

Creates multiple user bundles for the user.
POST /bundle_pricing/user_bundles/bulk
Optional:
idempotency_key
(uuid),
items
(array[object])
bash
curl \
  -X POST \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  -H "Content-Type: application/json" \
  "https://api.telnyx.com/v2/bundle_pricing/user_bundles/bulk"
Returns:
active
(boolean),
billing_bundle
(object),
created_at
(date),
id
(uuid),
resources
(array[object]),
updated_at
(date),
user_id
(uuid)
为用户批量创建多个用户套餐。
POST /bundle_pricing/user_bundles/bulk
可选参数:
idempotency_key
(UUID)、
items
(对象数组)
bash
curl \
  -X POST \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  -H "Content-Type: application/json" \
  "https://api.telnyx.com/v2/bundle_pricing/user_bundles/bulk"
返回参数:
active
(布尔值)、
billing_bundle
(对象)、
created_at
(日期)、
id
(UUID)、
resources
(对象数组)、
updated_at
(日期)、
user_id
(UUID)

Get Unused User Bundles

查询未使用的用户套餐

Returns all user bundles that aren't in use.
GET /bundle_pricing/user_bundles/unused
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/bundle_pricing/user_bundles/unused"
Returns:
billing_bundle
(object),
user_bundle_ids
(array[string])
返回所有未投入使用的用户套餐。
GET /bundle_pricing/user_bundles/unused
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/bundle_pricing/user_bundles/unused"
返回参数:
billing_bundle
(对象)、
user_bundle_ids
(字符串数组)

Get User Bundle by Id

根据ID查询用户套餐

Retrieves a user bundle by its ID.
GET /bundle_pricing/user_bundles/{user_bundle_id}
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/bundle_pricing/user_bundles/ca1d2263-d1f1-43ac-ba53-248e7a4bb26a"
Returns:
active
(boolean),
billing_bundle
(object),
created_at
(date),
id
(uuid),
resources
(array[object]),
updated_at
(date),
user_id
(uuid)
根据ID获取指定用户套餐详情。
GET /bundle_pricing/user_bundles/{user_bundle_id}
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/bundle_pricing/user_bundles/ca1d2263-d1f1-43ac-ba53-248e7a4bb26a"
返回参数:
active
(布尔值)、
billing_bundle
(对象)、
created_at
(日期)、
id
(UUID)、
resources
(对象数组)、
updated_at
(日期)、
user_id
(UUID)

Deactivate User Bundle

停用用户套餐

Deactivates a user bundle by its ID.
DELETE /bundle_pricing/user_bundles/{user_bundle_id}
bash
curl \
  -X DELETE \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  "https://api.telnyx.com/v2/bundle_pricing/user_bundles/ca1d2263-d1f1-43ac-ba53-248e7a4bb26a"
Returns:
active
(boolean),
billing_bundle
(object),
created_at
(date),
id
(uuid),
resources
(array[object]),
updated_at
(date),
user_id
(uuid)
根据ID停用指定用户套餐。
DELETE /bundle_pricing/user_bundles/{user_bundle_id}
bash
curl \
  -X DELETE \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  "https://api.telnyx.com/v2/bundle_pricing/user_bundles/ca1d2263-d1f1-43ac-ba53-248e7a4bb26a"
返回参数:
active
(布尔值)、
billing_bundle
(对象)、
created_at
(日期)、
id
(UUID)、
resources
(对象数组)、
updated_at
(日期)、
user_id
(UUID)

Get User Bundle Resources

查询用户套餐资源

Retrieves the resources of a user bundle by its ID.
GET /bundle_pricing/user_bundles/{user_bundle_id}/resources
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/bundle_pricing/user_bundles/ca1d2263-d1f1-43ac-ba53-248e7a4bb26a/resources"
Returns:
created_at
(date),
id
(uuid),
resource
(string),
resource_type
(string),
updated_at
(date)
根据ID获取指定用户套餐的关联资源。
GET /bundle_pricing/user_bundles/{user_bundle_id}/resources
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/bundle_pricing/user_bundles/ca1d2263-d1f1-43ac-ba53-248e7a4bb26a/resources"
返回参数:
created_at
(日期)、
id
(UUID)、
resource
(字符串)、
resource_type
(字符串)、
updated_at
(日期)

List all document links

查询所有文档关联

List all documents links ordered by created_at descending.
GET /document_links
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/document_links"
Returns:
created_at
(string),
document_id
(uuid),
id
(uuid),
linked_record_type
(string),
linked_resource_id
(string),
record_type
(string),
updated_at
(string)
按创建时间倒序排列返回所有文档关联记录。
GET /document_links
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/document_links"
返回参数:
created_at
(字符串)、
document_id
(UUID)、
id
(UUID)、
linked_record_type
(字符串)、
linked_resource_id
(字符串)、
record_type
(字符串)、
updated_at
(字符串)

List all documents

查询所有文档

List all documents ordered by created_at descending.
GET /documents
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/documents?filter={'filename': {'contains': 'invoice'}, 'customer_reference': {'in': ['REF001', 'REF002']}, 'created_at': {'gt': '2021-01-01T00:00:00Z'}}&sort=['filename']"
Returns:
av_scan_status
(enum: scanned, infected, pending_scan, not_scanned),
content_type
(string),
created_at
(string),
customer_reference
(string),
filename
(string),
id
(uuid),
record_type
(string),
sha256
(string),
size
(object),
status
(enum: pending, verified, denied),
updated_at
(string)
按创建时间倒序排列返回所有文档。
GET /documents
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/documents?filter={'filename': {'contains': 'invoice'}, 'customer_reference': {'in': ['REF001', 'REF002']}, 'created_at': {'gt': '2021-01-01T00:00:00Z'}}&sort=['filename']"
返回参数:
av_scan_status
(枚举值:scanned、infected、pending_scan、not_scanned)、
content_type
(字符串)、
created_at
(字符串)、
customer_reference
(字符串)、
filename
(字符串)、
id
(UUID)、
record_type
(字符串)、
sha256
(字符串)、
size
(对象)、
status
(枚举值:pending、verified、denied)、
updated_at
(字符串)

Upload a document

上传文档

Upload a document. Uploaded files must be linked to a service within 30 minutes or they will be automatically deleted.
POST /documents
Optional:
customer_reference
(string),
file
(byte),
filename
(string),
url
(string)
bash
curl \
  -X POST \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  -F "file=@/path/to/file" \
  -F "customer_reference=MY REF 001" \
  "https://api.telnyx.com/v2/documents"
Returns:
av_scan_status
(enum: scanned, infected, pending_scan, not_scanned),
content_type
(string),
created_at
(string),
customer_reference
(string),
filename
(string),
id
(uuid),
record_type
(string),
sha256
(string),
size
(object),
status
(enum: pending, verified, denied),
updated_at
(string)
上传文档。上传的文件必须在30分钟内关联到对应服务,否则会被自动删除。
POST /documents
可选参数:
customer_reference
(字符串)、
file
(字节)、
filename
(字符串)、
url
(字符串)
bash
curl \
  -X POST \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  -F "file=@/path/to/file" \
  -F "customer_reference=MY REF 001" \
  "https://api.telnyx.com/v2/documents"
返回参数:
av_scan_status
(枚举值:scanned、infected、pending_scan、not_scanned)、
content_type
(字符串)、
created_at
(字符串)、
customer_reference
(字符串)、
filename
(字符串)、
id
(UUID)、
record_type
(字符串)、
sha256
(字符串)、
size
(对象)、
status
(枚举值:pending、verified、denied)、
updated_at
(字符串)

Retrieve a document

查询文档详情

Retrieve a document.
GET /documents/{id}
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/documents/6a09cdc3-8948-47f0-aa62-74ac943d6c58"
Returns:
av_scan_status
(enum: scanned, infected, pending_scan, not_scanned),
content_type
(string),
created_at
(string),
customer_reference
(string),
filename
(string),
id
(uuid),
record_type
(string),
sha256
(string),
size
(object),
status
(enum: pending, verified, denied),
updated_at
(string)
获取指定文档详情。
GET /documents/{id}
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/documents/6a09cdc3-8948-47f0-aa62-74ac943d6c58"
返回参数:
av_scan_status
(枚举值:scanned、infected、pending_scan、not_scanned)、
content_type
(字符串)、
created_at
(字符串)、
customer_reference
(字符串)、
filename
(字符串)、
id
(UUID)、
record_type
(字符串)、
sha256
(字符串)、
size
(对象)、
status
(枚举值:pending、verified、denied)、
updated_at
(字符串)

Update a document

更新文档

Update a document.
PATCH /documents/{id}
Optional:
av_scan_status
(enum: scanned, infected, pending_scan, not_scanned),
content_type
(string),
created_at
(string),
customer_reference
(string),
filename
(string),
id
(uuid),
record_type
(string),
sha256
(string),
size
(object),
status
(enum: pending, verified, denied),
updated_at
(string)
bash
curl \
  -X PATCH \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  -H "Content-Type: application/json" \
  "https://api.telnyx.com/v2/documents/6a09cdc3-8948-47f0-aa62-74ac943d6c58"
Returns:
av_scan_status
(enum: scanned, infected, pending_scan, not_scanned),
content_type
(string),
created_at
(string),
customer_reference
(string),
filename
(string),
id
(uuid),
record_type
(string),
sha256
(string),
size
(object),
status
(enum: pending, verified, denied),
updated_at
(string)
更新指定文档信息。
PATCH /documents/{id}
可选参数:
av_scan_status
(枚举值:scanned、infected、pending_scan、not_scanned)、
content_type
(字符串)、
created_at
(字符串)、
customer_reference
(字符串)、
filename
(字符串)、
id
(UUID)、
record_type
(字符串)、
sha256
(字符串)、
size
(对象)、
status
(枚举值:pending、verified、denied)、
updated_at
(字符串)
bash
curl \
  -X PATCH \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  -H "Content-Type: application/json" \
  "https://api.telnyx.com/v2/documents/6a09cdc3-8948-47f0-aa62-74ac943d6c58"
返回参数:
av_scan_status
(枚举值:scanned、infected、pending_scan、not_scanned)、
content_type
(字符串)、
created_at
(字符串)、
customer_reference
(字符串)、
filename
(字符串)、
id
(UUID)、
record_type
(字符串)、
sha256
(字符串)、
size
(对象)、
status
(枚举值:pending、verified、denied)、
updated_at
(字符串)

Delete a document

删除文档

Delete a document. A document can only be deleted if it's not linked to a service. If it is linked to a service, it must be unlinked prior to deleting.
DELETE /documents/{id}
bash
curl \
  -X DELETE \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  "https://api.telnyx.com/v2/documents/6a09cdc3-8948-47f0-aa62-74ac943d6c58"
Returns:
av_scan_status
(enum: scanned, infected, pending_scan, not_scanned),
content_type
(string),
created_at
(string),
customer_reference
(string),
filename
(string),
id
(uuid),
record_type
(string),
sha256
(string),
size
(object),
status
(enum: pending, verified, denied),
updated_at
(string)
删除指定文档。只有未关联到任何服务的文档才能被删除,如果已关联服务,需要先解除关联再删除。
DELETE /documents/{id}
bash
curl \
  -X DELETE \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  "https://api.telnyx.com/v2/documents/6a09cdc3-8948-47f0-aa62-74ac943d6c58"
返回参数:
av_scan_status
(枚举值:scanned、infected、pending_scan、not_scanned)、
content_type
(字符串)、
created_at
(字符串)、
customer_reference
(字符串)、
filename
(字符串)、
id
(UUID)、
record_type
(字符串)、
sha256
(字符串)、
size
(对象)、
status
(枚举值:pending、verified、denied)、
updated_at
(字符串)

Download a document

下载文档

Download a document.
GET /documents/{id}/download
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/documents/6a09cdc3-8948-47f0-aa62-74ac943d6c58/download"
下载指定文档。
GET /documents/{id}/download
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/documents/6a09cdc3-8948-47f0-aa62-74ac943d6c58/download"

Generate a temporary download link for a document

生成文档临时下载链接

Generates a temporary pre-signed URL that can be used to download the document directly from the storage backend without authentication.
GET /documents/{id}/download_link
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/documents/550e8400-e29b-41d4-a716-446655440000/download_link"
Returns:
url
(uri)
生成临时预签名URL,无需身份验证即可直接从存储后端下载文档。
GET /documents/{id}/download_link
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/documents/550e8400-e29b-41d4-a716-446655440000/download_link"
返回参数:
url
(URI)

Update requirement group for a phone number order

更新号码订单的要求组

POST /number_order_phone_numbers/{id}/requirement_group
— Required:
requirement_group_id
bash
curl \
  -X POST \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "requirement_group_id": "550e8400-e29b-41d4-a716-446655440000"
}' \
  "https://api.telnyx.com/v2/number_order_phone_numbers/550e8400-e29b-41d4-a716-446655440000/requirement_group"
Returns:
bundle_id
(uuid),
country_code
(string),
deadline
(date-time),
id
(uuid),
is_block_number
(boolean),
locality
(string),
order_request_id
(uuid),
phone_number
(string),
phone_number_type
(string),
record_type
(string),
regulatory_requirements
(array[object]),
requirements_met
(boolean),
requirements_status
(string),
status
(string),
sub_number_order_id
(uuid)
POST /number_order_phone_numbers/{id}/requirement_group
— 必选参数:
requirement_group_id
bash
curl \
  -X POST \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "requirement_group_id": "550e8400-e29b-41d4-a716-446655440000"
}' \
  "https://api.telnyx.com/v2/number_order_phone_numbers/550e8400-e29b-41d4-a716-446655440000/requirement_group"
返回参数:
bundle_id
(UUID)、
country_code
(字符串)、
deadline
(日期时间)、
id
(UUID)、
is_block_number
(布尔值)、
locality
(字符串)、
order_request_id
(UUID)、
phone_number
(字符串)、
phone_number_type
(字符串)、
record_type
(字符串)、
regulatory_requirements
(对象数组)、
requirements_met
(布尔值)、
requirements_status
(字符串)、
status
(字符串)、
sub_number_order_id
(UUID)

Retrieve regulatory requirements for a list of phone numbers

查询号码列表的监管要求

GET /phone_numbers_regulatory_requirements
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/phone_numbers_regulatory_requirements"
Returns:
phone_number
(string),
phone_number_type
(string),
record_type
(string),
region_information
(array[object]),
regulatory_requirements
(array[object])
GET /phone_numbers_regulatory_requirements
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/phone_numbers_regulatory_requirements"
返回参数:
phone_number
(字符串)、
phone_number_type
(字符串)、
record_type
(字符串)、
region_information
(对象数组)、
regulatory_requirements
(对象数组)

Retrieve regulatory requirements

查询监管要求

GET /regulatory_requirements
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/regulatory_requirements"
Returns:
action
(string),
country_code
(string),
phone_number_type
(string),
regulatory_requirements
(array[object])
GET /regulatory_requirements
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/regulatory_requirements"
返回参数:
action
(字符串)、
country_code
(字符串)、
phone_number_type
(字符串)、
regulatory_requirements
(对象数组)

List requirement groups

查询要求组列表

GET /requirement_groups
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/requirement_groups"
GET /requirement_groups
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/requirement_groups"

Create a new requirement group

创建新要求组

POST /requirement_groups
— Required:
country_code
,
phone_number_type
,
action
Optional:
customer_reference
(string),
regulatory_requirements
(array[object])
bash
curl \
  -X POST \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "country_code": "US",
  "phone_number_type": "local",
  "action": "ordering"
}' \
  "https://api.telnyx.com/v2/requirement_groups"
Returns:
action
(string),
country_code
(string),
created_at
(date-time),
customer_reference
(string),
id
(string),
phone_number_type
(string),
record_type
(string),
regulatory_requirements
(array[object]),
status
(enum: approved, unapproved, pending-approval, declined, expired),
updated_at
(date-time)
POST /requirement_groups
— 必选参数:
country_code
phone_number_type
action
可选参数:
customer_reference
(字符串)、
regulatory_requirements
(对象数组)
bash
curl \
  -X POST \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "country_code": "US",
  "phone_number_type": "local",
  "action": "ordering"
}' \
  "https://api.telnyx.com/v2/requirement_groups"
返回参数:
action
(字符串)、
country_code
(字符串)、
created_at
(日期时间)、
customer_reference
(字符串)、
id
(字符串)、
phone_number_type
(字符串)、
record_type
(字符串)、
regulatory_requirements
(对象数组)、
status
(枚举值:approved、unapproved、pending-approval、declined、expired)、
updated_at
(日期时间)

Get a single requirement group by ID

根据ID查询要求组

GET /requirement_groups/{id}
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/requirement_groups/550e8400-e29b-41d4-a716-446655440000"
Returns:
action
(string),
country_code
(string),
created_at
(date-time),
customer_reference
(string),
id
(string),
phone_number_type
(string),
record_type
(string),
regulatory_requirements
(array[object]),
status
(enum: approved, unapproved, pending-approval, declined, expired),
updated_at
(date-time)
GET /requirement_groups/{id}
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/requirement_groups/550e8400-e29b-41d4-a716-446655440000"
返回参数:
action
(字符串)、
country_code
(字符串)、
created_at
(日期时间)、
customer_reference
(字符串)、
id
(字符串)、
phone_number_type
(字符串)、
record_type
(字符串)、
regulatory_requirements
(对象数组)、
status
(枚举值:approved、unapproved、pending-approval、declined、expired)、
updated_at
(日期时间)

Update requirement values in requirement group

更新要求组中的要求值

PATCH /requirement_groups/{id}
Optional:
customer_reference
(string),
regulatory_requirements
(array[object])
bash
curl \
  -X PATCH \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  -H "Content-Type: application/json" \
  "https://api.telnyx.com/v2/requirement_groups/550e8400-e29b-41d4-a716-446655440000"
Returns:
action
(string),
country_code
(string),
created_at
(date-time),
customer_reference
(string),
id
(string),
phone_number_type
(string),
record_type
(string),
regulatory_requirements
(array[object]),
status
(enum: approved, unapproved, pending-approval, declined, expired),
updated_at
(date-time)
PATCH /requirement_groups/{id}
可选参数:
customer_reference
(字符串)、
regulatory_requirements
(对象数组)
bash
curl \
  -X PATCH \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  -H "Content-Type: application/json" \
  "https://api.telnyx.com/v2/requirement_groups/550e8400-e29b-41d4-a716-446655440000"
返回参数:
action
(字符串)、
country_code
(字符串)、
created_at
(日期时间)、
customer_reference
(字符串)、
id
(字符串)、
phone_number_type
(字符串)、
record_type
(字符串)、
regulatory_requirements
(对象数组)、
status
(枚举值:approved、unapproved、pending-approval、declined、expired)、
updated_at
(日期时间)

Delete a requirement group by ID

根据ID删除要求组

DELETE /requirement_groups/{id}
bash
curl \
  -X DELETE \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  "https://api.telnyx.com/v2/requirement_groups/550e8400-e29b-41d4-a716-446655440000"
Returns:
action
(string),
country_code
(string),
created_at
(date-time),
customer_reference
(string),
id
(string),
phone_number_type
(string),
record_type
(string),
regulatory_requirements
(array[object]),
status
(enum: approved, unapproved, pending-approval, declined, expired),
updated_at
(date-time)
DELETE /requirement_groups/{id}
bash
curl \
  -X DELETE \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  "https://api.telnyx.com/v2/requirement_groups/550e8400-e29b-41d4-a716-446655440000"
返回参数:
action
(字符串)、
country_code
(字符串)、
created_at
(日期时间)、
customer_reference
(字符串)、
id
(字符串)、
phone_number_type
(字符串)、
record_type
(字符串)、
regulatory_requirements
(对象数组)、
status
(枚举值:approved、unapproved、pending-approval、declined、expired)、
updated_at
(日期时间)

Submit a Requirement Group for Approval

提交要求组审核

POST /requirement_groups/{id}/submit_for_approval
bash
curl \
  -X POST \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  -H "Content-Type: application/json" \
  "https://api.telnyx.com/v2/requirement_groups/550e8400-e29b-41d4-a716-446655440000/submit_for_approval"
Returns:
action
(string),
country_code
(string),
created_at
(date-time),
customer_reference
(string),
id
(string),
phone_number_type
(string),
record_type
(string),
regulatory_requirements
(array[object]),
status
(enum: approved, unapproved, pending-approval, declined, expired),
updated_at
(date-time)
POST /requirement_groups/{id}/submit_for_approval
bash
curl \
  -X POST \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  -H "Content-Type: application/json" \
  "https://api.telnyx.com/v2/requirement_groups/550e8400-e29b-41d4-a716-446655440000/submit_for_approval"
返回参数:
action
(字符串)、
country_code
(字符串)、
created_at
(日期时间)、
customer_reference
(字符串)、
id
(字符串)、
phone_number_type
(字符串)、
record_type
(字符串)、
regulatory_requirements
(对象数组)、
status
(枚举值:approved、unapproved、pending-approval、declined、expired)、
updated_at
(日期时间)

List all requirement types

查询所有要求类型

List all requirement types ordered by created_at descending
GET /requirement_types
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/requirement_types?sort=['name']"
Returns:
acceptance_criteria
(object),
created_at
(string),
description
(string),
example
(string),
id
(uuid),
name
(string),
record_type
(string),
type
(enum: document, address, textual),
updated_at
(string)
按创建时间倒序排列返回所有要求类型
GET /requirement_types
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/requirement_types?sort=['name']"
返回参数:
acceptance_criteria
(对象)、
created_at
(字符串)、
description
(字符串)、
example
(字符串)、
id
(UUID)、
name
(字符串)、
record_type
(字符串)、
type
(枚举值:document、address、textual)、
updated_at
(字符串)

Retrieve a requirement types

查询要求类型详情

Retrieve a requirement type by id
GET /requirement_types/{id}
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/requirement_types/a38c217a-8019-48f8-bff6-0fdd9939075b"
Returns:
acceptance_criteria
(object),
created_at
(string),
description
(string),
example
(string),
id
(uuid),
name
(string),
record_type
(string),
type
(enum: document, address, textual),
updated_at
(string)
根据ID查询指定要求类型
GET /requirement_types/{id}
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/requirement_types/a38c217a-8019-48f8-bff6-0fdd9939075b"
返回参数:
acceptance_criteria
(对象)、
created_at
(字符串)、
description
(字符串)、
example
(字符串)、
id
(UUID)、
name
(字符串)、
record_type
(字符串)、
type
(枚举值:document、address、textual)、
updated_at
(字符串)

List all requirements

查询所有要求

List all requirements with filtering, sorting, and pagination
GET /requirements
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/requirements?sort=['country_code']"
Returns:
action
(enum: both, branded_calling, ordering, porting),
country_code
(string),
created_at
(string),
id
(uuid),
locality
(string),
phone_number_type
(enum: local, national, toll_free),
record_type
(string),
requirements_types
(array[object]),
updated_at
(string)
支持筛选、排序和分页,返回所有要求列表
GET /requirements
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/requirements?sort=['country_code']"
返回参数:
action
(枚举值:both、branded_calling、ordering、porting)、
country_code
(字符串)、
created_at
(字符串)、
id
(UUID)、
locality
(字符串)、
phone_number_type
(枚举值:local、national、toll_free)、
record_type
(字符串)、
requirements_types
(对象数组)、
updated_at
(字符串)

Retrieve a document requirement

查询文档要求详情

Retrieve a document requirement record
GET /requirements/{id}
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/requirements/a9dad8d5-fdbd-49d7-aa23-39bb08a5ebaa"
Returns:
action
(enum: both, branded_calling, ordering, porting),
country_code
(string),
created_at
(string),
id
(uuid),
locality
(string),
phone_number_type
(enum: local, national, toll_free),
record_type
(string),
requirements_types
(array[object]),
updated_at
(string)
获取指定文档要求记录
GET /requirements/{id}
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/requirements/a9dad8d5-fdbd-49d7-aa23-39bb08a5ebaa"
返回参数:
action
(枚举值:both、branded_calling、ordering、porting)、
country_code
(字符串)、
created_at
(字符串)、
id
(UUID)、
locality
(字符串)、
phone_number_type
(枚举值:local、national、toll_free)、
record_type
(字符串)、
requirements_types
(对象数组)、
updated_at
(字符串)

Update requirement group for a sub number order

更新子号码订单的要求组

POST /sub_number_orders/{id}/requirement_group
— Required:
requirement_group_id
bash
curl \
  -X POST \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "requirement_group_id": "a4b201f9-8646-4e54-a7d2-b2e403eeaf8c"
}' \
  "https://api.telnyx.com/v2/sub_number_orders/550e8400-e29b-41d4-a716-446655440000/requirement_group"
Returns:
country_code
(string),
created_at
(date-time),
customer_reference
(string),
id
(uuid),
is_block_sub_number_order
(boolean),
order_request_id
(uuid),
phone_number_type
(string),
phone_numbers
(array[object]),
phone_numbers_count
(integer),
record_type
(string),
regulatory_requirements
(array[object]),
requirements_met
(boolean),
status
(string),
updated_at
(date-time)
POST /sub_number_orders/{id}/requirement_group
— 必选参数:
requirement_group_id
bash
curl \
  -X POST \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "requirement_group_id": "a4b201f9-8646-4e54-a7d2-b2e403eeaf8c"
}' \
  "https://api.telnyx.com/v2/sub_number_orders/550e8400-e29b-41d4-a716-446655440000/requirement_group"
返回参数:
country_code
(字符串)、
created_at
(日期时间)、
customer_reference
(字符串)、
id
(UUID)、
is_block_sub_number_order
(布尔值)、
order_request_id
(UUID)、
phone_number_type
(字符串)、
phone_numbers
(对象数组)、
phone_numbers_count
(整数)、
record_type
(字符串)、
regulatory_requirements
(对象数组)、
requirements_met
(布尔值)、
status
(字符串)、
updated_at
(日期时间)

List all user addresses

查询所有用户地址

Returns a list of your user addresses.
GET /user_addresses
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/user_addresses?sort=street_address"
Returns:
administrative_area
(string),
borough
(string),
business_name
(string),
country_code
(string),
created_at
(string),
customer_reference
(string),
extended_address
(string),
first_name
(string),
id
(uuid),
last_name
(string),
locality
(string),
neighborhood
(string),
phone_number
(string),
postal_code
(string),
record_type
(string),
street_address
(string),
updated_at
(string)
返回你的所有用户地址列表。
GET /user_addresses
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/user_addresses?sort=street_address"
返回参数:
administrative_area
(字符串)、
borough
(字符串)、
business_name
(字符串)、
country_code
(字符串)、
created_at
(字符串)、
customer_reference
(字符串)、
extended_address
(字符串)、
first_name
(字符串)、
id
(UUID)、
last_name
(字符串)、
locality
(字符串)、
neighborhood
(字符串)、
phone_number
(字符串)、
postal_code
(字符串)、
record_type
(字符串)、
street_address
(字符串)、
updated_at
(字符串)

Creates a user address

创建用户地址

Creates a user address.
POST /user_addresses
— Required:
first_name
,
last_name
,
business_name
,
street_address
,
locality
,
country_code
Optional:
administrative_area
(string),
borough
(string),
customer_reference
(string),
extended_address
(string),
neighborhood
(string),
phone_number
(string),
postal_code
(string),
skip_address_verification
(boolean)
bash
curl \
  -X POST \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "first_name": "Alfred",
  "last_name": "Foster",
  "business_name": "Toy-O'Kon",
  "street_address": "600 Congress Avenue",
  "locality": "Austin",
  "country_code": "US"
}' \
  "https://api.telnyx.com/v2/user_addresses"
Returns:
administrative_area
(string),
borough
(string),
business_name
(string),
country_code
(string),
created_at
(string),
customer_reference
(string),
extended_address
(string),
first_name
(string),
id
(uuid),
last_name
(string),
locality
(string),
neighborhood
(string),
phone_number
(string),
postal_code
(string),
record_type
(string),
street_address
(string),
updated_at
(string)
创建新的用户地址。
POST /user_addresses
— 必选参数:
first_name
last_name
business_name
street_address
locality
country_code
可选参数:
administrative_area
(字符串)、
borough
(字符串)、
customer_reference
(字符串)、
extended_address
(字符串)、
neighborhood
(字符串)、
phone_number
(字符串)、
postal_code
(字符串)、
skip_address_verification
(布尔值)
bash
curl \
  -X POST \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "first_name": "Alfred",
  "last_name": "Foster",
  "business_name": "Toy-O'Kon",
  "street_address": "600 Congress Avenue",
  "locality": "Austin",
  "country_code": "US"
}' \
  "https://api.telnyx.com/v2/user_addresses"
返回参数:
administrative_area
(字符串)、
borough
(字符串)、
business_name
(字符串)、
country_code
(字符串)、
created_at
(字符串)、
customer_reference
(字符串)、
extended_address
(字符串)、
first_name
(字符串)、
id
(UUID)、
last_name
(字符串)、
locality
(字符串)、
neighborhood
(字符串)、
phone_number
(字符串)、
postal_code
(字符串)、
record_type
(字符串)、
street_address
(字符串)、
updated_at
(字符串)

Retrieve a user address

查询用户地址详情

Retrieves the details of an existing user address.
GET /user_addresses/{id}
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/user_addresses/550e8400-e29b-41d4-a716-446655440000"
Returns:
administrative_area
(string),
borough
(string),
business_name
(string),
country_code
(string),
created_at
(string),
customer_reference
(string),
extended_address
(string),
first_name
(string),
id
(uuid),
last_name
(string),
locality
(string),
neighborhood
(string),
phone_number
(string),
postal_code
(string),
record_type
(string),
street_address
(string),
updated_at
(string)
获取现有用户地址的详细信息。
GET /user_addresses/{id}
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/user_addresses/550e8400-e29b-41d4-a716-446655440000"
返回参数:
administrative_area
(字符串)、
borough
(字符串)、
business_name
(字符串)、
country_code
(字符串)、
created_at
(字符串)、
customer_reference
(字符串)、
extended_address
(字符串)、
first_name
(字符串)、
id
(UUID)、
last_name
(字符串)、
locality
(字符串)、
neighborhood
(字符串)、
phone_number
(字符串)、
postal_code
(字符串)、
record_type
(字符串)、
street_address
(字符串)、
updated_at
(字符串)

List all Verified Numbers

查询所有已验证号码

Gets a paginated list of Verified Numbers.
GET /verified_numbers
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/verified_numbers"
Returns:
phone_number
(string),
record_type
(enum: verified_number),
verified_at
(string)
获取分页的已验证号码列表。
GET /verified_numbers
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/verified_numbers"
返回参数:
phone_number
(字符串)、
record_type
(枚举值:verified_number)、
verified_at
(字符串)

Request phone number verification

发起号码验证请求

Initiates phone number verification procedure. Supports DTMF extension dialing for voice calls to numbers behind IVR systems.
POST /verified_numbers
— Required:
phone_number
,
verification_method
Optional:
extension
(string)
bash
curl \
  -X POST \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "phone_number": "+15551234567",
  "verification_method": "sms"
}' \
  "https://api.telnyx.com/v2/verified_numbers"
Returns:
phone_number
(string),
verification_method
(string)
启动电话号码验证流程。支持DTMF分机拨号,可呼叫IVR系统后的号码。
POST /verified_numbers
— 必选参数:
phone_number
verification_method
可选参数:
extension
(字符串)
bash
curl \
  -X POST \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "phone_number": "+15551234567",
  "verification_method": "sms"
}' \
  "https://api.telnyx.com/v2/verified_numbers"
返回参数:
phone_number
(字符串)、
verification_method
(字符串)

Retrieve a verified number

查询已验证号码详情

GET /verified_numbers/{phone_number}
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/verified_numbers/+15551234567"
Returns:
phone_number
(string),
record_type
(enum: verified_number),
verified_at
(string)
GET /verified_numbers/{phone_number}
bash
curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/verified_numbers/+15551234567"
返回参数:
phone_number
(字符串)、
record_type
(枚举值:verified_number)、
verified_at
(字符串)

Delete a verified number

删除已验证号码

DELETE /verified_numbers/{phone_number}
bash
curl \
  -X DELETE \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  "https://api.telnyx.com/v2/verified_numbers/+15551234567"
Returns:
phone_number
(string),
record_type
(enum: verified_number),
verified_at
(string)
DELETE /verified_numbers/{phone_number}
bash
curl \
  -X DELETE \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  "https://api.telnyx.com/v2/verified_numbers/+15551234567"
返回参数:
phone_number
(字符串)、
record_type
(枚举值:verified_number)、
verified_at
(字符串)

Submit verification code

提交验证码

POST /verified_numbers/{phone_number}/actions/verify
— Required:
verification_code
bash
curl \
  -X POST \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "verification_code": "123456"
}' \
  "https://api.telnyx.com/v2/verified_numbers/+15551234567/actions/verify"
Returns:
phone_number
(string),
record_type
(enum: verified_number),
verified_at
(string)
POST /verified_numbers/{phone_number}/actions/verify
— 必选参数:
verification_code
bash
curl \
  -X POST \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "verification_code": "123456"
}' \
  "https://api.telnyx.com/v2/verified_numbers/+15551234567/actions/verify"
返回参数:
phone_number
(字符串)、
record_type
(枚举值:verified_number)、
verified_at
(字符串)