Cloud Diversion
Cloud Diversion
Overview
Cloud Diversion OpenAPI provides Site and Network Group discovery, atomic Policy updates, and manual divert operations for individual networks in the authenticated customer’s Origin Protection resources.
Supported Policy modes depend on the resource:
| Resource | Detection OFF | Detection ON |
|---|---|---|
| Site | off |
monitor, auto_divert |
| Network Group with Custom enabled | off, divert |
monitor, auto_divert |
Site Policy does not support manual divert. When Network Group Custom is off, the parent Site Policy applies and the Group’s saved Policy is retained.
Version information
Version : 1.0.0.BETA
URI scheme
Host : {your_basic_domain} BasePath : /api Schemes : HTTPS
Paths
List Cloud Diversion sites.
GET /specp/common/diversion/sites
Description
Returns only Origin Protection Sites that have joined Cloud Diversion. Results use one address family per response, have a fixed ascending creation-time and stable-ID order, and can be filtered by an exact canonical Protected Network CIDR. The response never includes an internal goa_site_id or a Site CIDR collection.
Parameters
| Type | Name | Description | Schema |
|---|---|---|---|
| Query | access_token required |
Access token used to authenticate your access to the API. | string |
| Query | page | Page number, starting from 1. Default: 1. |
integer |
| Query | page_size | Items per page. Default: 20; maximum: 100. |
integer |
| Query | ip_version | ipv4 (default) or ipv6. A response never mixes address families. |
string |
| Query | cidr | Optional canonical Protected Network CIDR. It is an exact member match and must use the selected address family. | string |
Responses
| HTTP Code | Description | Schema |
|---|---|---|
| 200 | Response sent when the API is successfully invoked. No match and a page beyond the final page return an empty items array. |
Cloud Diversion Site List Result |
Cloud Diversion Site List Result
| Name | Description | Schema |
|---|---|---|
| code | 0 means success. Invalid pagination, CIDR, or address-family combinations use the standard parameter error code. |
integer |
| msg | Response message. | string |
| result.items | Cloud Diversion Site items. | < Site item > array |
| result.page | Current page. | integer |
| result.page_size | Applied page size. | integer |
| result.total | Total matching Sites. | integer |
| result.total_pages | Total matching pages. 0 when no Site matches. |
integer |
Site item
| Name | Description | Schema |
|---|---|---|
| site_id | Public Origin Protection Site ID reused by Cloud Diversion. | string |
| site_name | Site name. | string |
| ip_version | ipv4 or ipv6. |
string |
| policy.detection_enabled | Detection state. | boolean |
| policy.diversion_mode | off, monitor, or auto_divert. |
string |
| policy.detection_template, policy.off_net_route_template, policy.on_net_route_template, policy.peer_group | Read-only supporting configuration reference: opaque string id and name. An unconfigured reference is null; a deleted reference keeps its id and returns name: null. |
object |
| policy.diversion_scope | off_net, on_net, or off_net_and_on_net. |
string |
Success example
{
"code": 0,
"msg": "Success.",
"result": {
"items": [
{
"site_id": "b6c9bcffa5685971",
"site_name": "production",
"ip_version": "ipv4",
"policy": {
"detection_enabled": true,
"diversion_mode": "auto_divert",
"detection_template": {"id": "123", "name": "Default Detection"},
"diversion_scope": "off_net",
"off_net_route_template": null,
"on_net_route_template": null,
"peer_group": null
}
}
],
"page": 1,
"page_size": 20,
"total": 1,
"total_pages": 1
}
}
Notes
- Customer identity comes from the access token; do not provide
customer_id. - Omitting
ip_versionuses IPv4. An IPv6 CIDR therefore requiresip_version=ipv6. - CIDR matching is exact after normalization. It does not match a parent, child, or contained IP address.
- Supporting configuration IDs are opaque strings and must not be treated as numbers.
List Cloud Diversion Network Groups.
GET /specp/common/diversion/sites/{site_id}/network-groups
Returns Network Groups nested under an owned public Site ID. Results use fixed ascending creation-time and opaque-ID ordering with page (default 1) and page_size (default 20, maximum 100). cidr is normalized by the service and matched only against an exact Protected Network member. Its address family is determined by the parent Site, so this endpoint does not accept ip_version. No match and a page past the end return a successful empty items array.
Each item contains opaque string network_group_id, name, description, boolean custom_enabled, normalized networks, and network_count. Networks are the only member representation returned: internal Network IDs and Network-level Policy fields are not exposed.
policy is always the Network Group’s own saved Policy, even when custom_enabled is false. It has the same fields and supporting-configuration semantics as a Site Policy: opaque string IDs, null for an unconfigured reference, and name: null when a saved reference was deleted. This endpoint never returns custom_policy, effective_policy, or effective_policy_source; read the parent Site to determine inherited behavior.
The saved Network Group policy.diversion_mode supports off, divert, monitor, and auto_divert, including when Custom is off. Site Policy supports only off, monitor, and auto_divert.
{"code":0,"msg":"Success.","result":{"items":[{"network_group_id":"201887692295201","name":"production","description":"Production networks","custom_enabled":false,"policy":{"detection_enabled":true,"diversion_mode":"auto_divert","detection_template":null,"diversion_scope":"off_net","off_net_route_template":null,"on_net_route_template":null,"peer_group":null},"networks":["203.0.113.0/24"],"network_count":1}],"page":1,"page_size":20,"total":1,"total_pages":1}}
Atomically update a Cloud Diversion Site Policy.
POST /specp/common/diversion/sites/{site_id}/policy
Uses application/json and accepts only detection_enabled (JSON boolean) and diversion_mode (off, monitor, or auto_divert). The body cannot be empty; null, unknown fields, string/number booleans, and invalid enums are rejected. Supplying detection_enabled requires diversion_mode; diversion_mode alone is allowed only when compatible with the current Detection state.
Site targets are limited to Detection OFF + off, or Detection ON + monitor/auto_divert. Saved Detection Template, Diversion Scope, Route Template and Peer Group references are retained and validated. A repeated target succeeds without another downstream operation or audit record.
{"detection_enabled": true, "diversion_mode": "monitor"}
Success returns { "code": 0, "msg": "Success.", "result": null }. It means the configuration was accepted and saved, not that traffic switching has completed; no operation ID or transition status is returned. Business errors use HTTP 200 with a nonzero code; malformed request values use 40058603; unavailable or invalid upstream responses use 502 with msg: "upstream_unavailable".
Atomically update a Cloud Diversion Network Group Policy.
POST /specp/common/diversion/sites/{site_id}/network-groups/{network_group_id}/policy
Uses application/json and accepts only custom_enabled, detection_enabled (both JSON booleans), and diversion_mode (off, divert, monitor, or auto_divert). The body cannot be empty; null, unknown fields, string/number booleans, and invalid enums are rejected. Supplying detection_enabled requires diversion_mode; diversion_mode alone is allowed only when compatible with the current Detection state.
Customer identity comes from the access token. The App verifies that the Customer owns the public site_id, that the opaque network_group_id exists, and that the Network Group belongs to that Site before any write.
With Custom enabled, valid targets are Detection OFF + off/divert, or Detection ON + monitor/auto_divert. Turning Custom off accepts only custom_enabled, preserves the Network Group’s saved Policy, and makes the parent Site Policy effective. While Custom remains off, Detection and Diversion Mode cannot be modified. Turning Custom on restores the saved Policy; the same request may include a legal Detection/Diversion target.
Saved Detection Template, Diversion Scope, Route Template, and Peer Group references are retained and validated. A repeated target succeeds without another Network operation or audit record. Actual changes retain Network-level audit entries with actor openapi and source customer_api.
{"custom_enabled": true, "detection_enabled": false, "diversion_mode": "divert"}
Success returns { "code": 0, "msg": "Success.", "result": null }. It means the configuration was accepted and saved, not that traffic switching has completed; no operation ID or transition status is returned. Business errors use HTTP 200 with a nonzero code; malformed request values use 40058603; unavailable or invalid upstream responses use 502 with msg: "upstream_unavailable".
Start manual divert for a network.
POST /specp/common/diversion/divert
Description
Starts manual divert for one Origin Protection network owned by the authenticated customer. The network must be an IPv4 /24 or IPv6 /48 network CIDR. Valid IPv6 input is normalized to lowercase compressed form. The request enters the Cloud Diversion workflow asynchronously.
Parameters
| Type | Name | Description | Schema |
|---|---|---|---|
| Query | access_token required |
Access token used to authenticate your access to the API. | string |
| FormData | network required |
IPv4 /24 or IPv6 /48 network CIDR, for example 203.0.113.0/24 or 2001:db8:1234::/48. |
string |
Consumes
multipart/form-data
Request example
# IPv4
network=203.0.113.0/24
# IPv6
network=2001:0DB8:1234:0000:0000:0000:0000:0000/48
Responses
| HTTP Code | Description | Schema |
|---|---|---|
| 200 | Response sent when the API is successfully invoked. | Cloud Diversion Result |
Stop active divert for a network.
POST /specp/common/diversion/divert/stop
Description
Stops the active divert for one Origin Protection network owned by the authenticated customer. Manual divert follows the existing Cloud Diversion policy stop behavior. Auto divert stops the current ongoing event only and does not disable Auto Divert or Auto Monitor configuration.
Parameters
| Type | Name | Description | Schema |
|---|---|---|---|
| Query | access_token required |
Access token used to authenticate your access to the API. | string |
| FormData | network required |
IPv4 /24 or IPv6 /48 network CIDR, for example 203.0.113.0/24 or 2001:db8:1234::/48. |
string |
Consumes
multipart/form-data
Request example
# IPv4
network=203.0.113.0/24
# IPv6
network=2001:db8:1234::/48
Responses
| HTTP Code | Description | Schema |
|---|---|---|
| 200 | Response sent when the API is successfully invoked. | Cloud Diversion Result |
Get divert status for a network.
GET /specp/common/diversion/divert/status?network=203.0.113.0/24
GET /specp/common/diversion/divert/status?network=2001:db8:1234::/48
Description
Returns the current manual or auto divert status for one Origin Protection network owned by the authenticated customer.
Parameters
| Type | Name | Description | Schema |
|---|---|---|---|
| Query | access_token required |
Access token used to authenticate your access to the API. | string |
| Query | network required |
IPv4 /24 or IPv6 /48 network CIDR, for example 203.0.113.0/24 or 2001:db8:1234::/48. |
string |
Responses
| HTTP Code | Description | Schema |
|---|---|---|
| 200 | Response sent when the API is successfully invoked. | Cloud Diversion Result |
Cloud Diversion Result
| Name | Description | Schema |
|---|---|---|
| code | 0 means success. Non-zero values indicate validation, permission, ownership, or Cloud Diversion workflow errors. |
integer |
| msg | Response message. | string |
| result.network | Normalized IPv4 /24 or IPv6 /48 network CIDR. |
string |
| result.status | Current divert status returned by the status API. Possible values include manual_in_progress, auto_in_progress, and inactive. |
string |
IPv6 start or stop success example
{
"code": 0,
"msg": "Success.",
"result": {
"network": "2001:db8:1234::/48"
}
}
IPv6 status success example
{
"code": 0,
"msg": "Success.",
"result": {
"network": "2001:db8:1234::/48",
"status": "auto_in_progress"
}
}
Stop no active divert example
{
"code": 0,
"msg": "No active divert."
}
Error example
{
"code": 40058603,
"msg": "network must be canonical IPv4 /24 or IPv6 /48 CIDR."
}
Error Codes
| Code | Description |
|---|---|
40058603 |
Request parameter error, including unsupported masks, host bits, or invalid IPv4 /24 and IPv6 /48 CIDRs. |
502 |
Cloud Diversion App is unavailable or returned an invalid response. msg is upstream_unavailable. |
500633 |
Cloud Diversion App internal token validation failed. |
500701 |
Invalid customer ID. |
500702 |
Invalid network. Only IPv4 /24 and IPv6 /48 network CIDRs are supported. |
500703 |
Network not found under the authenticated customer. |
500704 |
More than one matching network exists under the authenticated customer. |
500705 |
Precondition failed. For example, the network is not using custom policy. |
500030, 500031, 500032, 500034-500037, 500039, 500130 |
Cloud Diversion policy switch validation failed. See msg for the exact reason. |
Notes
- Customer API uses the authenticated customer identity; do not pass
customer_id. - Only IPv4
/24and IPv6/48network CIDR values are supported. IPv6 input may use compressed or expanded notation and is returned in lowercase compressed form. - The CIDR must belong to the authenticated customer. Requests for CIDRs outside the customer scope are rejected without exposing other customer resources.
- Start requires the target network to use custom policy.
- Start switches the target network to manual divert and sets detection mode to off.
- Stop switches manual divert to off. For Auto Divert or Auto Monitor events, stop only ends the current ongoing event and does not disable Auto Divert or Auto Monitor configuration.
- The API does not support
operation_idoridempotency_keyin this version. - A successful start response means the request has entered the Cloud Diversion control workflow; it does not guarantee immediate route convergence. Use the status API or event list to confirm the current divert state.