Delete files

Delete the specified file.

POST https://moi.matrixorigin.cn/newmoi/catalog/file/delete

Preparation before calling

First query the file list to obtain the target file ID and the volume ID to which it belongs. Prepare the personal access token, target workspace ID, file ID, and volume ID that has access to the target workspace.

The example below uses:

  • $AI_STUDIO_API_KEY: The actual personal access token, passed through the X-API-Key Header.

  • $WORKSPACE_ID: Target workspace ID, passed through X-Workspace-ID Header.

  • $FILE_ID: File ID to delete.

  • $VOLUME_ID: ID of the volume to which the file belongs.

This action removes the file association and deletes the file irreversibly.

Request example

curl -X POST "https://moi.matrixorigin.cn/newmoi/catalog/file/delete" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
    "id": "'"$FILE_ID"'",
    "volume_id": "'"$VOLUME_ID"'"
  }'

Request body

Parameter

Type

Required

Description

id

string

Yes

File ID.

volume_id

string

Yes

The volume ID to which the file belongs.

Successful response

Returns 200 on success, data is null. This operation removes the file association and deletes the file irreversibly.

{
  "code": "OK",
  "msg": "OK",
  "data": null
}

The response fields are as follows.

Field

Type

Description

code

string

OK on success.

msg

string

OK on success.

data

null

Fixed to null when deleted successfully.

Error response

{
  "code": "ErrNotFound",
  "msg": "对象不存在",
  "data": null
}

Common HTTP errors

HTTP status code

error code

Common causes

Recommended actions

400

ErrParamInvalid

id, volume_id are missing or invalid.

Check file ID and owning volume ID.

403

ErrForbidden

The current identity does not have write permissions on the root volume to which it belongs.

Use credentials with write access, or contact your administrator for authorization.

404

ErrNotFound

The file or the volume it belongs to does not exist.

Check file ID and volume ID.

409

ErrReadonly

The volume where the file is located is not writable.

Select files in a writable volume.

500

ErrServer

The service cannot delete the file.

Record the request time and error message and try again; if it continues to fail, contact support.

Follow-up operations

Query file products, confirm that the target no longer appears.

Last updated on