Updated on 2025-07-04 GMT+08:00

Creating a Workspace

Function

Before using the baseline inspection, alert management, security analysis, and security orchestration in SecMaster, you need to create at least one workspace first. You can use workspaces to group your resources by application scenario. This will make security operations more efficient.

Calling Method

For details, see Calling APIs.

URI

POST /v1/{project_id}/workspaces

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

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

application/json;charset=UTF-8

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

region_id

Yes

String

Region ID.

enterprise_project_id

No

String

Enterprise project ID.

enterprise_project_name

No

String

Enterprise project name.

view_bind_id

No

String

ID of the workspace associated with the view.

is_view

No

Boolean

Whether the workspace is a workspace view.

name

Yes

String

Workspace name.

description

No

String

Workspace description.

project_name

Yes

String

Project name.

tags

No

Array of TagsPojo objects

Adding a Tag to Arrays

Table 4 TagsPojo

Parameter

Mandatory

Type

Description

key

No

String

Tag key.

value

No

String

Tag value.

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

id

String

Workspace ID.

create_time

String

Creation time.

update_time

String

Update time.

name

String

Workspace name.

description

String

Workspace description.

creator_id

String

Creator ID.

creator_name

String

Creator name.

modifier_id

String

Modifier ID.

modifier_name

String

Modifier name.

project_id

String

Project ID.

project_name

String

Project name.

domain_id

String

Tenant ID.

domain_name

String

Tenant name.

enterprise_project_id

String

Enterprise project ID.

enterprise_project_name

String

Enterprise project name.

is_view

Boolean

Whether the workspace is a workspace view.

region_id

String

Region ID.

view_bind_id

String

ID of the workspace associated with the view.

view_bind_name

String

Name of the workspace associated with the view.

workspace_agency_list

Array of workspace_agency_list objects

The list of managed workspaces.

Table 6 workspace_agency_list

Parameter

Type

Description

project_id

String

ID of the project the workspace agency belongs to.

id

String

Workspace agency ID.

name

String

Workspace agency name.

region_id

String

ID of the region the workspace agency belongs to.

workspace_attribution

String

THIS_ACCOUNT: The workspace belongs to the current account; CROSS_ACCOUNT: The workspace is accessible across different accounts.

agency_version

String

Agency version.

domain_id

String

ID of the delegation account.

domain_name

String

Name of the delegation account.

iam_agency_id

String

IAM agency ID.

iam_agency_name

String

IAM agency name.

resource_spec_code

Array of strings

Workspace agency edition.

selected

Boolean

Whether the workspace is selected for an agency view.

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 500

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Example Requests

Request body for creating a workspace.

{
  "name" : "My Workspaces",
  "region_id" : "region_id",
  "project_name" : "project_name",
  "enterprise_project_id" : "",
  "enterprise_project_name" : "",
  "tags" : [ {
    "key" : "tag1",
    "value" : "value1"
  } ],
  "description" : "My Workspaces"
}

Example Responses

Status code: 200

Request succeeded.

{
  "create_time" : "2024-07-02T09:25:17Z+0800",
  "creator_id" : "b4*****************************46a",
  "creator_name" : "l0******",
  "description" : "My Workspaces",
  "domain_id" : "ac*****************************bf4",
  "domain_name" : "scc****09",
  "enterprise_project_id" : "",
  "enterprise_project_name" : "",
  "id" : "39*************bf",
  "is_view" : false,
  "modifier_id" : "",
  "modifier_name" : "",
  "name" : "My Workspaces",
  "project_id" : "15**************************da6",
  "project_name" : "project_name",
  "region_id" : "region_id",
  "update_time" : "2024-07-02T09:25:17Z+0800",
  "view_bind_id" : "",
  "view_bind_name" : "",
  "workspace_agency_list" : [ ]
}

Status Codes

Status Code

Description

200

Request succeeded.

400

Invalid request parameter.

500

Request failed.

Error Codes

See Error Codes.