Help Center/ ModelArts/ API Reference/ Use Cases/ Creating and Modifying a Workspace
Updated on 2026-06-03 GMT+08:00

Creating and Modifying a Workspace

This section describes how to create and modify a workspace by calling ModelArts APIs.

Overview

The process of creating and modifying a workspace is as follows:

  1. Call the authentication API to obtain the user token, which will be added in the request header for authentication.
  2. Call the API for creating a workspace to create a workspace.
  3. Call the API for obtaining workspace details to obtain workspace details based on the workspace ID.
  4. Call the API for modifying a workspace to modify the workspace information including its name, description, and authorization based on the workspace ID.
  5. Call the API for deleting a workspace to delete the workspace if it is not needed.

Prerequisites

Procedure

  1. Call the API for authentication to obtain a user token.
    1. Request body:

      URI: POST https://{iam_endpoint}/v3/auth/tokens

      Request header: Content-Type → application/json

      Request body:
      {
        "auth": {
          "identity": {
            "methods": ["password"],
            "password": {
              "user": {
                "name": "user_name", 
                "password": "user_password",
                "domain": {
                  "name": "domain_name"
                }
              }
            }
          },
          "scope": {
            "project": {
              "name": "ap-southeast-1"
            }
          }
        }
      }
      Set the following parameters based on site requirements:
      • iam_endpoint: IAM endpoint
      • user_name: IAM username
      • user_password: login password of the user
      • domain_name: account to which the user belongs
      • ap-southeast-1: Project name, which is the region where ModelArts is deployed
    2. Status code 201 Created is returned. The X-Subject-Token value in the response header is the token.
      x-subject-token →MIIZmgYJKoZIhvcNAQcCoIIZizCCGYcCAQExDTALBglghkgBZQMEAgEwgXXXXXX...
  2. Call the API for creating a workspace to create a workspace.
    1. Request body:

      URI: POST https://{endpoint}/v1/{project_id}/workspaces

      Request header:

      • X-auth-Token →MIIZmgYJKoZIhvcNAQcCoIIZizCCGYcCAQExDTALBglghkgBZQMEAgEwgXXXXXX...
      • Content-Type →application/json

      Request body:

      {
      	"name": "test_workspace",
      	"description": "It is my workspace",
      	"enterprise_project_id": "0",
      	"auth_type": "PUBLIC",
      	"grants": [
      		{
      		"user_id": "aa7efa8801024da08a7fa92dc0******",
      		"user_name": ""
      		}
      		]
      }
      Set the following parameters based on site requirements:
      • endpoint: ModelArts endpoint
      • project_id: your project ID
      • X-auth-Token: token obtained in the previous step
      • user_id: user ID
    2. Status code 200 OK is returned. The response body is as follows:
      {
          "id": "f3deca1406da4910a50f3919940b9bda",
          "name": "test_workspace",
          "description": "It is my workspace",
          "owner": "test166",
          "create_time": 1625453558000,
          "update_time": 1625453558000,
          "enterprise_project_id": "0",
          "enterprise_project_name": "default",
          "auth_type": "public",
          "status": "NORMAL",
          "status_info": ""
      }

      Set id to the ID of the created workspace. Record the value for subsequent operations.

  3. Call the API for obtaining workspace details to obtain workspace details based on the workspace ID.
    1. Request body:

      URI: GET https://{endpoint}/v1/{project_id}/workspaces/{workspaces_id}

      Request header: X-auth-TokenMIIZmgYJKoZIhvcNAQcCoIIZizCCGYcCAQExDTALBglghkgBZQMEAgEwgXXXXXX...

      Set the italic parameters based on site requirements. Set workspace_id to the workspace ID obtained in 2.

    2. Status code 200 OK is returned. The response body is as follows:
      {
          "id": "f3deca1406da4910a50f3919940b9bda",
          "name": "test_workspace",
          "description": "It is my workspace",
          "owner": "test166",
          "create_time": 1625453558000,
          "update_time": 1625453558000,
          "enterprise_project_id": "0",
          "enterprise_project_name": "default",
          "auth_type": "public",
          "status": "NORMAL",
          "status_info": ""
      }

      Obtain the detailed information about the workspace based on the response. status value NORMAL indicates the workspace is running properly.

  4. Call the API for modifying a workspace to modify the workspace information including its name, description, and authorization based on the workspace ID.
    1. Request body:

      URI: PUT https://{endpoint}/v1/{project_id}/workspaces/{workspaces_id}

      Request header:
      • X-auth-Token →MIIZmgYJKoZIhvcNAQcCoIIZizCCGYcCAQExDTALBglghkgBZQMEAgEwgXXXXXX...
      • Content-Type →application/json

      Request body:

      {
      	"name": "new_name",
      	"description": "update description",
      	"auth_type":"INTERNAL",
      	"grants":
      	[
      		{"user_id": "aa7efa8801024da08a7fa92dc0******"}
      	]
      }

      Set the italic parameters based on site requirements. Set name and description to the modified name and description, respectively.

    2. Response body with status code 200 OK returned (indicating that the workspace has been modified):
      {
          "workspace_id": "f3deca1406da4910a50f3919940b9bda"
      }
  5. Call the API for deleting a workspace to delete the workspace if it is not needed.
    1. Request body:

      URI: DELETE https://{endpoint}/v1/{project_id}/workspaces/{workspaces_id}

      Request header: X-auth-TokenMIIZmgYJKoZIhvcNAQcCoIIZizCCGYcCAQExDTALBglghkgBZQMEAgEwgXXXXXX...

      Set the italic parameters based on site requirements.

    2. Response body with status code 200 OK returned (indicating that the authorization has been deleted):
      {
          "workspace_id": "f3deca1406da4910a50f3919940b9bda"
      }