telnyx-porting-in-python

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
<!-- Auto-generated from Telnyx OpenAPI specs. Do not edit. -->
<!-- 从Telnyx OpenAPI规范自动生成,请勿编辑 -->

Telnyx Porting In - Python

Telnyx 号码迁入 - Python

Installation

安装

bash
pip install telnyx
bash
pip install telnyx

Setup

配置

python
import os
from telnyx import Telnyx

client = Telnyx(
    api_key=os.environ.get("TELNYX_API_KEY"),  # This is the default and can be omitted
)
All examples below assume
client
is already initialized as shown above.
python
import os
from telnyx import Telnyx

client = Telnyx(
    api_key=os.environ.get("TELNYX_API_KEY"),  # 这是默认配置,可以省略
)
以下所有示例均假设
client
已按上述方式完成初始化。

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:
python
import telnyx

try:
    result = client.messages.send(to="+13125550001", from_="+13125550002", text="Hello")
except telnyx.APIConnectionError:
    print("Network error — check connectivity and retry")
except telnyx.RateLimitError:
    # 429: rate limited — wait and retry with exponential backoff
    import time
    time.sleep(1)  # Check Retry-After header for actual delay
except telnyx.APIStatusError as e:
    print(f"API error {e.status_code}: {e.message}")
    if e.status_code == 422:
        print("Validation error — check required fields and formats")
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).
所有API调用都可能失败,原因包括网络错误、速率限制(429)、校验错误(422)或身份验证错误(401)。生产环境代码请务必做好错误处理:
python
import telnyx

try:
    result = client.messages.send(to="+13125550001", from_="+13125550002", text="Hello")
except telnyx.APIConnectionError:
    print("网络错误 — 检查连接并重试")
except telnyx.RateLimitError:
    # 429: 触发速率限制 — 等待后用指数退避策略重试
    import time
    time.sleep(1)  # 可查看Retry-After响应头获取实际需要等待的时长
except telnyx.APIStatusError as e:
    print(f"API错误 {e.status_code}: {e.message}")
    if e.status_code == 422:
        print("校验错误 — 检查必填字段和格式是否正确")
常见错误码:
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 methods return an auto-paginating iterator. Use
    for item in page_result:
    to iterate through all pages automatically.
  • 电话号码必须采用E.164格式(例如
    +13125550001
    ),需包含
    +
    前缀和国家代码,不能有空格、破折号或括号。
  • 分页: 列表类接口返回支持自动分页的迭代器,使用
    for item in page_result:
    即可自动遍历所有分页内容。

Run a portability check

运行可移植性检查

Runs a portability check, returning the results immediately.
POST /portability_checks
Optional:
phone_numbers
(array[string])
python
response = client.portability_checks.run(
    phone_numbers=["+18005550101"],
)
print(response.data)
Returns:
fast_portable
(boolean),
not_portable_reason
(string),
phone_number
(string),
portable
(boolean),
record_type
(string)
运行号码可迁入性检查,即时返回结果。
POST /portability_checks
可选参数:
phone_numbers
(字符串数组)
python
response = client.portability_checks.run(
    phone_numbers=["+18005550101"],
)
print(response.data)
返回字段:
fast_portable
(布尔值),
not_portable_reason
(字符串),
phone_number
(字符串),
portable
(布尔值),
record_type
(字符串)

List all porting events

列出所有迁入事件

Returns a list of all porting events.
GET /porting/events
python
page = client.porting.events.list()
page = page.data[0]
print(page)
Returns:
available_notification_methods
(array[string]),
event_type
(enum: porting_order.deleted),
id
(uuid),
payload
(object),
payload_status
(enum: created, completed),
porting_order_id
(uuid)
返回所有迁入事件的列表。
GET /porting/events
python
page = client.porting.events.list()
page = page.data[0]
print(page)
返回字段:
available_notification_methods
(字符串数组),
event_type
(枚举: porting_order.deleted),
id
(uuid),
payload
(对象),
payload_status
(枚举: created, completed),
porting_order_id
(uuid)

Show a porting event

查询单个迁入事件

