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

Querying a Workspace List

Function

This API is used to obtain the details of all created workspaces.

This API applies to the following scenario: When you need to view all available workspaces or perform audit, you can use this API to query the workspace list. Before using this API, ensure that you have the view permission. After the query is complete, the system returns all workspace details, including the name, creation time, and status. If you do not have the permission to perform operations, the API will return an error message.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

URI

GET /v1/{project_id}/workspaces

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition: Project ID. For details, see Obtaining a Project ID and Name.

Constraints: The value can contain 1 to 64 characters. Letters, digits, and hyphens (-) are allowed.

Range: N/A

Default Value: N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

offset

No

Integer

Definition:

Start page of the pagination list

Constraints:

N/A

Range:

The value must no less than 0 and no more than 2147483647.

Default Value:

0

limit

No

Integer

Definition:

Maximum number of records displayed on each page

Constraints:

N/A

Range:

The value must no less than 1 and no more than 1000.

Default Value:

1000

sort_by

No

String

Definition:

Sorting field

Constraints:

N/A

Range:

  • name: workspace name

  • update_time: last modification time, in UTC format

  • status: workspace status

Default Value:

name

order

No

String

Definition:

Sorting mode

Constraints:

N/A

Range:

  • asc: ascending order

  • desc: descending order

Default Value:

desc

enterprise_project_id

No

String

Definition:

Enterprise project ID. If this parameter is specified, only the workspaces of the enterprise project are returned. By default, all workspaces are displayed.

Constraints:

N/A

Range:

The value can contain 36 characters. Letters, digits, and hyphens (-) are allowed.

Default Value:

N/A

name

No

String

Definition:

Workspace name. If this parameter is specified, the fuzzy-match workspaces are queried. By default, all workspaces are displayed.

Constraints:

N/A

Range:

The value can contain 1 to 64 characters. Letters, digits, hyphens (-), and underscores (_) are allowed.

Default Value:

N/A

filter_accessible

No

Boolean

Definition:

Whether accessible workspaces are filtered

Constraints:

N/A

Range:

  • false: All workspaces are displayed.

  • true: Workspaces that the current user does not have permission to access are filtered.

Default Value: false

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition:

Requests for calling an API can be authenticated using either a token or AK/SK. If token-based authentication is used, this parameter is mandatory and must be set to a user token. For details, see Obtaining a User Token.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

total_count

Integer

Definition:

Total number of workspaces.

Range:

N/A

count

Integer

Definition:

Number of workspaces returned for the current request.

Range:

The value must be no less than 0 and no more than the value of limit.

workspaces

Array of WorkspaceResponse objects

Definition:

workspace parameters.

Table 5 WorkspaceResponse

Parameter

Type

Description

owner

String

Definition:

Creator name

Range:

The value can contain 4 to 64 characters. Letters, digits, hyphens (-), and underscores (_) are allowed.

auth_type

String

Definition:

Authorization type

Range:

  • PUBLIC: accessible to tenants

  • PRIVATE: accessible only to the creator and primary account

  • INTERNAL: accessible to the creator, primary account, and specified IAM users. This parameter must be used together with grants.

enterprise_project_id

String

Definition:

Enterprise project ID

Range:

ID of an enabled enterprise project. The value contains 36 characters. Letters, digits, and hyphens (-) are allowed.

update_time

Integer

Definition:

Last modification time, in UTC format

Range:

N/A

create_time

Integer

Definition:

Creation time, in UTC format

Range:

N/A

enterprise_project_name

String

Definition:

Enterprise project name

Range:

Name of the enterprise project corresponding to the response parameter enterprise_project_id

name

String

Definition:

Workspace name

Range:

The value can contain 4 to 64 characters. Letters, digits, hyphens (-), and underscores (_) are allowed.

description

String

Definition:

Workspace description

Range:

The value can contain 0 to 256 characters. It cannot contain the following special characters: < > = & " ' /

id

String

Definition:

Workspace ID. For details about how to obtain the ID, see Querying the Workspace List.

Range:

It is a 32-bit UUID without hyphens (-). The ID of the default workspace is 0.

status

String

Definition:

Workspace status

Range:

  • CREATE_FAILED: The workspace creation fails.

  • NORMAL: The workspace is running properly.

  • DELETING: The workspace is being deleted.

  • DELETE_FAILED: Deleting the workspace failed.

status_info

String

Definition:

Status description. By default, this parameter is left blank. This parameter is used to show detailed information about a status. If a deletion failed, you can use this parameter to obtain the failure cause.

Range:

N/A

Example Requests

Filtering the records whose enterprise project ID is 0, sorting the records by name in descending order, and obtaining a record on the fourth page in pagination mode

GET https://{endpoint}/v1/{project_id}/workspaces?limit=1&offset=3&sort_by=name&order=desc&enterprise_project_id=0

Example Responses

Status code: 200

Response parameter indicating that workspaces are obtained

{
  "total_count" : 1,
  "count" : 1,
  "workspaces" : [ {
    "id" : 0,
    "name" : "default",
    "description" : "",
    "owner" : "testUser",
    "enterprise_project_id" : "***b0091-887f-4839-9929-cbc884f1e***",
    "enterprise_project_name" : "default",
    "auth_type" : "public",
    "create_time" : 1460000010000,
    "update_time" : 1460000010000,
    "status" : "NORMAL",
    "status_info" : ""
  } ]
}

Status Codes

Status Code

Description

200

Response parameter indicating that workspaces are obtained

Error Codes

See Error Codes.