# Query database details

Query database details by ID.

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

## Preparation before calling

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

## Request example

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

## Request body

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | integer | Yes | Database ID. |

## Successful response

Returns `200` and database details on success.

```json
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "database": {
      "id": 2,
      "name": "orders",
      "display_name": "orders",
      "description": "订单库",
      "display_description": "订单库"
    }
  }
}
```

The response fields are as follows.

| Field | Type | Description |
| --- | --- | --- |
| `code` | string | `OK` on success. |
| `msg` | string | `OK` on success. |
| `data.database.id` | integer | Database ID. |
| `data.database.name` | string | The original name of the database. |
| `data.database.description` | string | Database description. |
| `data.database.display_name` | string | Database display name; returned if there is a value. |
| `data.database.display_description` | string | Database display description; returned if there is a value. |

## Error response

```json
{
  "code": "ErrObjectNotFound",
  "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 or database ID is invalid.
  - Use a positive integer ID from the database list.
* - `403`
  - `ErrForbidden`
  - The current identity does not have read permission.
  - Requesting permission to `database.read`.
* - `404`
  - `ErrObjectNotFound`
  - The database does not exist or is not readable.
  - Verify database ID and workspace.
* - `500`
  - `ErrServer`
  - The server failed to read the details.
  - Try again later.
```

## Follow-up operations

When modifications are needed [Update database](update-database.md). When returning the list [Query file products](list-file-artifacts.md).
