Updated on 2026-11-12 GMT+08:00

Deleting an Asset

Function

This API is used to delete a specified asset from ModelArts. You can use the forceDelete parameter to forcibly delete assets of the dataset type.

It is used when you need to clear assets that are no longer used or release storage resources. Before using this API, ensure that you have the project access permission and know the ID of the target asset. The platform will verify the existence, ownership, and usage status of the assets, disable and delete the assets, and return the asset IDs. If the asset does not exist, the asset is a preset asset and cannot be deleted, the model asset is still in use, or you do not have the required permission, 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.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    modelarts:asset:deleteAsset

    Write

    workspace *

    g:EnterpriseProjectId

    -

    -

    asset *

    -

URI

DELETE /v2/{project_id}/assets/{asset_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition: Huawei Cloud project ID. To obtain a project ID, go to the ModelArts Studio console, press F12 to access the developer tool, refresh the page, find the /rest/me API in the Network tab, and then locate the project_id field in the response of the API.

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

Range: N/A

Default Value: N/A

asset_id

Yes

String

Definition: Asset ID.

Constraints: The value can contain 1 to 36 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed.

Range: N/A

Default Value: N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

workspace_id

No

String

Definition: Workspace ID. To obtain the value, click the target project name on the platform, and check the project settings page.

Constraints: The value can contain 1 to 32 characters. Only letters and digits are allowed.

Range: N/A

Default Value: N/A

force_delete

No

Boolean

Definition: Whether to delete data in the OBS bucket from the dataset. The value is of the Boolean type. The value true indicates that data in the OBS bucket is deleted. The value false indicates that only records are deleted.

Constraints: N/A

Range: N/A

Default Value: N/A

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition: User token. During API authentication using a token, the token is added to requests to get permissions for calling the API. To obtain the token, call /v3/auth/tokens of IAM. The value of X-Subject-Token in the response header is the token.

Constraints: N/A

Range: N/A

Default Value: N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

asset_id

String

Definition: Asset ID.

Range: N/A

Example Requests

https://{endpoint}/v2/{project_id}/assets/{asset_id}

Example Responses

Status code: 200

{
  "asset_id" : "ae637b99211766277942cd98b340b3c6"
}

Status Codes

Status Code

Description

200

Asset deleted.

Error Codes

See Error Codes.