Get the App ID and Workspace ID

Updated at:

When calling Model Studio apps, such as Agent and Workflow , via an API, you must provide credentials to identify the target app and its workspace:

  • The application is located in the default workspace; you only need to provide the APP ID.
  • The application is located in a sub-workspace; you must provide both the APP ID and Workspace ID.

This document describes how to obtain these credentials: the APP ID can be obtained from the console; the Workspace ID can be queried via the console, Model Studio CLI, or OpenAPI. For more information about workspaces, see Workspace permission management.

Get the App ID

When calling any application via API, you must provide its unique APP ID.

  1. Go to the My Applications page;
  2. Find the target application in the application list and copy its APP ID.

Obtain Workspace ID

The Workspace ID is the unique identifier of a workspace. The Workspace ID must be included in API requests only when you call applications in a sub-workspace, or models in the Germany (Frankfurt), China (Beijing), Singapore, Hong Kong (China), or Japan (Tokyo) regions. The Workspace ID is part of the Base URL of these regions.

Obtain the current workspace ID

Use this to quickly find the ID of the workspace you are currently logged in to and using.

  1. Visit the Alibaba Cloud Model Studio console homepage and select the target region;
  2. Then click theimageicon in the upper-right corner of the page;
  3. In the dialog box that appears, you can view and copy the Workspace ID.

By default, a RAM sub-account can only view the IDs of the workspaces it has joined.

Query all workspace IDs

This applies to scenarios where you need to query or manage all workspaces under the Alibaba Cloud account. The following three methods are supported:

Method 1: Query via the console

  1. Log in to the Alibaba Cloud Model Studio console with the Alibaba Cloud account or an authorized sub-account;
  2. Click theimageicon in the upper-right corner to go to the Workspaces page;
  3. In the Workspace ID column, view and copy the ID of the required workspace.

ImportantThis operation requires a main account or a RAM sub-account with the AliyunBailianFullAccess or AliyunBailianControlFullAccess permission. If you lack the required permissions, the console displays an insufficient permissions error when you try to access the page. For information about how to grant permissions, see Manage Permissions.

Method 2: Query via the Model Studio CLI

First complete Model Studio CLI installation and authentication, then run the following command to list the names, Workspace IDs, and default workspace indicators of all workspaces under the current account:

bl workspace list

Sample output:

Name              Workspace ID          Default
─────────────────────────────────────────────────
默认业务空间       llm-xxxxxxxxxxxxxxxx  Yes
marketing         ws-xxxxxxxxxxxxxxxx   -

For command parameter descriptions, see Model Studio CLI configuration and tools.

Method 3: Query via OpenAPI

Call the ListWorkspaces API of ModelStudio to query all workspaces under the account, which returns information such as workspace IDs, names, and regions. Use the AccessKey of an Alibaba Cloud account or a RAM user to make the call. The RAM user must have the AliyunBailianFullAccess system policy or a custom policy that includes the modelstudio:ListWorkspaces permission (the RAM permissions for OpenAPI are independent of the Super Admin role required for workspace management in the console).

For API details and online debugging, see the ListWorkspaces API documentation.

Next steps

After you obtain the credentials, refer to the Workflow and Legacy Agent Application API DashScope API Reference or Responses API documentation to build and send API requests.

FAQ

Q: Why do I get an error when I try to access the "Workspace Management" page as a RAM sub-account?

A: Access to this page requires super administrator permissions. You must be designated as a super administrator to view it.