telnyx-numbers-compliance-javascript
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 - JavaScript
Telnyx 号码合规 - JavaScript
Installation
安装
bash
npm install telnyxbash
npm install telnyxSetup
初始化
javascript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});All examples below assume is already initialized as shown above.
clientjavascript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});以下所有示例均假设已按照上述方式完成初始化。
clientError 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:
javascript
try {
const result = await client.messages.send({ to: '+13125550001', from: '+13125550002', text: 'Hello' });
} catch (err) {
if (err instanceof Telnyx.APIConnectionError) {
console.error('Network error — check connectivity and retry');
} else if (err instanceof Telnyx.RateLimitError) {
// 429: rate limited — wait and retry with exponential backoff
const retryAfter = err.headers?.['retry-after'] || 1;
await new Promise(r => setTimeout(r, retryAfter * 1000));
} else if (err instanceof Telnyx.APIError) {
console.error(`API error ${err.status}: ${err.message}`);
if (err.status === 422) {
console.error('Validation error — check required fields and formats');
}
}
}Common error codes: invalid API key, insufficient permissions,
resource not found, validation error (check field formats),
rate limited (retry with exponential backoff).
401403404422429所有API调用都可能因网络错误、请求受限(429)、验证错误(422)或认证错误(401)而失败。生产环境代码中务必处理错误:
javascript
try {
const result = await client.messages.send({ to: '+13125550001', from: '+13125550002', text: 'Hello' });
} catch (err) {
if (err instanceof Telnyx.APIConnectionError) {
console.error('Network error — check connectivity and retry');
} else if (err instanceof Telnyx.RateLimitError) {
// 429: rate limited — wait and retry with exponential backoff
const retryAfter = err.headers?.['retry-after'] || 1;
await new Promise(r => setTimeout(r, retryAfter * 1000));
} else if (err instanceof Telnyx.APIError) {
console.error(`API error ${err.status}: ${err.message}`);
if (err.status === 422) {
console.error('Validation error — check required fields and formats');
}
}
}常见错误码: API密钥无效, 权限不足, 资源未找到, 验证错误(检查字段格式), 请求受限(使用指数退避策略重试)。
401403404422429Important Notes
重要注意事项
- Phone numbers must be in E.164 format (e.g., ). Include the
+13125550001prefix and country code. No spaces, dashes, or parentheses.+ - Pagination: List methods return an auto-paginating iterator. Use to iterate through all pages automatically.
for await (const item of result) { ... }
- 电话号码必须采用E.164格式(例如:)。需包含
+13125550001前缀和国家代码,不能有空格、短横线或括号。+ - 分页处理:列表类方法会返回自动分页的迭代器。使用可自动遍历所有页面。
for await (const item of result) { ... }
Retrieve Bundles
获取所有套餐
Get all allowed bundles.
GET /bundle_pricing/billing_bundlesjavascript
// Automatically fetches more pages as needed.
for await (const billingBundleSummary of client.bundlePricing.billingBundles.list()) {
console.log(billingBundleSummary.id);
}Returns: (string), (date), (string), (uuid), (boolean), (float), (string), (string), (array[string])
cost_codecreated_atcurrencyidis_publicmrc_pricenameslugspecs获取所有可用套餐。
GET /bundle_pricing/billing_bundlesjavascript
// Automatically fetches more pages as needed.
for await (const billingBundleSummary of client.bundlePricing.billingBundles.list()) {
console.log(billingBundleSummary.id);
}返回字段:(字符串)、(日期)、(字符串)、(UUID)、(布尔值)、(浮点数)、(字符串)、(字符串)、(字符串数组)
cost_codecreated_atcurrencyidis_publicmrc_pricenameslugspecsGet Bundle By Id
通过ID获取套餐
Get a single bundle by ID.
GET /bundle_pricing/billing_bundles/{bundle_id}javascript
const billingBundle = await client.bundlePricing.billingBundles.retrieve(
'8661948c-a386-4385-837f-af00f40f111a',
);
console.log(billingBundle.data);Returns: (boolean), (array[object]), (string), (date), (uuid), (boolean), (string), (string)
activebundle_limitscost_codecreated_atidis_publicnameslug通过ID获取单个套餐详情。
GET /bundle_pricing/billing_bundles/{bundle_id}javascript
const billingBundle = await client.bundlePricing.billingBundles.retrieve(
'8661948c-a386-4385-837f-af00f40f111a',
);
console.log(billingBundle.data);返回字段:(布尔值)、(对象数组)、(字符串)、(日期)、(UUID)、(布尔值)、(字符串)、(字符串)
activebundle_limitscost_codecreated_atidis_publicnameslugGet User Bundles
获取用户套餐
Get a paginated list of user bundles.
GET /bundle_pricing/user_bundlesjavascript
// Automatically fetches more pages as needed.
for await (const userBundle of client.bundlePricing.userBundles.list()) {
console.log(userBundle.id);
}Returns: (boolean), (object), (date), (uuid), (array[object]), (date), (uuid)
activebilling_bundlecreated_atidresourcesupdated_atuser_id获取用户套餐的分页列表。
GET /bundle_pricing/user_bundlesjavascript
// Automatically fetches more pages as needed.
for await (const userBundle of client.bundlePricing.userBundles.list()) {
console.log(userBundle.id);
}返回字段:(布尔值)、(对象)、(日期)、(UUID)、(对象数组)、(日期)、(UUID)
activebilling_bundlecreated_atidresourcesupdated_atuser_idCreate User Bundles
创建用户套餐
Creates multiple user bundles for the user.
POST /bundle_pricing/user_bundles/bulkOptional: (uuid), (array[object])
idempotency_keyitemsjavascript
const userBundle = await client.bundlePricing.userBundles.create();
console.log(userBundle.data);Returns: (boolean), (object), (date), (uuid), (array[object]), (date), (uuid)
activebilling_bundlecreated_atidresourcesupdated_atuser_id为用户批量创建多个用户套餐。
POST /bundle_pricing/user_bundles/bulk可选参数:(UUID)、(对象数组)
idempotency_keyitemsjavascript
const userBundle = await client.bundlePricing.userBundles.create();
console.log(userBundle.data);返回字段:(布尔值)、(对象)、(日期)、(UUID)、(对象数组)、(日期)、(UUID)
activebilling_bundlecreated_atidresourcesupdated_atuser_idGet Unused User Bundles
获取未使用的用户套餐
Returns all user bundles that aren't in use.
GET /bundle_pricing/user_bundles/unusedjavascript
const response = await client.bundlePricing.userBundles.listUnused();
console.log(response.data);Returns: (object), (array[string])
billing_bundleuser_bundle_ids返回所有未被使用的用户套餐。
GET /bundle_pricing/user_bundles/unusedjavascript
const response = await client.bundlePricing.userBundles.listUnused();
console.log(response.data);返回字段:(对象)、(字符串数组)
billing_bundleuser_bundle_idsGet User Bundle by Id
通过ID获取用户套餐
Retrieves a user bundle by its ID.
GET /bundle_pricing/user_bundles/{user_bundle_id}javascript
const userBundle = await client.bundlePricing.userBundles.retrieve(
'ca1d2263-d1f1-43ac-ba53-248e7a4bb26a',
);
console.log(userBundle.data);Returns: (boolean), (object), (date), (uuid), (array[object]), (date), (uuid)
activebilling_bundlecreated_atidresourcesupdated_atuser_id通过ID获取用户套餐详情。
GET /bundle_pricing/user_bundles/{user_bundle_id}javascript
const userBundle = await client.bundlePricing.userBundles.retrieve(
'ca1d2263-d1f1-43ac-ba53-248e7a4bb26a',
);
console.log(userBundle.data);返回字段:(布尔值)、(对象)、(日期)、(UUID)、(对象数组)、(日期)、(UUID)
activebilling_bundlecreated_atidresourcesupdated_atuser_idDeactivate User Bundle
停用用户套餐
Deactivates a user bundle by its ID.
DELETE /bundle_pricing/user_bundles/{user_bundle_id}javascript
const response = await client.bundlePricing.userBundles.deactivate(
'ca1d2263-d1f1-43ac-ba53-248e7a4bb26a',
);
console.log(response.data);Returns: (boolean), (object), (date), (uuid), (array[object]), (date), (uuid)
activebilling_bundlecreated_atidresourcesupdated_atuser_id通过ID停用用户套餐。
DELETE /bundle_pricing/user_bundles/{user_bundle_id}javascript
const response = await client.bundlePricing.userBundles.deactivate(
'ca1d2263-d1f1-43ac-ba53-248e7a4bb26a',
);
console.log(response.data);返回字段:(布尔值)、(对象)、(日期)、(UUID)、(对象数组)、(日期)、(UUID)
activebilling_bundlecreated_atidresourcesupdated_atuser_idGet User Bundle Resources
获取用户套餐资源
Retrieves the resources of a user bundle by its ID.
GET /bundle_pricing/user_bundles/{user_bundle_id}/resourcesjavascript
const response = await client.bundlePricing.userBundles.listResources(
'ca1d2263-d1f1-43ac-ba53-248e7a4bb26a',
);
console.log(response.data);Returns: (date), (uuid), (string), (string), (date)
created_atidresourceresource_typeupdated_at通过ID获取用户套餐的资源详情。
GET /bundle_pricing/user_bundles/{user_bundle_id}/resourcesjavascript
const response = await client.bundlePricing.userBundles.listResources(
'ca1d2263-d1f1-43ac-ba53-248e7a4bb26a',
);
console.log(response.data);返回字段:(日期)、(UUID)、(字符串)、(字符串)、(日期)
created_atidresourceresource_typeupdated_atList all document links
列出所有文档链接
List all documents links ordered by created_at descending.
GET /document_linksjavascript
// Automatically fetches more pages as needed.
for await (const documentLinkListResponse of client.documentLinks.list()) {
console.log(documentLinkListResponse.id);
}Returns: (string), (uuid), (uuid), (string), (string), (string), (string)
created_atdocument_ididlinked_record_typelinked_resource_idrecord_typeupdated_at按创建时间降序列出所有文档链接。
GET /document_linksjavascript
// Automatically fetches more pages as needed.
for await (const documentLinkListResponse of client.documentLinks.list()) {
console.log(documentLinkListResponse.id);
}返回字段:(字符串)、(UUID)、(UUID)、(字符串)、(字符串)、(字符串)、(字符串)
created_atdocument_ididlinked_record_typelinked_resource_idrecord_typeupdated_atList all documents
列出所有文档
List all documents ordered by created_at descending.
GET /documentsjavascript
// Automatically fetches more pages as needed.
for await (const docServiceDocument of client.documents.list()) {
console.log(docServiceDocument.id);
}Returns: (enum: scanned, infected, pending_scan, not_scanned), (string), (string), (string), (string), (uuid), (string), (string), (object), (enum: pending, verified, denied), (string)
av_scan_statuscontent_typecreated_atcustomer_referencefilenameidrecord_typesha256sizestatusupdated_at按创建时间降序列出所有文档。
GET /documentsjavascript
// Automatically fetches more pages as needed.
for await (const docServiceDocument of client.documents.list()) {
console.log(docServiceDocument.id);
}返回字段:(枚举值:scanned, infected, pending_scan, not_scanned)、(字符串)、(字符串)、(字符串)、(字符串)、(UUID)、(字符串)、(字符串)、(对象)、(枚举值:pending, verified, denied)、(字符串)
av_scan_statuscontent_typecreated_atcustomer_referencefilenameidrecord_typesha256sizestatusupdated_atUpload a document
上传文档
Upload a document. Uploaded files must be linked to a service within 30 minutes or they will be automatically deleted.
POST /documentsOptional: (string), (byte), (string), (string)
customer_referencefilefilenameurljavascript
const response = await client.documents.uploadJson({ document: {} });
console.log(response.data);Returns: (enum: scanned, infected, pending_scan, not_scanned), (string), (string), (string), (string), (uuid), (string), (string), (object), (enum: pending, verified, denied), (string)
av_scan_statuscontent_typecreated_atcustomer_referencefilenameidrecord_typesha256sizestatusupdated_at上传文档。上传的文件必须在30分钟内关联到服务,否则将被自动删除。
POST /documents可选参数:(字符串)、(字节)、(字符串)、(字符串)
customer_referencefilefilenameurljavascript
const response = await client.documents.uploadJson({ document: {} });
console.log(response.data);返回字段:(枚举值:scanned, infected, pending_scan, not_scanned)、(字符串)、(字符串)、(字符串)、(字符串)、(UUID)、(字符串)、(字符串)、(对象)、(枚举值:pending, verified, denied)、(字符串)
av_scan_statuscontent_typecreated_atcustomer_referencefilenameidrecord_typesha256sizestatusupdated_atRetrieve a document
获取文档详情
Retrieve a document.
GET /documents/{id}javascript
const document = await client.documents.retrieve('6a09cdc3-8948-47f0-aa62-74ac943d6c58');
console.log(document.data);Returns: (enum: scanned, infected, pending_scan, not_scanned), (string), (string), (string), (string), (uuid), (string), (string), (object), (enum: pending, verified, denied), (string)
av_scan_statuscontent_typecreated_atcustomer_referencefilenameidrecord_typesha256sizestatusupdated_at获取指定文档的详情。
GET /documents/{id}javascript
const document = await client.documents.retrieve('6a09cdc3-8948-47f0-aa62-74ac943d6c58');
console.log(document.data);返回字段:(枚举值:scanned, infected, pending_scan, not_scanned)、(字符串)、(字符串)、(字符串)、(字符串)、(UUID)、(字符串)、(字符串)、(对象)、(枚举值:pending, verified, denied)、(字符串)
av_scan_statuscontent_typecreated_atcustomer_referencefilenameidrecord_typesha256sizestatusupdated_atUpdate a document
更新文档
Update a document.
PATCH /documents/{id}Optional: (enum: scanned, infected, pending_scan, not_scanned), (string), (string), (string), (string), (uuid), (string), (string), (object), (enum: pending, verified, denied), (string)
av_scan_statuscontent_typecreated_atcustomer_referencefilenameidrecord_typesha256sizestatusupdated_atjavascript
const document = await client.documents.update('6a09cdc3-8948-47f0-aa62-74ac943d6c58');
console.log(document.data);Returns: (enum: scanned, infected, pending_scan, not_scanned), (string), (string), (string), (string), (uuid), (string), (string), (object), (enum: pending, verified, denied), (string)
av_scan_statuscontent_typecreated_atcustomer_referencefilenameidrecord_typesha256sizestatusupdated_at更新指定文档的信息。
PATCH /documents/{id}可选参数:(枚举值:scanned, infected, pending_scan, not_scanned)、(字符串)、(字符串)、(字符串)、(字符串)、(UUID)、(字符串)、(字符串)、(对象)、(枚举值:pending, verified, denied)、(字符串)
av_scan_statuscontent_typecreated_atcustomer_referencefilenameidrecord_typesha256sizestatusupdated_atjavascript
const document = await client.documents.update('6a09cdc3-8948-47f0-aa62-74ac943d6c58');
console.log(document.data);返回字段:(枚举值:scanned, infected, pending_scan, not_scanned)、(字符串)、(字符串)、(字符串)、(字符串)、(UUID)、(字符串)、(字符串)、(对象)、(枚举值:pending, verified, denied)、(字符串)
av_scan_statuscontent_typecreated_atcustomer_referencefilenameidrecord_typesha256sizestatusupdated_atDelete 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}javascript
const document = await client.documents.delete('6a09cdc3-8948-47f0-aa62-74ac943d6c58');
console.log(document.data);Returns: (enum: scanned, infected, pending_scan, not_scanned), (string), (string), (string), (string), (uuid), (string), (string), (object), (enum: pending, verified, denied), (string)
av_scan_statuscontent_typecreated_atcustomer_referencefilenameidrecord_typesha256sizestatusupdated_at删除指定文档。只有未关联到服务的文档才能被删除,如果已关联服务,必须先解除关联再删除。
DELETE /documents/{id}javascript
const document = await client.documents.delete('6a09cdc3-8948-47f0-aa62-74ac943d6c58');
console.log(document.data);返回字段:(枚举值:scanned, infected, pending_scan, not_scanned)、(字符串)、(字符串)、(字符串)、(字符串)、(UUID)、(字符串)、(字符串)、(对象)、(枚举值:pending, verified, denied)、(字符串)
av_scan_statuscontent_typecreated_atcustomer_referencefilenameidrecord_typesha256sizestatusupdated_atDownload a document
下载文档
Download a document.
GET /documents/{id}/downloadjavascript
const response = await client.documents.download('6a09cdc3-8948-47f0-aa62-74ac943d6c58');
console.log(response);
const content = await response.blob();
console.log(content);下载指定文档。
GET /documents/{id}/downloadjavascript
const response = await client.documents.download('6a09cdc3-8948-47f0-aa62-74ac943d6c58');
console.log(response);
const content = await response.blob();
console.log(content);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_linkjavascript
const response = await client.documents.generateDownloadLink(
'550e8400-e29b-41d4-a716-446655440000',
);
console.log(response.data);Returns: (uri)
url生成一个临时预签名URL,无需认证即可直接从存储后端下载文档。
GET /documents/{id}/download_linkjavascript
const response = await client.documents.generateDownloadLink(
'550e8400-e29b-41d4-a716-446655440000',
);
console.log(response.data);返回字段:(URI)
urlUpdate requirement group for a phone number order
更新电话号码订单的需求组
POST /number_order_phone_numbers/{id}/requirement_grouprequirement_group_idjavascript
const response = await client.numberOrderPhoneNumbers.updateRequirementGroup(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
{ requirement_group_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' },
);
console.log(response.data);Returns: (uuid), (string), (date-time), (uuid), (boolean), (string), (uuid), (string), (string), (string), (array[object]), (boolean), (string), (string), (uuid)
bundle_idcountry_codedeadlineidis_block_numberlocalityorder_request_idphone_numberphone_number_typerecord_typeregulatory_requirementsrequirements_metrequirements_statusstatussub_number_order_idPOST /number_order_phone_numbers/{id}/requirement_grouprequirement_group_idjavascript
const response = await client.numberOrderPhoneNumbers.updateRequirementGroup(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
{ requirement_group_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' },
);
console.log(response.data);返回字段:(UUID)、(字符串)、(日期时间)、(UUID)、(布尔值)、(字符串)、(UUID)、(字符串)、(字符串)、(字符串)、(对象数组)、(布尔值)、(字符串)、(字符串)、(UUID)
bundle_idcountry_codedeadlineidis_block_numberlocalityorder_request_idphone_numberphone_number_typerecord_typeregulatory_requirementsrequirements_metrequirements_statusstatussub_number_order_idRetrieve regulatory requirements for a list of phone numbers
获取电话号码列表的监管要求
GET /phone_numbers_regulatory_requirementsjavascript
const phoneNumbersRegulatoryRequirement =
await client.phoneNumbersRegulatoryRequirements.retrieve();
console.log(phoneNumbersRegulatoryRequirement.data);Returns: (string), (string), (string), (array[object]), (array[object])
phone_numberphone_number_typerecord_typeregion_informationregulatory_requirementsGET /phone_numbers_regulatory_requirementsjavascript
const phoneNumbersRegulatoryRequirement =
await client.phoneNumbersRegulatoryRequirements.retrieve();
console.log(phoneNumbersRegulatoryRequirement.data);返回字段:(字符串)、(字符串)、(字符串)、(对象数组)、(对象数组)
phone_numberphone_number_typerecord_typeregion_informationregulatory_requirementsRetrieve regulatory requirements
获取监管要求
GET /regulatory_requirementsjavascript
const regulatoryRequirement = await client.regulatoryRequirements.retrieve();
console.log(regulatoryRequirement.data);Returns: (string), (string), (string), (array[object])
actioncountry_codephone_number_typeregulatory_requirementsGET /regulatory_requirementsjavascript
const regulatoryRequirement = await client.regulatoryRequirements.retrieve();
console.log(regulatoryRequirement.data);返回字段:(字符串)、(字符串)、(字符串)、(对象数组)
actioncountry_codephone_number_typeregulatory_requirementsList requirement groups
列出需求组
GET /requirement_groupsjavascript
const requirementGroups = await client.requirementGroups.list();
console.log(requirementGroups);GET /requirement_groupsjavascript
const requirementGroups = await client.requirementGroups.list();
console.log(requirementGroups);Create a new requirement group
创建新需求组
POST /requirement_groupscountry_codephone_number_typeactionOptional: (string), (array[object])
customer_referenceregulatory_requirementsjavascript
const requirementGroup = await client.requirementGroups.create({
action: 'ordering',
country_code: 'US',
phone_number_type: 'local',
});
console.log(requirementGroup.id);Returns: (string), (string), (date-time), (string), (string), (string), (string), (array[object]), (enum: approved, unapproved, pending-approval, declined, expired), (date-time)
actioncountry_codecreated_atcustomer_referenceidphone_number_typerecord_typeregulatory_requirementsstatusupdated_atPOST /requirement_groupscountry_codephone_number_typeaction可选参数:(字符串)、(对象数组)
customer_referenceregulatory_requirementsjavascript
const requirementGroup = await client.requirementGroups.create({
action: 'ordering',
country_code: 'US',
phone_number_type: 'local',
});
console.log(requirementGroup.id);返回字段:(字符串)、(字符串)、(日期时间)、(字符串)、(字符串)、(字符串)、(字符串)、(对象数组)、(枚举值:approved, unapproved, pending-approval, declined, expired)、(日期时间)
actioncountry_codecreated_atcustomer_referenceidphone_number_typerecord_typeregulatory_requirementsstatusupdated_atGet a single requirement group by ID
通过ID获取单个需求组
GET /requirement_groups/{id}javascript
const requirementGroup = await client.requirementGroups.retrieve('550e8400-e29b-41d4-a716-446655440000');
console.log(requirementGroup.id);Returns: (string), (string), (date-time), (string), (string), (string), (string), (array[object]), (enum: approved, unapproved, pending-approval, declined, expired), (date-time)
actioncountry_codecreated_atcustomer_referenceidphone_number_typerecord_typeregulatory_requirementsstatusupdated_atGET /requirement_groups/{id}javascript
const requirementGroup = await client.requirementGroups.retrieve('550e8400-e29b-41d4-a716-446655440000');
console.log(requirementGroup.id);返回字段:(字符串)、(字符串)、(日期时间)、(字符串)、(字符串)、(字符串)、(字符串)、(对象数组)、(枚举值:approved, unapproved, pending-approval, declined, expired)、(日期时间)
actioncountry_codecreated_atcustomer_referenceidphone_number_typerecord_typeregulatory_requirementsstatusupdated_atUpdate requirement values in requirement group
更新需求组中的需求值
PATCH /requirement_groups/{id}Optional: (string), (array[object])
customer_referenceregulatory_requirementsjavascript
const requirementGroup = await client.requirementGroups.update('550e8400-e29b-41d4-a716-446655440000');
console.log(requirementGroup.id);Returns: (string), (string), (date-time), (string), (string), (string), (string), (array[object]), (enum: approved, unapproved, pending-approval, declined, expired), (date-time)
actioncountry_codecreated_atcustomer_referenceidphone_number_typerecord_typeregulatory_requirementsstatusupdated_atPATCH /requirement_groups/{id}可选参数:(字符串)、(对象数组)
customer_referenceregulatory_requirementsjavascript
const requirementGroup = await client.requirementGroups.update('550e8400-e29b-41d4-a716-446655440000');
console.log(requirementGroup.id);返回字段:(字符串)、(字符串)、(日期时间)、(字符串)、(字符串)、(字符串)、(字符串)、(对象数组)、(枚举值:approved, unapproved, pending-approval, declined, expired)、(日期时间)
actioncountry_codecreated_atcustomer_referenceidphone_number_typerecord_typeregulatory_requirementsstatusupdated_atDelete a requirement group by ID
通过ID删除需求组
DELETE /requirement_groups/{id}javascript
const requirementGroup = await client.requirementGroups.delete('550e8400-e29b-41d4-a716-446655440000');
console.log(requirementGroup.id);Returns: (string), (string), (date-time), (string), (string), (string), (string), (array[object]), (enum: approved, unapproved, pending-approval, declined, expired), (date-time)
actioncountry_codecreated_atcustomer_referenceidphone_number_typerecord_typeregulatory_requirementsstatusupdated_atDELETE /requirement_groups/{id}javascript
const requirementGroup = await client.requirementGroups.delete('550e8400-e29b-41d4-a716-446655440000');
console.log(requirementGroup.id);返回字段:(字符串)、(字符串)、(日期时间)、(字符串)、(字符串)、(字符串)、(字符串)、(对象数组)、(枚举值:approved, unapproved, pending-approval, declined, expired)、(日期时间)
actioncountry_codecreated_atcustomer_referenceidphone_number_typerecord_typeregulatory_requirementsstatusupdated_atSubmit a Requirement Group for Approval
提交需求组审核
POST /requirement_groups/{id}/submit_for_approvaljavascript
const requirementGroup = await client.requirementGroups.submitForApproval('550e8400-e29b-41d4-a716-446655440000');
console.log(requirementGroup.id);Returns: (string), (string), (date-time), (string), (string), (string), (string), (array[object]), (enum: approved, unapproved, pending-approval, declined, expired), (date-time)
actioncountry_codecreated_atcustomer_referenceidphone_number_typerecord_typeregulatory_requirementsstatusupdated_atPOST /requirement_groups/{id}/submit_for_approvaljavascript
const requirementGroup = await client.requirementGroups.submitForApproval('550e8400-e29b-41d4-a716-446655440000');
console.log(requirementGroup.id);返回字段:(字符串)、(字符串)、(日期时间)、(字符串)、(字符串)、(字符串)、(字符串)、(对象数组)、(枚举值:approved, unapproved, pending-approval, declined, expired)、(日期时间)
actioncountry_codecreated_atcustomer_referenceidphone_number_typerecord_typeregulatory_requirementsstatusupdated_atList all requirement types
列出所有需求类型
List all requirement types ordered by created_at descending
GET /requirement_typesjavascript
const requirementTypes = await client.requirementTypes.list();
console.log(requirementTypes.data);Returns: (object), (string), (string), (string), (uuid), (string), (string), (enum: document, address, textual), (string)
acceptance_criteriacreated_atdescriptionexampleidnamerecord_typetypeupdated_at按创建时间降序列出所有需求类型
GET /requirement_typesjavascript
const requirementTypes = await client.requirementTypes.list();
console.log(requirementTypes.data);返回字段:(对象)、(字符串)、(字符串)、(字符串)、(UUID)、(字符串)、(字符串)、(枚举值:document, address, textual)、(字符串)
acceptance_criteriacreated_atdescriptionexampleidnamerecord_typetypeupdated_atRetrieve a requirement types
获取需求类型详情
Retrieve a requirement type by id
GET /requirement_types/{id}javascript
const requirementType = await client.requirementTypes.retrieve(
'a38c217a-8019-48f8-bff6-0fdd9939075b',
);
console.log(requirementType.data);Returns: (object), (string), (string), (string), (uuid), (string), (string), (enum: document, address, textual), (string)
acceptance_criteriacreated_atdescriptionexampleidnamerecord_typetypeupdated_at通过ID获取需求类型详情
GET /requirement_types/{id}javascript
const requirementType = await client.requirementTypes.retrieve(
'a38c217a-8019-48f8-bff6-0fdd9939075b',
);
console.log(requirementType.data);返回字段:(对象)、(字符串)、(字符串)、(字符串)、(UUID)、(字符串)、(字符串)、(枚举值:document, address, textual)、(字符串)
acceptance_criteriacreated_atdescriptionexampleidnamerecord_typetypeupdated_atList all requirements
列出所有需求
List all requirements with filtering, sorting, and pagination
GET /requirementsjavascript
// Automatically fetches more pages as needed.
for await (const requirementListResponse of client.requirements.list()) {
console.log(requirementListResponse.id);
}Returns: (enum: both, branded_calling, ordering, porting), (string), (string), (uuid), (string), (enum: local, national, toll_free), (string), (array[object]), (string)
actioncountry_codecreated_atidlocalityphone_number_typerecord_typerequirements_typesupdated_at通过筛选、排序和分页列出所有需求
GET /requirementsjavascript
// Automatically fetches more pages as needed.
for await (const requirementListResponse of client.requirements.list()) {
console.log(requirementListResponse.id);
}返回字段:(枚举值:both, branded_calling, ordering, porting)、(字符串)、(字符串)、(UUID)、(字符串)、(枚举值:local, national, toll_free)、(字符串)、(对象数组)、(字符串)
actioncountry_codecreated_atidlocalityphone_number_typerecord_typerequirements_typesupdated_atRetrieve a document requirement
获取文档需求详情
Retrieve a document requirement record
GET /requirements/{id}javascript
const requirement = await client.requirements.retrieve('a9dad8d5-fdbd-49d7-aa23-39bb08a5ebaa');
console.log(requirement.data);Returns: (enum: both, branded_calling, ordering, porting), (string), (string), (uuid), (string), (enum: local, national, toll_free), (string), (array[object]), (string)
actioncountry_codecreated_atidlocalityphone_number_typerecord_typerequirements_typesupdated_at获取文档需求记录详情
GET /requirements/{id}javascript
const requirement = await client.requirements.retrieve('a9dad8d5-fdbd-49d7-aa23-39bb08a5ebaa');
console.log(requirement.data);返回字段:(枚举值:both, branded_calling, ordering, porting)、(字符串)、(字符串)、(UUID)、(字符串)、(枚举值:local, national, toll_free)、(字符串)、(对象数组)、(字符串)
actioncountry_codecreated_atidlocalityphone_number_typerecord_typerequirements_typesupdated_atUpdate requirement group for a sub number order
更新子号码订单的需求组
POST /sub_number_orders/{id}/requirement_grouprequirement_group_idjavascript
const response = await client.subNumberOrders.updateRequirementGroup(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
{ requirement_group_id: 'a4b201f9-8646-4e54-a7d2-b2e403eeaf8c' },
);
console.log(response.data);Returns: (string), (date-time), (string), (uuid), (boolean), (uuid), (string), (array[object]), (integer), (string), (array[object]), (boolean), (string), (date-time)
country_codecreated_atcustomer_referenceidis_block_sub_number_orderorder_request_idphone_number_typephone_numbersphone_numbers_countrecord_typeregulatory_requirementsrequirements_metstatusupdated_atPOST /sub_number_orders/{id}/requirement_grouprequirement_group_idjavascript
const response = await client.subNumberOrders.updateRequirementGroup(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
{ requirement_group_id: 'a4b201f9-8646-4e54-a7d2-b2e403eeaf8c' },
);
console.log(response.data);返回字段:(字符串)、(日期时间)、(字符串)、(UUID)、(布尔值)、(UUID)、(字符串)、(对象数组)、(整数)、(字符串)、(对象数组)、(布尔值)、(字符串)、(日期时间)
country_codecreated_atcustomer_referenceidis_block_sub_number_orderorder_request_idphone_number_typephone_numbersphone_numbers_countrecord_typeregulatory_requirementsrequirements_metstatusupdated_atList all user addresses
列出所有用户地址
Returns a list of your user addresses.
GET /user_addressesjavascript
// Automatically fetches more pages as needed.
for await (const userAddress of client.userAddresses.list()) {
console.log(userAddress.id);
}Returns: (string), (string), (string), (string), (string), (string), (string), (string), (uuid), (string), (string), (string), (string), (string), (string), (string), (string)
administrative_areaboroughbusiness_namecountry_codecreated_atcustomer_referenceextended_addressfirst_nameidlast_namelocalityneighborhoodphone_numberpostal_coderecord_typestreet_addressupdated_at返回用户地址列表。
GET /user_addressesjavascript
// Automatically fetches more pages as needed.
for await (const userAddress of client.userAddresses.list()) {
console.log(userAddress.id);
}返回字段:(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(UUID)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)
administrative_areaboroughbusiness_namecountry_codecreated_atcustomer_referenceextended_addressfirst_nameidlast_namelocalityneighborhoodphone_numberpostal_coderecord_typestreet_addressupdated_atCreates a user address
创建用户地址
Creates a user address.
POST /user_addressesfirst_namelast_namebusiness_namestreet_addresslocalitycountry_codeOptional: (string), (string), (string), (string), (string), (string), (string), (boolean)
administrative_areaboroughcustomer_referenceextended_addressneighborhoodphone_numberpostal_codeskip_address_verificationjavascript
const userAddress = await client.userAddresses.create({
business_name: "Toy-O'Kon",
country_code: 'US',
first_name: 'Alfred',
last_name: 'Foster',
locality: 'Austin',
street_address: '600 Congress Avenue',
});
console.log(userAddress.data);Returns: (string), (string), (string), (string), (string), (string), (string), (string), (uuid), (string), (string), (string), (string), (string), (string), (string), (string)
administrative_areaboroughbusiness_namecountry_codecreated_atcustomer_referenceextended_addressfirst_nameidlast_namelocalityneighborhoodphone_numberpostal_coderecord_typestreet_addressupdated_at创建用户地址。
POST /user_addressesfirst_namelast_namebusiness_namestreet_addresslocalitycountry_code可选参数:(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(布尔值)
administrative_areaboroughcustomer_referenceextended_addressneighborhoodphone_numberpostal_codeskip_address_verificationjavascript
const userAddress = await client.userAddresses.create({
business_name: "Toy-O'Kon",
country_code: 'US',
first_name: 'Alfred',
last_name: 'Foster',
locality: 'Austin',
street_address: '600 Congress Avenue',
});
console.log(userAddress.data);返回字段:(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(UUID)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)
administrative_areaboroughbusiness_namecountry_codecreated_atcustomer_referenceextended_addressfirst_nameidlast_namelocalityneighborhoodphone_numberpostal_coderecord_typestreet_addressupdated_atRetrieve a user address
获取用户地址详情
Retrieves the details of an existing user address.
GET /user_addresses/{id}javascript
const userAddress = await client.userAddresses.retrieve('550e8400-e29b-41d4-a716-446655440000');
console.log(userAddress.data);Returns: (string), (string), (string), (string), (string), (string), (string), (string), (uuid), (string), (string), (string), (string), (string), (string), (string), (string)
administrative_areaboroughbusiness_namecountry_codecreated_atcustomer_referenceextended_addressfirst_nameidlast_namelocalityneighborhoodphone_numberpostal_coderecord_typestreet_addressupdated_at获取已有用户地址的详情。
GET /user_addresses/{id}javascript
const userAddress = await client.userAddresses.retrieve('550e8400-e29b-41d4-a716-446655440000');
console.log(userAddress.data);返回字段:(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(UUID)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)
administrative_areaboroughbusiness_namecountry_codecreated_atcustomer_referenceextended_addressfirst_nameidlast_namelocalityneighborhoodphone_numberpostal_coderecord_typestreet_addressupdated_atList all Verified Numbers
列出所有已验证号码
Gets a paginated list of Verified Numbers.
GET /verified_numbersjavascript
// Automatically fetches more pages as needed.
for await (const verifiedNumber of client.verifiedNumbers.list()) {
console.log(verifiedNumber.phone_number);
}Returns: (string), (enum: verified_number), (string)
phone_numberrecord_typeverified_at获取已验证号码的分页列表。
GET /verified_numbersjavascript
// Automatically fetches more pages as needed.
for await (const verifiedNumber of client.verifiedNumbers.list()) {
console.log(verifiedNumber.phone_number);
}返回字段:(字符串)、(枚举值:verified_number)、(字符串)
phone_numberrecord_typeverified_atRequest phone number verification
请求电话号码验证
Initiates phone number verification procedure. Supports DTMF extension dialing for voice calls to numbers behind IVR systems.
POST /verified_numbersphone_numberverification_methodOptional: (string)
extensionjavascript
const verifiedNumber = await client.verifiedNumbers.create({
phone_number: '+15551234567',
verification_method: 'sms',
});
console.log(verifiedNumber.phone_number);Returns: (string), (string)
phone_numberverification_method启动电话号码验证流程。支持通过DTMF分机拨号向IVR系统后的号码发起语音呼叫验证。
POST /verified_numbersphone_numberverification_method可选参数:(字符串)
extensionjavascript
const verifiedNumber = await client.verifiedNumbers.create({
phone_number: '+15551234567',
verification_method: 'sms',
});
console.log(verifiedNumber.phone_number);返回字段:(字符串)、(字符串)
phone_numberverification_methodRetrieve a verified number
获取已验证号码详情
GET /verified_numbers/{phone_number}javascript
const verifiedNumberDataWrapper = await client.verifiedNumbers.retrieve('+15551234567');
console.log(verifiedNumberDataWrapper.data);Returns: (string), (enum: verified_number), (string)
phone_numberrecord_typeverified_atGET /verified_numbers/{phone_number}javascript
const verifiedNumberDataWrapper = await client.verifiedNumbers.retrieve('+15551234567');
console.log(verifiedNumberDataWrapper.data);返回字段:(字符串)、(枚举值:verified_number)、(字符串)
phone_numberrecord_typeverified_atDelete a verified number
删除已验证号码
DELETE /verified_numbers/{phone_number}javascript
const verifiedNumberDataWrapper = await client.verifiedNumbers.delete('+15551234567');
console.log(verifiedNumberDataWrapper.data);Returns: (string), (enum: verified_number), (string)
phone_numberrecord_typeverified_atDELETE /verified_numbers/{phone_number}javascript
const verifiedNumberDataWrapper = await client.verifiedNumbers.delete('+15551234567');
console.log(verifiedNumberDataWrapper.data);返回字段:(字符串)、(枚举值:verified_number)、(字符串)
phone_numberrecord_typeverified_atSubmit verification code
提交验证码
POST /verified_numbers/{phone_number}/actions/verifyverification_codejavascript
const verifiedNumberDataWrapper = await client.verifiedNumbers.actions.submitVerificationCode(
'+15551234567',
{ verification_code: '123456' },
);
console.log(verifiedNumberDataWrapper.data);Returns: (string), (enum: verified_number), (string)
phone_numberrecord_typeverified_atPOST /verified_numbers/{phone_number}/actions/verifyverification_codejavascript
const verifiedNumberDataWrapper = await client.verifiedNumbers.actions.submitVerificationCode(
'+15551234567',
{ verification_code: '123456' },
);
console.log(verifiedNumberDataWrapper.data);返回字段:(字符串)、(枚举值:verified_number)、(字符串)
phone_numberrecord_typeverified_at