Updated on 2025-10-09 GMT+08:00

Enabling Anti-DDoS

Function

This API is used to enable Anti-DDoS.

Calling Method

For details, see Calling APIs.

URI

POST /v1/{project_id}/antiddos/{floating_ip_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

floating_ip_id

Yes

String

ID corresponding to the EIP of a user.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Content-Type

Yes

String

Content-Type request header.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

app_type_id

Yes

Long

Application type ID. The value is fixed to 0.

cleaning_access_pos_id

Yes

Long

Position ID of access limit during cleaning. The options are as follows: 1: 10 Mbit/s; 2: 30 Mbit/s; 3: 50 Mbit/s; 4: 70 Mbit/s; 5: 100 Mbit/s; 6: 150 Mbit/s; 7: 200 Mbit/s; 8: 250 Mbit/s; 9: 300 Mbit/s; 10: 500 Mbit/s; 11: 800 Mbit/s;88: 1,000 Mbit/s; 99: default protection

enable_L7

Yes

Boolean

Whether to enable layer-7 protection. The value is fixed to false.

http_request_pos_id

Yes

Long

Segment ID of the HTTP request counts. The value is fixed to 1.

traffic_pos_id

Yes

Long

Position ID of traffic. The options are as follows: 1: 10 Mbit/s; 2: 30 Mbit/s; 3: 50 Mbit/s; 4: 70 Mbit/s; 5: 100 Mbit/s; 6: 150 Mbit/s; 7: 200 Mbit/s; 8: 250 Mbit/s; 9: 300 Mbit/s; 10: 500 Mbit/s; 11: 800 Mbit/s;88: 1,000 Mbit/s; 99: default protection

antiddos_config_id

No

String

Protection level ID.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

error_code

String

Internal error code.

error_msg

String

Internal error description.

task_id

String

ID of a task. This ID can be used to query the status of the task.

This field is reserved for future task audit extension and is not required currently.

Example Requests

Enable the Anti-DDoS policy for a specified EIP. Set the position ID of access limit during cleaning to 8, and set the position ID of traffic to 1.

POST https://{endpoint}/v1/{project_id}/antiddos/{floating_ip_id}

{
  "app_type_id" : 0,
  "cleaning_access_pos_id" : 8,
  "enable_L7" : false,
  "http_request_pos_id" : 1,
  "traffic_pos_id" : 1,
  "antiddos_config_name" : "test",
  "antiddos_config_id" : "1234567890"
}

Example Responses

Status code: 200

Request succeeded.

{
  "error_code" : "10000000",
  "error_msg" : "The task has been received and is being handled",
  "task_id" : "59385d2a-6266-4d3a-9122-a228c530f557"
}

Status Codes

Status Code

Description

200

Request succeeded.

Error Codes

See Error Codes.