# View SQL workbook version content

View the SQL content in a workbook version without executing it.

```text
POST https://moi.matrixorigin.cn/newmoi/workbook/detail
```

## Preparation before calling

Prepare the personal access token, workspace ID, workbook ID, and version ID. You can first [View SQL workbook version list](list-workbook-versions.md) to obtain `version_id`.

In the example below, `$WORKBOOK_ID` is the ID of the SQL saved record, and `$VERSION_ID` is the version ID to view.

## Request body

Replace caller-specific values in the example with actual values.

::::{div} mo-api-split
:::{div} mo-api-split-main
```{raw} html
<dl class="mo-api-fields">
<div class="mo-api-field"><dt><code>workbook_id</code><span class="mo-api-field__type">string</span><span class="mo-api-field__required">Required</span></dt><dd>The ID of the SQL saved record.</dd></div>
<div class="mo-api-field"><dt><code>version_id</code><span class="mo-api-field__type">string</span><span class="mo-api-field__required">Required</span></dt><dd>The version ID in the SQL save record.</dd></div>
</dl>
```
:::
:::{div} mo-api-split-aside
```{raw} html
<p class="mo-api-example-label">Request example</p>
```
```bash
curl -X POST "https://moi.matrixorigin.cn/newmoi/workbook/detail" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d "{
    \"workbook_id\": \"$WORKBOOK_ID\",
    \"version_id\": \"$VERSION_ID\"
  }"
```
:::
::::
## Successful response

`data.sql_content` is the SQL text saved by this version; `created_at` and `updated_at` are the creation and update times of this version respectively.

```json
{
  "code": 200,
  "data": {
    "sql_content": "SELECT 1",
    "created_at": "2026-01-01T00:00:00Z",
    "updated_at": "2026-01-01T00:00:00Z"
  }
}
```

The response fields are as follows.

| Field | Type | Description |
| --- | --- | --- |
| `data.sql_content` | string | SQL content in version. |
| `data.created_at` | string | Creation time. |
| `data.updated_at` | string | Update time. |

## Error response

::::{div} mo-api-split
:::{div} mo-api-split-main
```{raw} html
<dl class="mo-api-fields">
<div class="mo-api-field"><dt><code>code</code><span class="mo-api-field__type">integer or string</span></dt><dd>Error code or status.</dd></div>
<div class="mo-api-field"><dt><code>message</code><span class="mo-api-field__type">string</span></dt><dd>Error message.</dd></div>
</dl>
```
:::
:::{div} mo-api-split-aside
```{raw} html
<p class="mo-api-example-label">Error response example</p>
```
```json
{
  "code": 404,
  "message": "SQL 工作簿或版本不存在"
}
```
:::
::::
## Follow-up operations

When a name change is required, [Update SQL workbook name](update-workbook.md). [View SQL workbook list](list-workbooks.md) when returning to the list.
