---
orphan: true
---

# Update folder

Update folder information; checking if `name` is a valid identifier when provided.

```text
POST https://moi.matrixorigin.cn/newmoi/catalog/folder/update
```

## Preparation before calling

First [query the file list](list-files.md) to obtain the target folder ID. Prepare the personal access token, target workspace ID, and folder ID that have 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.
- `$FOLDER_ID`: Folder ID to update.

The caller needs write access to the root volume.

## Request example

```bash
curl -X POST "https://moi.matrixorigin.cn/newmoi/catalog/folder/update" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
    "id": '"$FOLDER_ID"',
    "name": "<FOLDER_NAME>",
    "description": "<FOLDER_DESCRIPTION>"
  }'
```

## Request body

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | integer | Yes | Folder ID. |
| `name` | string | No | New name. |
| `description` | string | No | New description. |

## Successful response

Returns `200` on success, `data` is `null`. The caller needs write access to the root volume.

```json
{
  "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 the update is successful. |

## Error response

```json
{
  "code": "ErrParamInvalid",
  "msg": "name 无效",
  "data": null
}
```

### Common HTTP errors

```{list-table}
:header-rows: 1
:widths: 12 22 32 34

* - HTTP status code
  - error code
  - Common causes
  - Recommended actions
* - `400`
  - `ErrParamInvalid`
  - The request format is invalid, or the supplied `name` is invalid.
  - Check folder ID and name.
* - `403`
  - `ErrForbidden`
  - The current identity does not have write permissions to the root volume.
  - Use credentials with write access, or contact your administrator for authorization.
* - `409`
  - `ErrReadonly`
  - The database where the folder is located is not writable.
  - Select a folder in a writable volume.
* - `500`
  - `ErrServer`
  - The service cannot update the folder.
  - Record the request time and error message and try again; if it continues to fail, contact support.
```

## Follow-up operations

Use the same resource identifier [Query Catalog details](get-catalog.md) to confirm the update result.
