telnyx-account-access-javascript
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese<!-- Auto-generated from Telnyx OpenAPI specs. Do not edit. -->
<!-- 自动生成自Telnyx OpenAPI规范,请勿编辑。 -->
Telnyx Account Access - 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
重要说明
- Pagination: List methods return an auto-paginating iterator. Use to iterate through all pages automatically.
for await (const item of result) { ... }
- 分页: 列表类方法返回一个支持自动分页的迭代器,使用即可自动遍历所有分页内容。
for await (const item of result) { ... }
List all Access IP Addresses
查询所有访问IP地址
GET /access_ip_addressjavascript
// Automatically fetches more pages as needed.
for await (const accessIPAddressResponse of client.accessIPAddress.list()) {
console.log(accessIPAddressResponse.id);
}Returns: (date-time), (string), (string), (string), (string), (enum: pending, added), (date-time), (string)
created_atdescriptionidip_addresssourcestatusupdated_atuser_idGET /access_ip_addressjavascript
// Automatically fetches more pages as needed.
for await (const accessIPAddressResponse of client.accessIPAddress.list()) {
console.log(accessIPAddressResponse.id);
}返回参数:(日期时间)、(字符串)、(字符串)、(字符串)、(字符串)、(枚举值:pending 待处理、added 已添加)、(日期时间)、(字符串)
created_atdescriptionidip_addresssourcestatusupdated_atuser_idCreate new Access IP Address
新建访问IP地址
POST /access_ip_addressip_addressOptional: (string)
descriptionjavascript
const accessIPAddressResponse = await client.accessIPAddress.create({ ip_address: 'ip_address' });
console.log(accessIPAddressResponse.id);Returns: (date-time), (string), (string), (string), (string), (enum: pending, added), (date-time), (string)
created_atdescriptionidip_addresssourcestatusupdated_atuser_idPOST /access_ip_addressip_address可选参数:(字符串)
descriptionjavascript
const accessIPAddressResponse = await client.accessIPAddress.create({ ip_address: 'ip_address' });
console.log(accessIPAddressResponse.id);返回参数:(日期时间)、(字符串)、(字符串)、(字符串)、(字符串)、(枚举值:pending 待处理、added 已添加)、(日期时间)、(字符串)
created_atdescriptionidip_addresssourcestatusupdated_atuser_idRetrieve an access IP address
查询单个访问IP地址
GET /access_ip_address/{access_ip_address_id}javascript
const accessIPAddressResponse = await client.accessIPAddress.retrieve('access_ip_address_id');
console.log(accessIPAddressResponse.id);Returns: (date-time), (string), (string), (string), (string), (enum: pending, added), (date-time), (string)
created_atdescriptionidip_addresssourcestatusupdated_atuser_idGET /access_ip_address/{access_ip_address_id}javascript
const accessIPAddressResponse = await client.accessIPAddress.retrieve('access_ip_address_id');
console.log(accessIPAddressResponse.id);返回参数:(日期时间)、(字符串)、(字符串)、(字符串)、(字符串)、(枚举值:pending 待处理、added 已添加)、(日期时间)、(字符串)
created_atdescriptionidip_addresssourcestatusupdated_atuser_idDelete access IP address
删除访问IP地址
DELETE /access_ip_address/{access_ip_address_id}javascript
const accessIPAddressResponse = await client.accessIPAddress.delete('access_ip_address_id');
console.log(accessIPAddressResponse.id);Returns: (date-time), (string), (string), (string), (string), (enum: pending, added), (date-time), (string)
created_atdescriptionidip_addresssourcestatusupdated_atuser_idDELETE /access_ip_address/{access_ip_address_id}javascript
const accessIPAddressResponse = await client.accessIPAddress.delete('access_ip_address_id');
console.log(accessIPAddressResponse.id);返回参数:(日期时间)、(字符串)、(字符串)、(字符串)、(字符串)、(枚举值:pending 待处理、added 已添加)、(日期时间)、(字符串)
created_atdescriptionidip_addresssourcestatusupdated_atuser_idList all addresses
查询所有地址
Returns a list of your addresses.
GET /addressesjavascript
// Automatically fetches more pages as needed.
for await (const address of client.addresses.list()) {
console.log(address.id);
}Returns: (boolean), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (boolean)
address_bookadministrative_areaboroughbusiness_namecountry_codecreated_atcustomer_referenceextended_addressfirst_nameidlast_namelocalityneighborhoodphone_numberpostal_coderecord_typestreet_addressupdated_atvalidate_address返回你名下的所有地址列表。
GET /addressesjavascript
// Automatically fetches more pages as needed.
for await (const address of client.addresses.list()) {
console.log(address.id);
}返回参数:(布尔值)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(布尔值)
address_bookadministrative_areaboroughbusiness_namecountry_codecreated_atcustomer_referenceextended_addressfirst_nameidlast_namelocalityneighborhoodphone_numberpostal_coderecord_typestreet_addressupdated_atvalidate_addressCreates an address
新建地址
Creates an address.
POST /addressesfirst_namelast_namebusiness_namestreet_addresslocalitycountry_codeOptional: (boolean), (string), (string), (string), (string), (string), (string), (string), (boolean)
address_bookadministrative_areaboroughcustomer_referenceextended_addressneighborhoodphone_numberpostal_codevalidate_addressjavascript
const address = await client.addresses.create({
business_name: "Toy-O'Kon",
country_code: 'US',
first_name: 'Alfred',
last_name: 'Foster',
locality: 'Austin',
street_address: '600 Congress Avenue',
});
console.log(address.data);Returns: (boolean), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (boolean)
address_bookadministrative_areaboroughbusiness_namecountry_codecreated_atcustomer_referenceextended_addressfirst_nameidlast_namelocalityneighborhoodphone_numberpostal_coderecord_typestreet_addressupdated_atvalidate_address创建一个新地址。
POST /addressesfirst_namelast_namebusiness_namestreet_addresslocalitycountry_code可选参数:(布尔值)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(布尔值)
address_bookadministrative_areaboroughcustomer_referenceextended_addressneighborhoodphone_numberpostal_codevalidate_addressjavascript
const address = await client.addresses.create({
business_name: "Toy-O'Kon",
country_code: 'US',
first_name: 'Alfred',
last_name: 'Foster',
locality: 'Austin',
street_address: '600 Congress Avenue',
});
console.log(address.data);返回参数:(布尔值)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(布尔值)
address_bookadministrative_areaboroughbusiness_namecountry_codecreated_atcustomer_referenceextended_addressfirst_nameidlast_namelocalityneighborhoodphone_numberpostal_coderecord_typestreet_addressupdated_atvalidate_addressValidate an address
校验地址
Validates an address for emergency services.
POST /addresses/actions/validatecountry_codestreet_addresspostal_codeOptional: (string), (string), (string)
administrative_areaextended_addresslocalityjavascript
const response = await client.addresses.actions.validate({
country_code: 'US',
postal_code: '78701',
street_address: '600 Congress Avenue',
});
console.log(response.data);Returns: (array[object]), (string), (enum: valid, invalid), (object)
errorsrecord_typeresultsuggested校验地址是否符合应急服务使用要求。
POST /addresses/actions/validatecountry_codestreet_addresspostal_code可选参数:(字符串)、(字符串)、(字符串)
administrative_areaextended_addresslocalityjavascript
const response = await client.addresses.actions.validate({
country_code: 'US',
postal_code: '78701',
street_address: '600 Congress Avenue',
});
console.log(response.data);返回参数:(对象数组)、(字符串)、(枚举值:valid 有效、invalid 无效)、(对象)
errorsrecord_typeresultsuggestedRetrieve an address
查询单个地址
Retrieves the details of an existing address.
GET /addresses/{id}javascript
const address = await client.addresses.retrieve('550e8400-e29b-41d4-a716-446655440000');
console.log(address.data);Returns: (boolean), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (boolean)
address_bookadministrative_areaboroughbusiness_namecountry_codecreated_atcustomer_referenceextended_addressfirst_nameidlast_namelocalityneighborhoodphone_numberpostal_coderecord_typestreet_addressupdated_atvalidate_address获取现有地址的详细信息。
GET /addresses/{id}javascript
const address = await client.addresses.retrieve('550e8400-e29b-41d4-a716-446655440000');
console.log(address.data);返回参数:(布尔值)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(布尔值)
address_bookadministrative_areaboroughbusiness_namecountry_codecreated_atcustomer_referenceextended_addressfirst_nameidlast_namelocalityneighborhoodphone_numberpostal_coderecord_typestreet_addressupdated_atvalidate_addressDeletes an address
删除地址
Deletes an existing address.
DELETE /addresses/{id}javascript
const address = await client.addresses.delete('550e8400-e29b-41d4-a716-446655440000');
console.log(address.data);Returns: (boolean), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (boolean)
address_bookadministrative_areaboroughbusiness_namecountry_codecreated_atcustomer_referenceextended_addressfirst_nameidlast_namelocalityneighborhoodphone_numberpostal_coderecord_typestreet_addressupdated_atvalidate_address删除现有地址。
DELETE /addresses/{id}javascript
const address = await client.addresses.delete('550e8400-e29b-41d4-a716-446655440000');
console.log(address.data);返回参数:(布尔值)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(布尔值)
address_bookadministrative_areaboroughbusiness_namecountry_codecreated_atcustomer_referenceextended_addressfirst_nameidlast_namelocalityneighborhoodphone_numberpostal_coderecord_typestreet_addressupdated_atvalidate_addressAccepts this address suggestion as a new emergency address for Operator Connect and finishes the uploads of the numbers associated with it to Microsoft.
采纳地址建议并同步到微软Operator Connect
POST /addresses/{id}/actions/accept_suggestionsOptional: (string)
idjavascript
const response = await client.addresses.actions.acceptSuggestions(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
);
console.log(response.data);Returns: (boolean), (uuid), (enum: address_suggestion)
acceptedidrecord_type采纳该地址建议作为新的应急地址,完成关联号码到微软平台的上传流程。
POST /addresses/{id}/actions/accept_suggestions可选参数:(字符串)
idjavascript
const response = await client.addresses.actions.acceptSuggestions(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
);
console.log(response.data);返回参数:(布尔值)、(uuid)、(枚举值:address_suggestion 地址建议)
acceptedidrecord_typeList all SSO authentication providers
查询所有SSO身份认证提供商
Returns a list of your SSO authentication providers.
GET /authentication_providersjavascript
// Automatically fetches more pages as needed.
for await (const authenticationProvider of client.authenticationProviders.list()) {
console.log(authenticationProvider.id);
}Returns: (date-time), (boolean), (date-time), (uuid), (string), (uuid), (string), (object), (string), (date-time)
activated_atactivecreated_atidnameorganization_idrecord_typesettingsshort_nameupdated_at返回你名下的所有SSO身份认证提供商列表。
GET /authentication_providersjavascript
// Automatically fetches more pages as needed.
for await (const authenticationProvider of client.authenticationProviders.list()) {
console.log(authenticationProvider.id);
}返回参数:(日期时间)、(布尔值)、(日期时间)、(uuid)、(字符串)、(uuid)、(字符串)、(对象)、(字符串)、(日期时间)
activated_atactivecreated_atidnameorganization_idrecord_typesettingsshort_nameupdated_atCreates an authentication provider
新建身份认证提供商
Creates an authentication provider.
POST /authentication_providersnameshort_namesettingsOptional: (boolean), (uri)
activesettings_urljavascript
const authenticationProvider = await client.authenticationProviders.create({
name: 'Okta',
settings: {
idp_cert_fingerprint: '13:38:C7:BB:C9:FF:4A:70:38:3A:E3:D9:5C:CD:DB:2E:50:1E:80:A7',
idp_entity_id: 'https://myorg.myidp.com/saml/metadata',
idp_sso_target_url: 'https://myorg.myidp.com/trust/saml2/http-post/sso',
},
short_name: 'myorg',
});
console.log(authenticationProvider.data);Returns: (date-time), (boolean), (date-time), (uuid), (string), (uuid), (string), (object), (string), (date-time)
activated_atactivecreated_atidnameorganization_idrecord_typesettingsshort_nameupdated_at创建一个新的身份认证提供商。
POST /authentication_providersnameshort_namesettings可选参数:(布尔值)、(uri)
activesettings_urljavascript
const authenticationProvider = await client.authenticationProviders.create({
name: 'Okta',
settings: {
idp_cert_fingerprint: '13:38:C7:BB:C9:FF:4A:70:38:3A:E3:D9:5C:CD:DB:2E:50:1E:80:A7',
idp_entity_id: 'https://myorg.myidp.com/saml/metadata',
idp_sso_target_url: 'https://myorg.myidp.com/trust/saml2/http-post/sso',
},
short_name: 'myorg',
});
console.log(authenticationProvider.data);返回参数:(日期时间)、(布尔值)、(日期时间)、(uuid)、(字符串)、(uuid)、(字符串)、(对象)、(字符串)、(日期时间)
activated_atactivecreated_atidnameorganization_idrecord_typesettingsshort_nameupdated_atRetrieve an authentication provider
查询单个身份认证提供商
Retrieves the details of an existing authentication provider.
GET /authentication_providers/{id}javascript
const authenticationProvider = await client.authenticationProviders.retrieve('550e8400-e29b-41d4-a716-446655440000');
console.log(authenticationProvider.data);Returns: (date-time), (boolean), (date-time), (uuid), (string), (uuid), (string), (object), (string), (date-time)
activated_atactivecreated_atidnameorganization_idrecord_typesettingsshort_nameupdated_at获取现有身份认证提供商的详细信息。
GET /authentication_providers/{id}javascript
const authenticationProvider = await client.authenticationProviders.retrieve('550e8400-e29b-41d4-a716-446655440000');
console.log(authenticationProvider.data);返回参数:(日期时间)、(布尔值)、(日期时间)、(uuid)、(字符串)、(uuid)、(字符串)、(对象)、(字符串)、(日期时间)
activated_atactivecreated_atidnameorganization_idrecord_typesettingsshort_nameupdated_atUpdate an authentication provider
更新身份认证提供商
Updates settings of an existing authentication provider.
PATCH /authentication_providers/{id}Optional: (boolean), (string), (object), (uri), (string)
activenamesettingssettings_urlshort_namejavascript
const authenticationProvider = await client.authenticationProviders.update('id', {
active: true,
name: 'Okta',
settings: {
idp_entity_id: 'https://myorg.myidp.com/saml/metadata',
idp_sso_target_url: 'https://myorg.myidp.com/trust/saml2/http-post/sso',
idp_cert_fingerprint: '13:38:C7:BB:C9:FF:4A:70:38:3A:E3:D9:5C:CD:DB:2E:50:1E:80:A7',
idp_cert_fingerprint_algorithm: 'sha1',
},
short_name: 'myorg',
});
console.log(authenticationProvider.data);Returns: (date-time), (boolean), (date-time), (uuid), (string), (uuid), (string), (object), (string), (date-time)
activated_atactivecreated_atidnameorganization_idrecord_typesettingsshort_nameupdated_at更新现有身份认证提供商的配置。
PATCH /authentication_providers/{id}可选参数:(布尔值)、(字符串)、(对象)、(uri)、(字符串)
activenamesettingssettings_urlshort_namejavascript
const authenticationProvider = await client.authenticationProviders.update('id', {
active: true,
name: 'Okta',
settings: {
idp_entity_id: 'https://myorg.myidp.com/saml/metadata',
idp_sso_target_url: 'https://myorg.myidp.com/trust/saml2/http-post/sso',
idp_cert_fingerprint: '13:38:C7:BB:C9:FF:4A:70:38:3A:E3:D9:5C:CD:DB:2E:50:1E:80:A7',
idp_cert_fingerprint_algorithm: 'sha1',
},
short_name: 'myorg',
});
console.log(authenticationProvider.data);返回参数:(日期时间)、(布尔值)、(日期时间)、(uuid)、(字符串)、(uuid)、(字符串)、(对象)、(字符串)、(日期时间)
activated_atactivecreated_atidnameorganization_idrecord_typesettingsshort_nameupdated_atDeletes an authentication provider
删除身份认证提供商
Deletes an existing authentication provider.
DELETE /authentication_providers/{id}javascript
const authenticationProvider = await client.authenticationProviders.delete('550e8400-e29b-41d4-a716-446655440000');
console.log(authenticationProvider.data);Returns: (date-time), (boolean), (date-time), (uuid), (string), (uuid), (string), (object), (string), (date-time)
activated_atactivecreated_atidnameorganization_idrecord_typesettingsshort_nameupdated_at删除现有身份认证提供商。
DELETE /authentication_providers/{id}javascript
const authenticationProvider = await client.authenticationProviders.delete('550e8400-e29b-41d4-a716-446655440000');
console.log(authenticationProvider.data);返回参数:(日期时间)、(布尔值)、(日期时间)、(uuid)、(字符串)、(uuid)、(字符串)、(对象)、(字符串)、(日期时间)
activated_atactivecreated_atidnameorganization_idrecord_typesettingsshort_nameupdated_atList all billing groups
查询所有账单组
GET /billing_groupsjavascript
// Automatically fetches more pages as needed.
for await (const billingGroup of client.billingGroups.list()) {
console.log(billingGroup.id);
}Returns: (date-time), (date-time), (uuid), (string), (uuid), (enum: billing_group), (date-time)
created_atdeleted_atidnameorganization_idrecord_typeupdated_atGET /billing_groupsjavascript
// Automatically fetches more pages as needed.
for await (const billingGroup of client.billingGroups.list()) {
console.log(billingGroup.id);
}返回参数:(日期时间)、(日期时间)、(uuid)、(字符串)、(uuid)、(枚举值:billing_group 账单组)、(日期时间)
created_atdeleted_atidnameorganization_idrecord_typeupdated_atCreate a billing group
新建账单组
POST /billing_groupsOptional: (string)
namejavascript
const billingGroup = await client.billingGroups.create({ name: 'my-resource' });
console.log(billingGroup.data);Returns: (date-time), (date-time), (uuid), (string), (uuid), (enum: billing_group), (date-time)
created_atdeleted_atidnameorganization_idrecord_typeupdated_atPOST /billing_groups可选参数:(字符串)
namejavascript
const billingGroup = await client.billingGroups.create({ name: 'my-resource' });
console.log(billingGroup.data);返回参数:(日期时间)、(日期时间)、(uuid)、(字符串)、(uuid)、(枚举值:billing_group 账单组)、(日期时间)
created_atdeleted_atidnameorganization_idrecord_typeupdated_atGet a billing group
查询单个账单组
GET /billing_groups/{id}javascript
const billingGroup = await client.billingGroups.retrieve('f5586561-8ff0-4291-a0ac-84fe544797bd');
console.log(billingGroup.data);Returns: (date-time), (date-time), (uuid), (string), (uuid), (enum: billing_group), (date-time)
created_atdeleted_atidnameorganization_idrecord_typeupdated_atGET /billing_groups/{id}javascript
const billingGroup = await client.billingGroups.retrieve('f5586561-8ff0-4291-a0ac-84fe544797bd');
console.log(billingGroup.data);返回参数:(日期时间)、(日期时间)、(uuid)、(字符串)、(uuid)、(枚举值:billing_group 账单组)、(日期时间)
created_atdeleted_atidnameorganization_idrecord_typeupdated_atUpdate a billing group
更新账单组
PATCH /billing_groups/{id}Optional: (string)
namejavascript
const billingGroup = await client.billingGroups.update('f5586561-8ff0-4291-a0ac-84fe544797bd', {
name: 'my-resource',
});
console.log(billingGroup.data);Returns: (date-time), (date-time), (uuid), (string), (uuid), (enum: billing_group), (date-time)
created_atdeleted_atidnameorganization_idrecord_typeupdated_atPATCH /billing_groups/{id}可选参数:(字符串)
namejavascript
const billingGroup = await client.billingGroups.update('f5586561-8ff0-4291-a0ac-84fe544797bd', {
name: 'my-resource',
});
console.log(billingGroup.data);返回参数:(日期时间)、(日期时间)、(uuid)、(字符串)、(uuid)、(枚举值:billing_group 账单组)、(日期时间)
created_atdeleted_atidnameorganization_idrecord_typeupdated_atDelete a billing group
删除账单组
DELETE /billing_groups/{id}javascript
const billingGroup = await client.billingGroups.delete('f5586561-8ff0-4291-a0ac-84fe544797bd');
console.log(billingGroup.data);Returns: (date-time), (date-time), (uuid), (string), (uuid), (enum: billing_group), (date-time)
created_atdeleted_atidnameorganization_idrecord_typeupdated_atDELETE /billing_groups/{id}javascript
const billingGroup = await client.billingGroups.delete('f5586561-8ff0-4291-a0ac-84fe544797bd');
console.log(billingGroup.data);返回参数:(日期时间)、(日期时间)、(uuid)、(字符串)、(uuid)、(枚举值:billing_group 账单组)、(日期时间)
created_atdeleted_atidnameorganization_idrecord_typeupdated_atList integration secrets
查询所有集成密钥
Retrieve a list of all integration secrets configured by the user.
GET /integration_secretsjavascript
// Automatically fetches more pages as needed.
for await (const integrationSecret of client.integrationSecrets.list()) {
console.log(integrationSecret.id);
}Returns: (date-time), (string), (string), (string), (date-time)
created_atididentifierrecord_typeupdated_at获取用户配置的所有集成密钥列表。
GET /integration_secretsjavascript
// Automatically fetches more pages as needed.
for await (const integrationSecret of client.integrationSecrets.list()) {
console.log(integrationSecret.id);
}返回参数:(日期时间)、(字符串)、(字符串)、(字符串)、(日期时间)
created_atididentifierrecord_typeupdated_atCreate a secret
新建集成密钥
Create a new secret with an associated identifier that can be used to securely integrate with other services.
POST /integration_secretsidentifiertypeOptional: (string), (string), (string)
passwordtokenusernamejavascript
const integrationSecret = await client.integrationSecrets.create({
identifier: 'my_secret',
type: 'bearer',
token: 'my_secret_value',
});
console.log(integrationSecret.data);Returns: (date-time), (string), (string), (string), (date-time)
created_atididentifierrecord_typeupdated_at创建一个新的集成密钥,关联的标识符可用于安全对接其他服务。
POST /integration_secretsidentifiertype可选参数:(字符串)、(字符串)、(字符串)
passwordtokenusernamejavascript
const integrationSecret = await client.integrationSecrets.create({
identifier: 'my_secret',
type: 'bearer',
token: 'my_secret_value',
});
console.log(integrationSecret.data);返回参数:(日期时间)、(字符串)、(字符串)、(字符串)、(日期时间)
created_atididentifierrecord_typeupdated_atDelete an integration secret
删除集成密钥
Delete an integration secret given its ID.
DELETE /integration_secrets/{id}javascript
await client.integrationSecrets.delete('550e8400-e29b-41d4-a716-446655440000');根据ID删除指定的集成密钥。
DELETE /integration_secrets/{id}javascript
await client.integrationSecrets.delete('550e8400-e29b-41d4-a716-446655440000');Create an Access Token.
生成访问令牌
Create an Access Token (JWT) for the credential.
POST /telephony_credentials/{id}/tokenjavascript
const response = await client.telephonyCredentials.createToken('550e8400-e29b-41d4-a716-446655440000');
console.log(response);为凭证生成访问令牌(JWT)。
POST /telephony_credentials/{id}/tokenjavascript
const response = await client.telephonyCredentials.createToken('550e8400-e29b-41d4-a716-446655440000');
console.log(response);