Updated on 2025-08-19 GMT+08:00

Creating an Endpoint

Function

This API is used to create an endpoint.

Calling Method

For details, see Calling APIs.

URI

POST /v2.1/endpoints

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

The user token.

The token can be obtained by calling an IAM API. The value of X-Subject-Token in the response header is the user token.

For details about how to obtain a user token, seeObtaining a User Token.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Endpoint name.

It can contain 1 to 64 characters. Only letters, digits, underscores (_), hyphens (-), and periods (.) are allowed.

direction

Yes

String

Endpoint direction.

The value can be:

  • inbound: indicates an inbound endpoint.

  • outbound: indicates an outbound endpoint.

region

Yes

String

Region of the subnet

ipaddresses

Yes

Array of IpaddressInfo objects

IP address and subnet of the endpoint. You need to add at least two IP addresses and can add a maximum of six IP addresses.

Table 3 IpaddressInfo

Parameter

Mandatory

Type

Description

subnet_id

Yes

String

Subnet ID

ip

No

String

Custom IP address, which must fall into the subnet

Response Parameters

Status code: 202

Table 4 Response body parameters

Parameter

Type

Description

endpoint

EndpointResp object

Endpoint

Table 5 EndpointResp

Parameter

Type

Description

id

String

Endpoint ID, which is a UUID used to identify the endpoint

name

String

Endpoint name

direction

String

Endpoint direction.

The value can be:

  • inbound: indicates an inbound endpoint.

  • outbound: indicates an outbound endpoint.

status

String

Resource status. The value can be PENDING_CREATE, ACTIVE, PENDING_DELETE, or ERROR.

vpc_id

String

ID of the VPC to which the endpoint belongs.

ipaddress_count

Integer

Number of IP addresses of the endpoint

resolver_rule_count

Integer

Number of endpoint rules in the endpoint

This parameter is returned only for outbound endpoints.

create_time

String

The creation time.

Format: yyyy-MM-dd'T'HH:mm:ss.SSS

update_time

String

The update time.

Format: yyyy-MM-dd'T'HH:mm:ss.SSS

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

code

String

Definition

Error code

Range

N/A

message

String

Definition

Error description

Range

N/A

Status code: 500

Table 7 Response body parameters

Parameter

Type

Description

code

String

Definition

Error code

Range

N/A

message

String

Definition

Error description

Range

N/A

Example Requests

Creating an inbound endpoint, with the subnet ID of IP address 1 to 0463c8a5-fa49-441d-b28b-bc6c35ba04f8 and the custom IP address to 192.168.3.125, and the subnet ID of IP address 2 to 0463c8a5-fa49-441d-b28b-bc6c35ba04f8 and the custom IP address to 192.168.3.126

POST https://{endpoint}/v2.1/endpoints

{
  "name" : "poi-1",
  "direction" : "inbound",
  "region" : "NetworkService",
  "ipaddresses" : [ {
    "subnet_id" : "0463c8a5-fa49-441d-b28b-bc6c35ba04f8",
    "ip" : "192.168.3.125"
  }, {
    "subnet_id" : "0463c8a5-fa49-441d-b28b-bc6c35ba04f8",
    "ip" : "192.168.3.126"
  } ]
}

Example Responses

Status code: 202

Response to the request for creating an endpoint.

{
  "endpoint" : {
    "id" : "ff80808169bf16c70169bf1d02270000",
    "name" : "poi-1",
    "direction" : "inbound",
    "status" : "PENDING_CREATE",
    "vpc_id" : null,
    "ipaddress_count" : 0,
    "resolver_rule_count" : 0,
    "create_time" : "2019-03-27T12:25:43.181",
    "update_time" : "2019-03-27T12:25:43.181"
  }
}

Status Codes

Status Code

Description

202

Response to the request for creating an endpoint.

400

Error response

500

Error response

Error Codes

See Error Codes.