All Products
Search
Document Center

Platform For AI:ListWorkspaces

Last Updated:Apr 23, 2025

Lists all workspaces in a region.

Operation description

You can use the option parameter to specify query options, so as to obtain different information about the workspaces.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • For mandatory resource types, indicate with a prefix of * .
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
paiworkspace:ListWorkspaceslist
*All Resources
*
    none
none

Request syntax

GET /api/v1/workspaces HTTP/1.1

Request parameters

ParameterTypeRequiredDescriptionExample
PageNumberlongNo

The page number of the workspace list. Pages start from page 1. Default value: 1.

1
PageSizeintegerNo

The number of entries to return on each page. Default value: 20.

20
SortBystringNo

Specifies how to sort the results. Default value: GmtCreateTime. Valid values:

  • GmtCreateTime: Sort by the time when created.
  • GmtModifiedTime: Sort by the time when modified.
GmtCreateTime
OrderstringNo

The order of results (ascending or descending). Valid values:

  • ASC: ascending order. This is the default value.
  • DESC: descending order.
ASC
WorkspaceNamestringNo

The name of the workspace.

abc
ModuleListstringNo

The modules, separated by commas (,). Default value: PAI.

PAI
StatusstringNo

The workspace status. Valid values:

  • ENABLED
  • INITIALIZING
  • FAILURE
  • DISABLED
  • FROZEN
  • UPDATING
ENABLED
OptionstringNo

The query options. Valid values:

  • GetWorkspaces (default): Obtains a list of Workspaces.
  • GetResourceLimits: Obtains a list of ResourceLimits.
GetWorkspaces
VerbosebooleanNo

Specifies whether to display workspace details. Valid values:

  • false (default)
  • true
true
FieldsstringNo

The list of returned fields of workspace details. Used to limit the fields in the returned results. Separate multiple fields with commas (,). Currently, only Id is supported, which is the workspace ID.

Id
WorkspaceIdsstringNo

The workspace IDs. Separate multiple IDs by commas (,).

123,234
ResourceGroupIdstringNo

The resource group ID. To obtain the ID of a resource group, see View basic information of a resource group.

rg-acfmwp7rky****

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

RequestIdstring

The request ID.

8D7B2E70-F770-505B-A672-09F1D8F2EC1E
Workspacesarray<object>

The list of workspace details. This list is returned when Option is set to GetWorkspaces.

Workspacesobject

Workspace details.

WorkspaceIdstring

The workspace ID.

123
WorkspaceNamestring

The name of the workspace.

workspace-example
GmtCreateTimestring

The time when the workspace was created. The time (UTC+0) follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ss.SSSZ format.

2021-01-21T17:12:35.232Z
GmtModifiedTimestring

The time when the workspace was modified. The time (UTC+0) follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ss.SSSZ format.

2021-01-21T17:12:35.232Z
Descriptionstring

The description of the workspace.

workspace description example
Creatorstring

The user ID of the creator.

122424353535
EnvTypesarray

The environment types of the workspace.

EnvTypesstring

The environment type of the workspace. Valid values:

  • Workspaces in basic mode can run only in the production environment (prod).
  • Workspaces in standard mode can run in both the development and production environments (dev and prod).
prod
Statusstring

The status of the workspace.

ENABLED
AdminNamesarray

The names of the administrator accounts.

AdminNamesstring

The name of the administrator account.

demo_test@***.aliyunid.com
IsDefaultboolean

Indicates whether the workspace is the default workspace.

false
ExtraInfosobject

the additional information. Only contains TenantId.

{"TenantId": "4286******98"}
resourceGroupIdstring

The resource group ID.

rg-acfmwp7rky****
TotalCountlong

The number of workspaces that meet the query conditions.

1
ResourceLimitsobject

The type and quantity of resources that can be activated in a workspace. This list is returned when the Option is set to GetResourceLimits. Valid values:

  • MaxCompute_share: pay-as-you-go MaxCompute
  • MaxCompute_isolate: subscription MaxCompute
  • DLC_share: pay-as-you-go DLC
  • PAI_Isolate: subscription PAI
  • PAI_share: pay-as-you-go PAI
  • DataWorks_isolate: subscription DataWorks
  • DataWorks_share: pay-as-you-go DataWorks
{ "MaxCompute_share": 1, "MaxCompute_isolate": 1, "DLC_share": 1 }

Examples

Sample success responses

JSONformat

{
  "RequestId": "8D7B2E70-F770-505B-A672-09F1D8F2EC1E",
  "Workspaces": [
    {
      "WorkspaceId": "123",
      "WorkspaceName": "workspace-example",
      "GmtCreateTime": "2021-01-21T17:12:35.232Z",
      "GmtModifiedTime": "2021-01-21T17:12:35.232Z",
      "Description": "workspace description example",
      "Creator": "122424353535",
      "EnvTypes": [
        "prod"
      ],
      "Status": "ENABLED",
      "AdminNames": [
        "demo_test@***.aliyunid.com"
      ],
      "IsDefault": false,
      "ExtraInfos": {
        "TenantId": "4286******98"
      },
      "resourceGroupId": "rg-acfmwp7rky****"
    }
  ],
  "TotalCount": 1,
  "ResourceLimits": {
    "MaxCompute_share": 1,
    "MaxCompute_isolate": 1,
    "DLC_share": 1
  }
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2025-01-23The request parameters of the API has changed. The response structure of the API has changedView Change Details
2021-03-02The response structure of the API has changedView Change Details
2021-03-02The request parameters of the API has changedView Change Details
2021-03-02The response structure of the API has changedView Change Details