# Update file

This interface preserves the request shape for file updates, but the current implementation does not persist changes to `name`. Please do not interpret a successful response as indicating that the file name has been updated.

```text
POST $CLOUDSIGMA_API_BASE/catalog/file/update
```

## Before you call this API

Configure the [regional API endpoint and authentication](https://omnifabric.cloudsigma.com/docs/developer/endpoints-and-authentication.html.md), and select the target workspace.

First [query the file list](https://omnifabric.cloudsigma.com/docs/reference/api/ai-studio/resource-center/catalog/list-files.html.md) to obtain the target file ID.

Set the operation-specific values used in the request:

- `$FILE_ID`: File ID used to locate files and perform permission verification.

## Request example

```bash
curl -X POST "$CLOUDSIGMA_API_BASE/catalog/file/update" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
    "file_id": "'"$FILE_ID"'",
    "name": "<FILE_NAME>"
  }'
```

## Request body

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `file_id` | string | Yes | The file ID used to locate the file and perform permission verification. |
| `name` | string | No | The name of the file to be updated; the current implementation does not save this value. |

## Successful response

Returns `200` on success, `data` is `null`. The current implementation returns successfully but does not change the file name or other file attributes.

```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 request returns successfully; it does not mean that the file attributes have been changed. |

## Error response

```json
{
  "code": "ErrParamInvalid",
  "msg": "请求参数无效",
  "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 body is not valid JSON.
  - Check JSON format.
* - `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.
* - `500`
  - `ErrServer`
  - The server failed to process the request.
  - 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 file details](https://omnifabric.cloudsigma.com/docs/reference/api/ai-studio/resource-center/catalog/get-file.html.md) to confirm the update result.
