# Query file details

Query file details by file ID.

```text
POST https://moi.matrixorigin.cn/newmoi/catalog/file/info
```

## Preparation before calling

First [query the file list](list-files.md) or [upload the file](upload-file.md)] to obtain the target file ID. Prepare the personal access token, target workspace ID, and file 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.
- `$FILE_ID`: The file ID to be queried.

The caller needs read permissions on the root volume to which the file belongs.

## Request example

```bash
curl -X POST "https://moi.matrixorigin.cn/newmoi/catalog/file/info" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
    "file_id": "'"$FILE_ID"'"
  }'
```

## Request body

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `file_id` | string | Yes | File ID. |

## Successful response

Returns `200` and file information on success. The caller needs read permissions on the root volume to which the file belongs.

```json
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "file_id": "file-123",
    "file_name": "orders.csv",
    "size": "2048"
  }
}
```

The response fields are as follows.

| Field | Type | Description |
| --- | --- | --- |
| `code` | string | `OK` on success. |
| `msg` | string | `OK` on success. |
| `data.file_id` | string | File ID. |
| `data.file_name` | string | File name. |
| `data.size` | string | File size in bytes, returned as a numeric string. |

## Error response

```json
{
  "code": "ErrNotFound",
  "msg": "Object not found",
  "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`
  - `file_id` is missing or invalid.
  - Pass in a valid file ID.
* - `403`
  - `ErrForbidden`
  - The current identity does not have read permission on the root volume to which it belongs.
  - Use credentials with read access, or contact your administrator for authorization.
* - `404`
  - `ErrNotFound`
  - File does not exist.
  - Check file ID.
* - `500`
  - `ErrServer`
  - The service cannot read file information.
  - Record the request time and error message and try again; if it continues to fail, contact support.
```

## Follow-up operations

When returning to processed results, [Query file products](list-file-artifacts.md).