Show a specific porting event.
GET /porting/events/{id}
python
event = client.porting.events.retrieve(
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(event.data)
Returns:
available_notification_methods
(array[string]),
event_type
(enum: porting_order.deleted),
id
(uuid),
payload
(object),
payload_status
(enum: created, completed),
porting_order_id
(uuid)
查询指定迁入事件的详情。
GET /porting/events/{id}
python
event = client.porting.events.retrieve(
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(event.data)
返回字段:
available_notification_methods
(字符串数组),
event_type
(枚举: porting_order.deleted),
id
(uuid),
payload
(对象),
payload_status
(枚举: created, completed),
porting_order_id
(uuid)

Republish a porting event

重新推送迁入事件

Republish a specific porting event.
POST /porting/events/{id}/republish
python
client.porting.events.republish(
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
重新推送指定迁入事件。
POST /porting/events/{id}/republish
python
client.porting.events.republish(
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)

List LOA configurations

列出LOA配置

List the LOA configurations.
GET /porting/loa_configurations
python
page = client.porting.loa_configurations.list()
page = page.data[0]
print(page.id)
Returns:
address
(object),
company_name
(string),
contact
(object),
created_at
(date-time),
id
(uuid),
logo
(object),
name
(string),
organization_id
(string),
record_type
(string),
updated_at
(date-time)
列出所有LOA配置。
GET /porting/loa_configurations
python
page = client.porting.loa_configurations.list()
page = page.data[0]
print(page.id)
返回字段:
address
(对象),
company_name
(字符串),
contact
(对象),
created_at
(日期时间),
id
(uuid),
logo
(对象),
name
(字符串),
organization_id
(字符串),
record_type
(字符串),
updated_at
(日期时间)

Create a LOA configuration

创建LOA配置

Create a LOA configuration.
POST /porting/loa_configurations
python
loa_configuration = client.porting.loa_configurations.create(
    address={
        "city": "Austin",
        "country_code": "US",
        "state": "TX",
        "street_address": "600 Congress Avenue",
        "zip_code": "78701",
    },
    company_name="Telnyx",
    contact={
        "email": "testing@telnyx.com",
        "phone_number": "+12003270001",
    },
    logo={
        "document_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
    },
    name="My LOA Configuration",
)
print(loa_configuration.data)
Returns:
address
(object),
company_name
(string),
contact
(object),
created_at
(date-time),
id
(uuid),
logo
(object),
name
(string),
organization_id
(string),
record_type
(string),
updated_at
(date-time)
创建新的LOA配置。
POST /porting/loa_configurations
python
loa_configuration = client.porting.loa_configurations.create(
    address={
        "city": "Austin",
        "country_code": "US",
        "state": "TX",
        "street_address": "600 Congress Avenue",
        "zip_code": "78701",
    },
    company_name="Telnyx",
    contact={
        "email": "testing@telnyx.com",
        "phone_number": "+12003270001",
    },
    logo={
        "document_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
    },
    name="My LOA Configuration",
)
print(loa_configuration.data)
返回字段:
address
(对象),
company_name
(字符串),
contact
(对象),
created_at
(日期时间),
id
(uuid),
logo
(对象),
name
(字符串),
organization_id
(字符串),
record_type
(字符串),
updated_at
(日期时间)

Preview the LOA configuration parameters

预览LOA配置参数

Preview the LOA template that would be generated without need to create LOA configuration.
POST /porting/loa_configurations/preview
python
response = client.porting.loa_configurations.preview(
    address={
        "city": "Austin",
        "country_code": "US",
        "state": "TX",
        "street_address": "600 Congress Avenue",
        "zip_code": "78701",
    },
    company_name="Telnyx",
    contact={
        "email": "testing@telnyx.com",
        "phone_number": "+12003270001",
    },
    logo={
        "document_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
    },
    name="My LOA Configuration",
)
print(response)
content = response.read()
print(content)
无需创建LOA配置即可预览生成的LOA模板。
POST /porting/loa_configurations/preview
python
response = client.porting.loa_configurations.preview(
    address={
        "city": "Austin",
        "country_code": "US",
        "state": "TX",
        "street_address": "600 Congress Avenue",
        "zip_code": "78701",
    },
    company_name="Telnyx",
    contact={
        "email": "testing@telnyx.com",
        "phone_number": "+12003270001",
    },
    logo={
        "document_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
    },
    name="My LOA Configuration",
)
print(response)
content = response.read()
print(content)

Retrieve a LOA configuration

查询单个LOA配置

Retrieve a specific LOA configuration.
GET /porting/loa_configurations/{id}
python
loa_configuration = client.porting.loa_configurations.retrieve(
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(loa_configuration.data)
Returns:
address
(object),
company_name
(string),
contact
(object),
created_at
(date-time),
id
(uuid),
logo
(object),
name
(string),
organization_id
(string),
record_type
(string),
updated_at
(date-time)
查询指定LOA配置的详情。
GET /porting/loa_configurations/{id}
python
loa_configuration = client.porting.loa_configurations.retrieve(
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(loa_configuration.data)
返回字段:
address
(对象),
company_name
(字符串),
contact
(对象),
created_at
(日期时间),
id
(uuid),
logo
(对象),
name
(字符串),
organization_id
(字符串),
record_type
(字符串),
updated_at
(日期时间)

Update a LOA configuration

更新LOA配置

Update a specific LOA configuration.
PATCH /porting/loa_configurations/{id}
python
loa_configuration = client.porting.loa_configurations.update(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    address={
        "city": "Austin",
        "country_code": "US",
        "state": "TX",
        "street_address": "600 Congress Avenue",
        "zip_code": "78701",
    },
    company_name="Telnyx",
    contact={
        "email": "testing@telnyx.com",
        "phone_number": "+12003270001",
    },
    logo={
        "document_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
    },
    name="My LOA Configuration",
)
print(loa_configuration.data)
Returns:
address
(object),
company_name
(string),
contact
(object),
created_at
(date-time),
id
(uuid),
logo
(object),
name
(string),
organization_id
(string),
record_type
(string),
updated_at
(date-time)
更新指定LOA配置。
PATCH /porting/loa_configurations/{id}
python
loa_configuration = client.porting.loa_configurations.update(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    address={
        "city": "Austin",
        "country_code": "US",
        "state": "TX",
        "street_address": "600 Congress Avenue",
        "zip_code": "78701",
    },
    company_name="Telnyx",
    contact={
        "email": "testing@telnyx.com",
        "phone_number": "+12003270001",
    },
    logo={
        "document_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
    },
    name="My LOA Configuration",
)
print(loa_configuration.data)
返回字段:
address
(对象),
company_name
(字符串),
contact
(对象),
created_at
(日期时间),
id
(uuid),
logo
(对象),
name
(字符串),
organization_id
(字符串),
record_type
(字符串),
updated_at
(日期时间)

Delete a LOA configuration

删除LOA配置

Delete a specific LOA configuration.
DELETE /porting/loa_configurations/{id}
python
client.porting.loa_configurations.delete(
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
删除指定LOA配置。
DELETE /porting/loa_configurations/{id}
python
client.porting.loa_configurations.delete(
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)

Preview a LOA configuration

预览LOA配置

Preview a specific LOA configuration.
GET /porting/loa_configurations/{id}/preview
python
response = client.porting.loa_configurations.preview_1(
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(response)
content = response.read()
print(content)
预览指定LOA配置。
GET /porting/loa_configurations/{id}/preview
python
response = client.porting.loa_configurations.preview_1(
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(response)
content = response.read()
print(content)

List porting related reports

列出迁入相关报表

List the reports generated about porting operations.
GET /porting/reports
python
page = client.porting.reports.list()
page = page.data[0]
print(page.id)
Returns:
created_at
(date-time),
document_id
(uuid),
id
(uuid),
params
(object),
record_type
(string),
report_type
(enum: export_porting_orders_csv),
status
(enum: pending, completed),
updated_at
(date-time)
列出所有迁入操作生成的报表。
GET /porting/reports
python
page = client.porting.reports.list()
page = page.data[0]
print(page.id)
返回字段:
created_at
(日期时间),
document_id
(uuid),
id
(uuid),
params
(对象),
record_type
(字符串),
report_type
(枚举: export_porting_orders_csv),
status
(枚举: pending, completed),
updated_at
(日期时间)

Create a porting related report

创建迁入相关报表

Generate reports about porting operations.
POST /porting/reports
python
report = client.porting.reports.create(
    params={
        "filters": {}
    },
    report_type="export_porting_orders_csv",
)
print(report.data)
Returns:
created_at
(date-time),
document_id
(uuid),
id
(uuid),
params
(object),
record_type
(string),
report_type
(enum: export_porting_orders_csv),
status
(enum: pending, completed),
updated_at
(date-time)
生成迁入操作相关的报表。
POST /porting/reports
python
report = client.porting.reports.create(
    params={
        "filters": {}
    },
    report_type="export_porting_orders_csv",
)
print(report.data)
返回字段:
created_at
(日期时间),
document_id
(uuid),
id
(uuid),
params
(对象),
record_type
(字符串),
report_type
(枚举: export_porting_orders_csv),
status
(枚举: pending, completed),
updated_at
(日期时间)

Retrieve a report

查询单个报表

Retrieve a specific report generated.
GET /porting/reports/{id}
python
report = client.porting.reports.retrieve(
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(report.data)
Returns:
created_at
(date-time),
document_id
(uuid),
id
(uuid),
params
(object),
record_type
(string),
report_type
(enum: export_porting_orders_csv),
status
(enum: pending, completed),
updated_at
(date-time)
查询指定的生成报表详情。
GET /porting/reports/{id}
python
report = client.porting.reports.retrieve(
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(report.data)
返回字段:
created_at
(日期时间),
document_id
(uuid),
id
(uuid),
params
(对象),
record_type
(字符串),
report_type
(枚举: export_porting_orders_csv),
status
(枚举: pending, completed),
updated_at
(日期时间)

List available carriers in the UK

列出英国可用运营商

List available carriers in the UK.
GET /porting/uk_carriers
python
response = client.porting.list_uk_carriers()
print(response.data)
Returns:
alternative_cupids
(array[string]),
created_at
(date-time),
cupid
(string),
id
(uuid),
name
(string),
record_type
(string),
updated_at
(date-time)
列出英国地区的可用运营商。
GET /porting/uk_carriers
python
response = client.porting.list_uk_carriers()
print(response.data)
返回字段:
alternative_cupids
(字符串数组),
created_at
(日期时间),
cupid
(字符串),
id
(uuid),
name
(字符串),
record_type
(字符串),
updated_at
(日期时间)

List all porting orders

列出所有迁入订单

Returns a list of your porting order.
GET /porting_orders
python
page = client.porting_orders.list()
page = page.data[0]
print(page.id)
Returns:
activation_settings
(object),
additional_steps
(array[string]),
created_at
(date-time),
customer_group_reference
(string | null),
customer_reference
(string | null),
description
(string),
documents
(object),
end_user
(object),
id
(uuid),
messaging
(object),
misc
(object),
old_service_provider_ocn
(string),
parent_support_key
(string | null),
phone_number_configuration
(object),
phone_number_type
(enum: landline, local, mobile, national, shared_cost, toll_free),
phone_numbers
(array[object]),
porting_phone_numbers_count
(integer),
record_type
(string),
requirements
(array[object]),
requirements_met
(boolean),
status
(object),
support_key
(string | null),
updated_at
(date-time),
user_feedback
(object),
user_id
(uuid),
webhook_url
(uri)
返回你的所有迁入订单列表。
GET /porting_orders
python
page = client.porting_orders.list()
page = page.data[0]
print(page.id)
返回字段:
activation_settings
(对象),
additional_steps
(字符串数组),
created_at
(日期时间),
customer_group_reference
(字符串 | 空),
customer_reference
(字符串 | 空),
description
(字符串),
documents
(对象),
end_user
(对象),
id
(uuid),
messaging
(对象),
misc
(对象),
old_service_provider_ocn
(字符串),
parent_support_key
(字符串 | 空),
phone_number_configuration
(对象),
phone_number_type
(枚举: landline, local, mobile, national, shared_cost, toll_free),
phone_numbers
(对象数组),
porting_phone_numbers_count
(整数),
record_type
(字符串),
requirements
(对象数组),
requirements_met
(布尔值),
status
(对象),
support_key
(字符串 | 空),
updated_at
(日期时间),
user_feedback
(对象),
user_id
(uuid),
webhook_url
(uri)

Create a porting order

创建迁入订单

Creates a new porting order object.
POST /porting_orders
— Required:
phone_numbers
Optional:
customer_group_reference
(string),
customer_reference
(string | null)
python
porting_order = client.porting_orders.create(
    phone_numbers=["+13035550000", "+13035550001", "+13035550002"],
)
print(porting_order.data)
Returns:
activation_settings
(object),
additional_steps
(array[string]),
created_at
(date-time),
customer_group_reference
(string | null),
customer_reference
(string | null),
description
(string),
documents
(object),
end_user
(object),
id
(uuid),
messaging
(object),
misc
(object),
old_service_provider_ocn
(string),
parent_support_key
(string | null),
phone_number_configuration
(object),
phone_number_type
(enum: landline, local, mobile, national, shared_cost, toll_free),
phone_numbers
(array[object]),
porting_phone_numbers_count
(integer),
record_type
(string),
requirements
(array[object]),
requirements_met
(boolean),
status
(object),
support_key
(string | null),
updated_at
(date-time),
user_feedback
(object),
user_id
(uuid),
webhook_url
(uri)
创建新的迁入订单对象。
POST /porting_orders
— 必填参数:
phone_numbers
可选参数:
customer_group_reference
(字符串),
customer_reference
(字符串 | 空)
python
porting_order = client.porting_orders.create(
    phone_numbers=["+13035550000", "+13035550001", "+13035550002"],
)
print(porting_order.data)
返回字段:
activation_settings
(对象),
additional_steps
(字符串数组),
created_at
(日期时间),
customer_group_reference
(字符串 | 空),
customer_reference
(字符串 | 空),
description
(字符串),
documents
(对象),
end_user
(对象),
id
(uuid),
messaging
(对象),
misc
(对象),
old_service_provider_ocn
(字符串),
parent_support_key
(字符串 | 空),
phone_number_configuration
(对象),
phone_number_type
(枚举: landline, local, mobile, national, shared_cost, toll_free),
phone_numbers
(对象数组),
porting_phone_numbers_count
(整数),
record_type
(字符串),
requirements
(对象数组),
requirements_met
(布尔值),
status
(对象),
support_key
(字符串 | 空),
updated_at
(日期时间),
user_feedback
(对象),
user_id
(uuid),
webhook_url
(uri)

List all exception types

列出所有异常类型

Returns a list of all possible exception types for a porting order.
GET /porting_orders/exception_types
python
response = client.porting_orders.retrieve_exception_types()
print(response.data)
Returns:
code
(enum: ACCOUNT_NUMBER_MISMATCH, AUTH_PERSON_MISMATCH, BTN_ATN_MISMATCH, ENTITY_NAME_MISMATCH, FOC_EXPIRED, FOC_REJECTED, LOCATION_MISMATCH, LSR_PENDING, MAIN_BTN_PORTING, OSP_IRRESPONSIVE, OTHER, PASSCODE_PIN_INVALID, PHONE_NUMBER_HAS_SPECIAL_FEATURE, PHONE_NUMBER_MISMATCH, PHONE_NUMBER_NOT_PORTABLE, PORT_TYPE_INCORRECT, PORTING_ORDER_SPLIT_REQUIRED, POSTAL_CODE_MISMATCH, RATE_CENTER_NOT_PORTABLE, SV_CONFLICT, SV_UNKNOWN_FAILURE),
description
(string)
返回迁入订单所有可能的异常类型列表。
GET /porting_orders/exception_types
python
response = client.porting_orders.retrieve_exception_types()
print(response.data)
返回字段:
code
(枚举: ACCOUNT_NUMBER_MISMATCH, AUTH_PERSON_MISMATCH, BTN_ATN_MISMATCH, ENTITY_NAME_MISMATCH, FOC_EXPIRED, FOC_REJECTED, LOCATION_MISMATCH, LSR_PENDING, MAIN_BTN_PORTING, OSP_IRRESPONSIVE, OTHER, PASSCODE_PIN_INVALID, PHONE_NUMBER_HAS_SPECIAL_FEATURE, PHONE_NUMBER_MISMATCH, PHONE_NUMBER_NOT_PORTABLE, PORT_TYPE_INCORRECT, PORTING_ORDER_SPLIT_REQUIRED, POSTAL_CODE_MISMATCH, RATE_CENTER_NOT_PORTABLE, SV_CONFLICT, SV_UNKNOWN_FAILURE),
description
(字符串)

List all phone number configurations

列出所有电话号码配置

Returns a list of phone number configurations paginated.
GET /porting_orders/phone_number_configurations
python
page = client.porting_orders.phone_number_configurations.list()
page = page.data[0]
print(page.id)
Returns:
created_at
(date-time),
id
(uuid),
porting_phone_number_id
(uuid),
record_type
(string),
updated_at
(date-time),
user_bundle_id
(uuid)
返回分页的电话号码配置列表。
GET /porting_orders/phone_number_configurations
python
page = client.porting_orders.phone_number_configurations.list()
page = page.data[0]
print(page.id)
返回字段:
created_at
(日期时间),
id
(uuid),
porting_phone_number_id
(uuid),
record_type
(字符串),
updated_at
(日期时间),
user_bundle_id
(uuid)

Create a list of phone number configurations

批量创建电话号码配置

Creates a list of phone number configurations.
POST /porting_orders/phone_number_configurations
python
phone_number_configuration = client.porting_orders.phone_number_configurations.create()
print(phone_number_configuration.data)
Returns:
created_at
(date-time),
id
(uuid),
porting_phone_number_id
(uuid),
record_type
(string),
updated_at
(date-time),
user_bundle_id
(uuid)
创建一组电话号码配置。
POST /porting_orders/phone_number_configurations
python
phone_number_configuration = client.porting_orders.phone_number_configurations.create()
print(phone_number_configuration.data)
返回字段:
created_at
(日期时间),
id
(uuid),
porting_phone_number_id
(uuid),
record_type
(字符串),
updated_at
(日期时间),
user_bundle_id
(uuid)

Retrieve a porting order

查询单个迁入订单

Retrieves the details of an existing porting order.
GET /porting_orders/{id}
python
porting_order = client.porting_orders.retrieve(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(porting_order.data)
Returns:
activation_settings
(object),
additional_steps
(array[string]),
created_at
(date-time),
customer_group_reference
(string | null),
customer_reference
(string | null),
description
(string),
documents
(object),
end_user
(object),
id
(uuid),
messaging
(object),
misc
(object),
old_service_provider_ocn
(string),
parent_support_key
(string | null),
phone_number_configuration
(object),
phone_number_type
(enum: landline, local, mobile, national, shared_cost, toll_free),
phone_numbers
(array[object]),
porting_phone_numbers_count
(integer),
record_type
(string),
requirements
(array[object]),
requirements_met
(boolean),
status
(object),
support_key
(string | null),
updated_at
(date-time),
user_feedback
(object),
user_id
(uuid),
webhook_url
(uri)
查询现有迁入订单的详情。
GET /porting_orders/{id}
python
porting_order = client.porting_orders.retrieve(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(porting_order.data)
返回字段:
activation_settings
(对象),
additional_steps
(字符串数组),
created_at
(日期时间),
customer_group_reference
(字符串 | 空),
customer_reference
(字符串 | 空),
description
(字符串),
documents
(对象),
end_user
(对象),
id
(uuid),
messaging
(对象),
misc
(对象),
old_service_provider_ocn
(字符串),
parent_support_key
(字符串 | 空),
phone_number_configuration
(对象),
phone_number_type
(枚举: landline, local, mobile, national, shared_cost, toll_free),
phone_numbers
(对象数组),
porting_phone_numbers_count
(整数),
record_type
(字符串),
requirements
(对象数组),
requirements_met
(布尔值),
status
(对象),
support_key
(字符串 | 空),
updated_at
(日期时间),
user_feedback
(对象),
user_id
(uuid),
webhook_url
(uri)

Edit a porting order

编辑迁入订单

Edits the details of an existing porting order. Any or all of a porting orders attributes may be included in the resource object included in a PATCH request. If a request does not include all of the attributes for a resource, the system will interpret the missing attributes as if they were included with their current values.
PATCH /porting_orders/{id}
Optional:
activation_settings
(object),
customer_group_reference
(string),
customer_reference
(string),
documents
(object),
end_user
(object),
messaging
(object),
misc
(object),
phone_number_configuration
(object),
requirement_group_id
(uuid),
requirements
(array[object]),
user_feedback
(object),
webhook_url
(uri)
python
porting_order = client.porting_orders.update(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(porting_order.data)
Returns:
activation_settings
(object),
additional_steps
(array[string]),
created_at
(date-time),
customer_group_reference
(string | null),
customer_reference
(string | null),
description
(string),
documents
(object),
end_user
(object),
id
(uuid),
messaging
(object),
misc
(object),
old_service_provider_ocn
(string),
parent_support_key
(string | null),
phone_number_configuration
(object),
phone_number_type
(enum: landline, local, mobile, national, shared_cost, toll_free),
phone_numbers
(array[object]),
porting_phone_numbers_count
(integer),
record_type
(string),
requirements
(array[object]),
requirements_met
(boolean),
status
(object),
support_key
(string | null),
updated_at
(date-time),
user_feedback
(object),
user_id
(uuid),
webhook_url
(uri)
编辑现有迁入订单的详情。PATCH请求的资源对象中可以包含迁入订单的任意或全部属性。如果请求未包含资源的全部属性,系统会认为缺失的属性保持当前值不变。
PATCH /porting_orders/{id}
可选参数:
activation_settings
(对象),
customer_group_reference
(字符串),
customer_reference
(字符串),
documents
(对象),
end_user
(对象),
messaging
(对象),
misc
(对象),
phone_number_configuration
(对象),
requirement_group_id
(uuid),
requirements
(对象数组),
user_feedback
(对象),
webhook_url
(uri)
python
porting_order = client.porting_orders.update(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(porting_order.data)
返回字段:
activation_settings
(对象),
additional_steps
(字符串数组),
created_at
(日期时间),
customer_group_reference
(字符串 | 空),
customer_reference
(字符串 | 空),
description
(字符串),
documents
(对象),
end_user
(对象),
id
(uuid),
messaging
(对象),
misc
(对象),
old_service_provider_ocn
(字符串),
parent_support_key
(字符串 | 空),
phone_number_configuration
(对象),
phone_number_type
(枚举: landline, local, mobile, national, shared_cost, toll_free),
phone_numbers
(对象数组),
porting_phone_numbers_count
(整数),
record_type
(字符串),
requirements
(对象数组),
requirements_met
(布尔值),
status
(对象),
support_key
(字符串 | 空),
updated_at
(日期时间),
user_feedback
(对象),
user_id
(uuid),
webhook_url
(uri)

Delete a porting order

删除迁入订单

Deletes an existing porting order. This operation is restrict to porting orders in draft state.
DELETE /porting_orders/{id}
python
client.porting_orders.delete(
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
删除现有迁入订单,仅草稿状态的迁入订单支持此操作。
DELETE /porting_orders/{id}
python
client.porting_orders.delete(
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)

Activate every number in a porting order asynchronously.

异步激活迁入订单内的所有号码

Activate each number in a porting order asynchronously. This operation is limited to US FastPort orders only.
POST /porting_orders/{id}/actions/activate
python
response = client.porting_orders.actions.activate(
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(response.data)
Returns:
activate_at
(date-time),
activation_type
(enum: scheduled, on-demand),
activation_windows
(array[object]),
created_at
(date-time),
id
(uuid),
record_type
(string),
status
(enum: created, in-process, completed, failed),
updated_at
(date-time)
异步激活迁入订单内的每个号码,仅美国FastPort订单支持此操作。
POST /porting_orders/{id}/actions/activate
python
response = client.porting_orders.actions.activate(
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(response.data)
返回字段:
activate_at
(日期时间),
activation_type
(枚举: scheduled, on-demand),
activation_windows
(对象数组),
created_at
(日期时间),
id
(uuid),
record_type
(字符串),
status
(枚举: created, in-process, completed, failed),
updated_at
(日期时间)

Cancel a porting order

取消迁入订单

POST /porting_orders/{id}/actions/cancel
python
response = client.porting_orders.actions.cancel(
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(response.data)
Returns:
activation_settings
(object),
additional_steps
(array[string]),
created_at
(date-time),
customer_group_reference
(string | null),
customer_reference
(string | null),
description
(string),
documents
(object),
end_user
(object),
id
(uuid),
messaging
(object),
misc
(object),
old_service_provider_ocn
(string),
parent_support_key
(string | null),
phone_number_configuration
(object),
phone_number_type
(enum: landline, local, mobile, national, shared_cost, toll_free),
phone_numbers
(array[object]),
porting_phone_numbers_count
(integer),
record_type
(string),
requirements
(array[object]),
requirements_met
(boolean),
status
(object),
support_key
(string | null),
updated_at
(date-time),
user_feedback
(object),
user_id
(uuid),
webhook_url
(uri)
POST /porting_orders/{id}/actions/cancel
python
response = client.porting_orders.actions.cancel(
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(response.data)
返回字段:
activation_settings
(对象),
additional_steps
(字符串数组),
created_at
(日期时间),
customer_group_reference
(字符串 | 空),
customer_reference
(字符串 | 空),
description
(字符串),
documents
(对象),
end_user
(对象),
id
(uuid),
messaging
(对象),
misc
(对象),
old_service_provider_ocn
(字符串),
parent_support_key
(字符串 | 空),
phone_number_configuration
(对象),
phone_number_type
(枚举: landline, local, mobile, national, shared_cost, toll_free),
phone_numbers
(对象数组),
porting_phone_numbers_count
(整数),
record_type
(字符串),
requirements
(对象数组),
requirements_met
(布尔值),
status
(对象),
support_key
(字符串 | 空),
updated_at
(日期时间),
user_feedback
(对象),
user_id
(uuid),
webhook_url
(uri)

Submit a porting order.

提交迁入订单

Confirm and submit your porting order.
POST /porting_orders/{id}/actions/confirm
python
response = client.porting_orders.actions.confirm(
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(response.data)
Returns:
activation_settings
(object),
additional_steps
(array[string]),
created_at
(date-time),
customer_group_reference
(string | null),
customer_reference
(string | null),
description
(string),
documents
(object),
end_user
(object),
id
(uuid),
messaging
(object),
misc
(object),
old_service_provider_ocn
(string),
parent_support_key
(string | null),
phone_number_configuration
(object),
phone_number_type
(enum: landline, local, mobile, national, shared_cost, toll_free),
phone_numbers
(array[object]),
porting_phone_numbers_count
(integer),
record_type
(string),
requirements
(array[object]),
requirements_met
(boolean),
status
(object),
support_key
(string | null),
updated_at
(date-time),
user_feedback
(object),
user_id
(uuid),
webhook_url
(uri)
确认并提交你的迁入订单。
POST /porting_orders/{id}/actions/confirm
python
response = client.porting_orders.actions.confirm(
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(response.data)
返回字段:
activation_settings
(对象),
additional_steps
(字符串数组),
created_at
(日期时间),
customer_group_reference
(字符串 | 空),
customer_reference
(字符串 | 空),
description
(字符串),
documents
(对象),
end_user
(对象),
id
(uuid),
messaging
(对象),
misc
(对象),
old_service_provider_ocn
(字符串),
parent_support_key
(字符串 | 空),
phone_number_configuration
(对象),
phone_number_type
(枚举: landline, local, mobile, national, shared_cost, toll_free),
phone_numbers
(对象数组),
porting_phone_numbers_count
(整数),
record_type
(字符串),
requirements
(对象数组),
requirements_met
(布尔值),
status
(对象),
support_key
(字符串 | 空),
updated_at
(日期时间),
user_feedback
(对象),
user_id
(uuid),
webhook_url
(uri)

Share a porting order

共享迁入订单

Creates a sharing token for a porting order. The token can be used to share the porting order with non-Telnyx users.
POST /porting_orders/{id}/actions/share
python
response = client.porting_orders.actions.share(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(response.data)
Returns:
created_at
(date-time),
expires_at
(date-time),
expires_in_seconds
(integer),
id
(uuid),
permissions
(array[string]),
porting_order_id
(uuid),
record_type
(string),
token
(string)
为迁入订单创建共享令牌,该令牌可用于与非Telnyx用户共享迁入订单。
POST /porting_orders/{id}/actions/share
python
response = client.porting_orders.actions.share(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(response.data)
返回字段:
created_at
(日期时间),
expires_at
(日期时间),
expires_in_seconds
(整数),
id
(uuid),
permissions
(字符串数组),
porting_order_id
(uuid),
record_type
(字符串),
token
(字符串)

List all porting activation jobs

列出所有迁入激活任务

Returns a list of your porting activation jobs.
GET /porting_orders/{id}/activation_jobs
python
page = client.porting_orders.activation_jobs.list(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
page = page.data[0]
print(page.id)
Returns:
activate_at
(date-time),
activation_type
(enum: scheduled, on-demand),
activation_windows
(array[object]),
created_at
(date-time),
id
(uuid),
record_type
(string),
status
(enum: created, in-process, completed, failed),
updated_at
(date-time)
返回你的所有迁入激活任务列表。
GET /porting_orders/{id}/activation_jobs
python
page = client.porting_orders.activation_jobs.list(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
page = page.data[0]
print(page.id)
返回字段:
activate_at
(日期时间),
activation_type
(枚举: scheduled, on-demand),
activation_windows
(对象数组),
created_at
(日期时间),
id
(uuid),
record_type
(字符串),
status
(枚举: created, in-process, completed, failed),
updated_at
(日期时间)

Retrieve a porting activation job

查询单个迁入激活任务

Returns a porting activation job.
GET /porting_orders/{id}/activation_jobs/{activationJobId}
python
activation_job = client.porting_orders.activation_jobs.retrieve(
    activation_job_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(activation_job.data)
Returns:
activate_at
(date-time),
activation_type
(enum: scheduled, on-demand),
activation_windows
(array[object]),
created_at
(date-time),
id
(uuid),
record_type
(string),
status
(enum: created, in-process, completed, failed),
updated_at
(date-time)
返回指定迁入激活任务的详情。
GET /porting_orders/{id}/activation_jobs/{activationJobId}
python
activation_job = client.porting_orders.activation_jobs.retrieve(
    activation_job_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(activation_job.data)
返回字段:
activate_at
(日期时间),
activation_type
(枚举: scheduled, on-demand),
activation_windows
(对象数组),
created_at
(日期时间),
id
(uuid),
record_type
(字符串),
status
(枚举: created, in-process, completed, failed),
updated_at
(日期时间)

Update a porting activation job

更新迁入激活任务

Updates the activation time of a porting activation job.
PATCH /porting_orders/{id}/activation_jobs/{activationJobId}
python
activation_job = client.porting_orders.activation_jobs.update(
    activation_job_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(activation_job.data)
Returns:
activate_at
(date-time),
activation_type
(enum: scheduled, on-demand),
activation_windows
(array[object]),
created_at
(date-time),
id
(uuid),
record_type
(string),
status
(enum: created, in-process, completed, failed),
updated_at
(date-time)
更新迁入激活任务的激活时间。
PATCH /porting_orders/{id}/activation_jobs/{activationJobId}
python
activation_job = client.porting_orders.activation_jobs.update(
    activation_job_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(activation_job.data)
返回字段:
activate_at
(日期时间),
activation_type
(枚举: scheduled, on-demand),
activation_windows
(对象数组),
created_at
(日期时间),
id
(uuid),
record_type
(字符串),
status
(枚举: created, in-process, completed, failed),
updated_at
(日期时间)

List additional documents

列出附加文档

Returns a list of additional documents for a porting order.
GET /porting_orders/{id}/additional_documents
python
page = client.porting_orders.additional_documents.list(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
page = page.data[0]
print(page.id)
Returns:
content_type
(string),
created_at
(date-time),
document_id
(uuid),
document_type
(enum: loa, invoice, csr, other),
filename
(string),
id
(uuid),
porting_order_id
(uuid),
record_type
(string),
updated_at
(date-time)
返回迁入订单的所有附加文档列表。
GET /porting_orders/{id}/additional_documents
python
page = client.porting_orders.additional_documents.list(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
page = page.data[0]
print(page.id)
返回字段:
content_type
(字符串),
created_at
(日期时间),
document_id
(uuid),
document_type
(枚举: loa, invoice, csr, other),
filename
(字符串),
id
(uuid),
porting_order_id
(uuid),
record_type
(字符串),
updated_at
(日期时间)

Create a list of additional documents

批量创建附加文档

Creates a list of additional documents for a porting order.
POST /porting_orders/{id}/additional_documents
python
additional_document = client.porting_orders.additional_documents.create(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(additional_document.data)
Returns:
content_type
(string),
created_at
(date-time),
document_id
(uuid),
document_type
(enum: loa, invoice, csr, other),
filename
(string),
id
(uuid),
porting_order_id
(uuid),
record_type
(string),
updated_at
(date-time)
为迁入订单创建一组附加文档。
POST /porting_orders/{id}/additional_documents
python
additional_document = client.porting_orders.additional_documents.create(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(additional_document.data)
返回字段:
content_type
(字符串),
created_at
(日期时间),
document_id
(uuid),
document_type
(枚举: loa, invoice, csr, other),
filename
(字符串),
id
(uuid),
porting_order_id
(uuid),
record_type
(字符串),
updated_at
(日期时间)

Delete an additional document

删除附加文档

Deletes an additional document for a porting order.
DELETE /porting_orders/{id}/additional_documents/{additional_document_id}
python
client.porting_orders.additional_documents.delete(
    additional_document_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
删除迁入订单的指定附加文档。
DELETE /porting_orders/{id}/additional_documents/{additional_document_id}
python
client.porting_orders.additional_documents.delete(
    additional_document_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)

List allowed FOC dates

列出允许的FOC日期

Returns a list of allowed FOC dates for a porting order.
GET /porting_orders/{id}/allowed_foc_windows
python
response = client.porting_orders.retrieve_allowed_foc_windows(
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(response.data)
Returns:
ended_at
(date-time),
record_type
(string),
started_at
(date-time)
返回迁入订单允许的FOC日期列表。
GET /porting_orders/{id}/allowed_foc_windows
python
response = client.porting_orders.retrieve_allowed_foc_windows(
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(response.data)
返回字段:
ended_at
(日期时间),
record_type
(字符串),
started_at
(日期时间)

List all comments of a porting order

列出迁入订单的所有评论

Returns a list of all comments of a porting order.
GET /porting_orders/{id}/comments
python
page = client.porting_orders.comments.list(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
page = page.data[0]
print(page.id)
Returns:
body
(string),
created_at
(date-time),
id
(uuid),
porting_order_id
(uuid),
record_type
(string),
user_type
(enum: admin, user, system)
返回迁入订单的所有评论列表。
GET /porting_orders/{id}/comments
python
page = client.porting_orders.comments.list(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
page = page.data[0]
print(page.id)
返回字段:
body
(字符串),
created_at
(日期时间),
id
(uuid),
porting_order_id
(uuid),
record_type
(字符串),
user_type
(枚举: admin, user, system)

Create a comment for a porting order

为迁入订单创建评论

Creates a new comment for a porting order.
POST /porting_orders/{id}/comments
Optional:
body
(string)
python
comment = client.porting_orders.comments.create(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(comment.data)
Returns:
body
(string),
created_at
(date-time),
id
(uuid),
porting_order_id
(uuid),
record_type
(string),
user_type
(enum: admin, user, system)
为迁入订单创建新评论。
POST /porting_orders/{id}/comments
可选参数:
body
(字符串)
python
comment = client.porting_orders.comments.create(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(comment.data)
返回字段:
body
(字符串),
created_at
(日期时间),
id
(uuid),
porting_order_id
(uuid),
record_type
(字符串),
user_type
(枚举: admin, user, system)

Download a porting order loa template

下载迁入订单LOA模板

GET /porting_orders/{id}/loa_template
python
response = client.porting_orders.retrieve_loa_template(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(response)
content = response.read()
print(content)
GET /porting_orders/{id}/loa_template
python
response = client.porting_orders.retrieve_loa_template(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(response)
content = response.read()
print(content)

List porting order requirements

列出迁入订单要求

Returns a list of all requirements based on country/number type for this porting order.
GET /porting_orders/{id}/requirements
python
page = client.porting_orders.retrieve_requirements(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
page = page.data[0]
print(page.field_type)
Returns:
field_type
(enum: document, textual),
field_value
(string),
record_type
(string),
requirement_status
(string),
requirement_type
(object)
根据该迁入订单的国家/号码类型返回所有要求的列表。
GET /porting_orders/{id}/requirements
python
page = client.porting_orders.retrieve_requirements(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
page = page.data[0]
print(page.field_type)
返回字段:
field_type
(枚举: document, textual),
field_value
(字符串),
record_type
(字符串),
requirement_status
(字符串),
requirement_type
(对象)

Retrieve the associated V1 sub_request_id and port_request_id

查询关联的V1 sub_request_id和port_request_id

GET /porting_orders/{id}/sub_request
python
response = client.porting_orders.retrieve_sub_request(
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(response.data)
Returns:
port_request_id
(string),
sub_request_id
(string)
GET /porting_orders/{id}/sub_request
python
response = client.porting_orders.retrieve_sub_request(
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(response.data)
返回字段:
port_request_id
(字符串),
sub_request_id
(字符串)

List verification codes

列出验证码

Returns a list of verification codes for a porting order.
GET /porting_orders/{id}/verification_codes
python
page = client.porting_orders.verification_codes.list(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
page = page.data[0]
print(page.id)
Returns:
created_at
(date-time),
id
(uuid),
phone_number
(string),
porting_order_id
(uuid),
record_type
(string),
updated_at
(date-time),
verified
(boolean)
返回迁入订单的验证码列表。
GET /porting_orders/{id}/verification_codes
python
page = client.porting_orders.verification_codes.list(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
page = page.data[0]
print(page.id)
返回字段:
created_at
(日期时间),
id
(uuid),
phone_number
(字符串),
porting_order_id
(uuid),
record_type
(字符串),
updated_at
(日期时间),
verified
(布尔值)

Send the verification codes

发送验证码

Send the verification code for all porting phone numbers.
POST /porting_orders/{id}/verification_codes/send
python
client.porting_orders.verification_codes.send(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
为所有迁入的电话号码发送验证码。
POST /porting_orders/{id}/verification_codes/send
python
client.porting_orders.verification_codes.send(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)

Verify the verification code for a list of phone numbers

批量验证电话号码验证码

Verifies the verification code for a list of phone numbers.
POST /porting_orders/{id}/verification_codes/verify
python
response = client.porting_orders.verification_codes.verify(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(response.data)
Returns:
created_at
(date-time),
id
(uuid),
phone_number
(string),
porting_order_id
(uuid),
record_type
(string),
updated_at
(date-time),
verified
(boolean)
验证一组电话号码的验证码。
POST /porting_orders/{id}/verification_codes/verify
python
response = client.porting_orders.verification_codes.verify(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(response.data)
返回字段:
created_at
(日期时间),
id
(uuid),
phone_number
(字符串),
porting_order_id
(uuid),
record_type
(字符串),
updated_at
(日期时间),
verified
(布尔值)

List action requirements for a porting order

列出迁入订单的操作要求

Returns a list of action requirements for a specific porting order.
GET /porting_orders/{porting_order_id}/action_requirements
python
page = client.porting_orders.action_requirements.list(
    porting_order_id="550e8400-e29b-41d4-a716-446655440000",
)
page = page.data[0]
print(page.id)
Returns:
action_type
(string),
action_url
(string | null),
cancel_reason
(string | null),
created_at
(date-time),
id
(string),
porting_order_id
(string),
record_type
(enum: porting_action_requirement),
requirement_type_id
(string),
status
(enum: created, pending, completed, cancelled, failed),
updated_at
(date-time)
返回指定迁入订单的操作要求列表。
GET /porting_orders/{porting_order_id}/action_requirements
python
page = client.porting_orders.action_requirements.list(
    porting_order_id="550e8400-e29b-41d4-a716-446655440000",
)
page = page.data[0]
print(page.id)
返回字段:
action_type
(字符串),
action_url
(字符串 | 空),
cancel_reason
(字符串 | 空),
created_at
(日期时间),
id
(字符串),
porting_order_id
(字符串),
record_type
(枚举: porting_action_requirement),
requirement_type_id
(字符串),
status
(枚举: created, pending, completed, cancelled, failed),
updated_at
(日期时间)

Initiate an action requirement

触发操作要求

Initiates a specific action requirement for a porting order.
POST /porting_orders/{porting_order_id}/action_requirements/{id}/initiate
python
response = client.porting_orders.action_requirements.initiate(
    id="550e8400-e29b-41d4-a716-446655440000",
    porting_order_id="550e8400-e29b-41d4-a716-446655440000",
    params={
        "first_name": "John",
        "last_name": "Doe",
    },
)
print(response.data)
Returns:
action_type
(string),
action_url
(string | null),
cancel_reason
(string | null),
created_at
(date-time),
id
(string),
porting_order_id
(string),
record_type
(enum: porting_action_requirement),
requirement_type_id
(string),
status
(enum: created, pending, completed, cancelled, failed),
updated_at
(date-time)
触发迁入订单的指定操作要求。
POST /porting_orders/{porting_order_id}/action_requirements/{id}/initiate
python
response = client.porting_orders.action_requirements.initiate(
    id="550e8400-e29b-41d4-a716-446655440000",
    porting_order_id="550e8400-e29b-41d4-a716-446655440000",
    params={
        "first_name": "John",
        "last_name": "Doe",
    },
)
print(response.data)
返回字段:
action_type
(字符串),
action_url
(字符串 | 空),
cancel_reason
(字符串 | 空),
created_at
(日期时间),
id
(字符串),
porting_order_id
(字符串),
record_type
(枚举: porting_action_requirement),
requirement_type_id
(字符串),
status
(枚举: created, pending, completed, cancelled, failed),
updated_at
(日期时间)

List all associated phone numbers

列出所有关联电话号码

Returns a list of all associated phone numbers for a porting order. Associated phone numbers are used for partial porting in GB to specify which phone numbers should be kept or disconnected.
GET /porting_orders/{porting_order_id}/associated_phone_numbers
python
page = client.porting_orders.associated_phone_numbers.list(
    porting_order_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
page = page.data[0]
print(page.id)
Returns:
action
(enum: keep, disconnect),
country_code
(string),
created_at
(date-time),
id
(uuid),
phone_number_range
(object),
phone_number_type
(enum: landline, local, mobile, national, shared_cost, toll_free),
porting_order_id
(uuid),
record_type
(string),
updated_at
(date-time)
返回迁入订单的所有关联电话号码列表。关联电话号码用于英国地区的部分迁入,用于指定哪些号码需要保留、哪些需要注销。
GET /porting_orders/{porting_order_id}/associated_phone_numbers
python
page = client.porting_orders.associated_phone_numbers.list(
    porting_order_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
page = page.data[0]
print(page.id)
返回字段:
action
(枚举: keep, disconnect),
country_code
(字符串),
created_at
(日期时间),
id
(uuid),
phone_number_range
(对象),
phone_number_type
(枚举: landline, local, mobile, national, shared_cost, toll_free),
porting_order_id
(uuid),
record_type
(字符串),
updated_at
(日期时间)

Create an associated phone number

创建关联电话号码

Creates a new associated phone number for a porting order. This is used for partial porting in GB to specify which phone numbers should be kept or disconnected.
POST /porting_orders/{porting_order_id}/associated_phone_numbers
python
associated_phone_number = client.porting_orders.associated_phone_numbers.create(
    porting_order_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    action="keep",
    phone_number_range={},
)
print(associated_phone_number.data)
Returns:
action
(enum: keep, disconnect),
country_code
(string),
created_at
(date-time),
id
(uuid),
phone_number_range
(object),
phone_number_type
(enum: landline, local, mobile, national, shared_cost, toll_free),
porting_order_id
(uuid),
record_type
(string),
updated_at
(date-time)
为迁入订单创建新的关联电话号码,用于英国地区的部分迁入,指定哪些号码需要保留、哪些需要注销。
POST /porting_orders/{porting_order_id}/associated_phone_numbers
python
associated_phone_number = client.porting_orders.associated_phone_numbers.create(
    porting_order_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    action="keep",
    phone_number_range={},
)
print(associated_phone_number.data)
返回字段:
action
(枚举: keep, disconnect),
country_code
(字符串),
created_at
(日期时间),
id
(uuid),
phone_number_range
(对象),
phone_number_type
(枚举: landline, local, mobile, national, shared_cost, toll_free),
porting_order_id
(uuid),
record_type
(字符串),
updated_at
(日期时间)

Delete an associated phone number

删除关联电话号码

Deletes an associated phone number from a porting order.
DELETE /porting_orders/{porting_order_id}/associated_phone_numbers/{id}
python
associated_phone_number = client.porting_orders.associated_phone_numbers.delete(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    porting_order_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(associated_phone_number.data)
Returns:
action
(enum: keep, disconnect),
country_code
(string),
created_at
(date-time),
id
(uuid),
phone_number_range
(object),
phone_number_type
(enum: landline, local, mobile, national, shared_cost, toll_free),
porting_order_id
(uuid),
record_type
(string),
updated_at
(date-time)
从迁入订单中删除指定关联电话号码。
DELETE /porting_orders/{porting_order_id}/associated_phone_numbers/{id}
python
associated_phone_number = client.porting_orders.associated_phone_numbers.delete(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    porting_order_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(associated_phone_number.data)
返回字段:
action
(枚举: keep, disconnect),
country_code
(字符串),
created_at
(日期时间),
id
(uuid),
phone_number_range
(对象),
phone_number_type
(枚举: landline, local, mobile, national, shared_cost, toll_free),
porting_order_id
(uuid),
record_type
(字符串),
updated_at
(日期时间)

List all phone number blocks

列出所有号码段

Returns a list of all phone number blocks of a porting order.
GET /porting_orders/{porting_order_id}/phone_number_blocks
python
page = client.porting_orders.phone_number_blocks.list(
    porting_order_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
page = page.data[0]
print(page.id)
Returns:
activation_ranges
(array[object]),
country_code
(string),
created_at
(date-time),
id
(uuid),
phone_number_range
(object),
phone_number_type
(enum: landline, local, mobile, national, shared_cost, toll_free),
record_type
(string),
updated_at
(date-time)
返回迁入订单的所有号码段列表。
GET /porting_orders/{porting_order_id}/phone_number_blocks
python
page = client.porting_orders.phone_number_blocks.list(
    porting_order_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
page = page.data[0]
print(page.id)
返回字段:
activation_ranges
(对象数组),
country_code
(字符串),
created_at
(日期时间),
id
(uuid),
phone_number_range
(对象),
phone_number_type
(枚举: landline, local, mobile, national, shared_cost, toll_free),
record_type
(字符串),
updated_at
(日期时间)

Create a phone number block

创建号码段

Creates a new phone number block.
POST /porting_orders/{porting_order_id}/phone_number_blocks
python
phone_number_block = client.porting_orders.phone_number_blocks.create(
    porting_order_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    activation_ranges=[{
        "end_at": "+4930244999910",
        "start_at": "+4930244999901",
    }],
    phone_number_range={
        "end_at": "+4930244999910",
        "start_at": "+4930244999901",
    },
)
print(phone_number_block.data)
Returns:
activation_ranges
(array[object]),
country_code
(string),
created_at
(date-time),
id
(uuid),
phone_number_range
(object),
phone_number_type
(enum: landline, local, mobile, national, shared_cost, toll_free),
record_type
(string),
updated_at
(date-time)
创建新的号码段。
POST /porting_orders/{porting_order_id}/phone_number_blocks
python
phone_number_block = client.porting_orders.phone_number_blocks.create(
    porting_order_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    activation_ranges=[{
        "end_at": "+4930244999910",
        "start_at": "+4930244999901",
    }],
    phone_number_range={
        "end_at": "+4930244999910",
        "start_at": "+4930244999901",
    },
)
print(phone_number_block.data)
返回字段:
activation_ranges
(对象数组),
country_code
(字符串),
created_at
(日期时间),
id
(uuid),
phone_number_range
(对象),
phone_number_type
(枚举: landline, local, mobile, national, shared_cost, toll_free),
record_type
(字符串),
updated_at
(日期时间)

Delete a phone number block

删除号码段

Deletes a phone number block.
DELETE /porting_orders/{porting_order_id}/phone_number_blocks/{id}
python
phone_number_block = client.porting_orders.phone_number_blocks.delete(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    porting_order_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(phone_number_block.data)
Returns:
activation_ranges
(array[object]),
country_code
(string),
created_at
(date-time),
id
(uuid),
phone_number_range
(object),
phone_number_type
(enum: landline, local, mobile, national, shared_cost, toll_free),
record_type
(string),
updated_at
(date-time)
删除指定号码段。
DELETE /porting_orders/{porting_order_id}/phone_number_blocks/{id}
python
phone_number_block = client.porting_orders.phone_number_blocks.delete(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    porting_order_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(phone_number_block.data)
返回字段:
activation_ranges
(对象数组),
country_code
(字符串),
created_at
(日期时间),
id
(uuid),
phone_number_range
(对象),
phone_number_type
(枚举: landline, local, mobile, national, shared_cost, toll_free),
record_type
(字符串),
updated_at
(日期时间)

List all phone number extensions

列出所有号码分机号

Returns a list of all phone number extensions of a porting order.
GET /porting_orders/{porting_order_id}/phone_number_extensions
python
page = client.porting_orders.phone_number_extensions.list(
    porting_order_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
page = page.data[0]
print(page.id)
Returns:
activation_ranges
(array[object]),
created_at
(date-time),
extension_range
(object),
id
(uuid),
porting_phone_number_id
(uuid),
record_type
(string),
updated_at
(date-time)
返回迁入订单的所有号码分机号列表。
GET /porting_orders/{porting_order_id}/phone_number_extensions
python
page = client.porting_orders.phone_number_extensions.list(
    porting_order_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
page = page.data[0]
print(page.id)
返回字段:
activation_ranges
(对象数组),
created_at
(日期时间),
extension_range
(对象),
id
(uuid),
porting_phone_number_id
(uuid),
record_type
(字符串),
updated_at
(日期时间)

Create a phone number extension

创建号码分机号

Creates a new phone number extension.
POST /porting_orders/{porting_order_id}/phone_number_extensions
python
phone_number_extension = client.porting_orders.phone_number_extensions.create(
    porting_order_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    activation_ranges=[{
        "end_at": 10,
        "start_at": 1,
    }],
    extension_range={
        "end_at": 10,
        "start_at": 1,
    },
    porting_phone_number_id="f24151b6-3389-41d3-8747-7dd8c681e5e2",
)
print(phone_number_extension.data)
Returns:
activation_ranges
(array[object]),
created_at
(date-time),
extension_range
(object),
id
(uuid),
porting_phone_number_id
(uuid),
record_type
(string),
updated_at
(date-time)
创建新的号码分机号。
POST /porting_orders/{porting_order_id}/phone_number_extensions
python
phone_number_extension = client.porting_orders.phone_number_extensions.create(
    porting_order_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    activation_ranges=[{
        "end_at": 10,
        "start_at": 1,
    }],
    extension_range={
        "end_at": 10,
        "start_at": 1,
    },
    porting_phone_number_id="f24151b6-3389-41d3-8747-7dd8c681e5e2",
)
print(phone_number_extension.data)
返回字段:
activation_ranges
(对象数组),
created_at
(日期时间),
extension_range
(对象),
id
(uuid),
porting_phone_number_id
(uuid),
record_type
(字符串),
updated_at
(日期时间)

Delete a phone number extension

删除号码分机号

Deletes a phone number extension.
DELETE /porting_orders/{porting_order_id}/phone_number_extensions/{id}
python
phone_number_extension = client.porting_orders.phone_number_extensions.delete(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    porting_order_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(phone_number_extension.data)
Returns:
activation_ranges
(array[object]),
created_at
(date-time),
extension_range
(object),
id
(uuid),
porting_phone_number_id
(uuid),
record_type
(string),
updated_at
(date-time)
删除指定号码分机号。
DELETE /porting_orders/{porting_order_id}/phone_number_extensions/{id}
python
phone_number_extension = client.porting_orders.phone_number_extensions.delete(
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    porting_order_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(phone_number_extension.data)
返回字段:
activation_ranges
(对象数组),
created_at
(日期时间),
extension_range
(对象),
id
(uuid),
porting_phone_number_id
(uuid),
record_type
(字符串),
updated_at
(日期时间)

List all porting phone numbers

列出所有迁入中号码

Returns a list of your porting phone numbers.
GET /porting_phone_numbers
python
page = client.porting_phone_numbers.list()
page = page.data[0]
print(page.porting_order_id)
Returns:
activation_status
(enum: New, Pending, Conflict, Cancel Pending, Failed, Concurred, Activate RDY, Disconnect Pending, Concurrence Sent, Old, Sending, Active, Cancelled),
phone_number
(string),
phone_number_type
(enum: landline, local, mobile, national, shared_cost, toll_free),
portability_status
(enum: pending, confirmed, provisional),
porting_order_id
(uuid),
porting_order_status
(enum: draft, in-process, submitted, exception, foc-date-confirmed, cancel-pending, ported, cancelled),
record_type
(string),
requirements_status
(enum: requirement-info-pending, requirement-info-under-review, requirement-info-exception, approved),
support_key
(string)
返回你的所有迁入中号码列表。
GET /porting_phone_numbers
python
page = client.porting_phone_numbers.list()
page = page.data[0]
print(page.porting_order_id)
返回字段:
activation_status
(枚举: New, Pending, Conflict, Cancel Pending, Failed, Concurred, Activate RDY, Disconnect Pending, Concurrence Sent, Old, Sending, Active, Cancelled),
phone_number
(字符串),
phone_number_type
(枚举: landline, local, mobile, national, shared_cost, toll_free),
portability_status
(枚举: pending, confirmed, provisional),
porting_order_id
(uuid),
porting_order_status
(枚举: draft, in-process, submitted, exception, foc-date-confirmed, cancel-pending, ported, cancelled),
record_type
(字符串),
requirements_status
(枚举: requirement-info-pending, requirement-info-under-review, requirement-info-exception, approved),
support_key
(字符串)