Create an L2 Segment

POST/v1/l2_segments

A new L2 Segment can be created by performing a POST request to /v1/l2_segments. The parameters described below have to be filled in.

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Request Body

application/json

Response Body

application/json

application/json

application/json

curl -X POST "https://example.com/v1/l2_segments" \  -H "Content-Type: application/json" \  -d '{    "name": "name938",    "type": "public",    "location_group_id": 77,    "members": [      {        "id": "xkazxOdJ",        "mode": "native"      },      {        "id": "w9aA9pav",        "mode": "native"      }    ],    "labels": {      "environment": "production",      "service": "my-web-app",      "example.com/project": "my-project",      "example.com/owner": "my-team"    }  }'
{  "id": "J0dNk6eL",  "name": "name939",  "type": "public",  "status": "pending",  "location_group_id": 78,  "location_group_code": "location2039",  "labels": {    "environment": "production",    "service": "my-web-app",    "example.com/project": "my-project",    "example.com/owner": "my-team"  },  "updated_at": "2026-05-28T07:01:17Z",  "created_at": "2026-05-28T07:01:17Z"}
{  "message": "A location group can't be assigned for this set of servers. Please choose hosts within one area.",  "code": "LOCATION_GROUP_ID_MUST_BE_SET"}
{  "message": "Validation failed",  "code": "UNPROCESSABLE_ENTITY",  "errors": {    "members.0": "dedicated server doesn't allow this mode",    "members.1": "dedicated server doesn't allow this mode"  }}