# View workflow template list

```{raw} html
<div class="mo-api-page-show-toc" aria-hidden="true"></div>
```

Lists built-in and custom workflow templates visible in the current workspace. Built-in templates are returned in the current language; custom templates only return templates created in the current workspace.

```text
GET https://moi.matrixorigin.cn/newmoi/workflow-templates
```

## Preparation before calling

Prepare a personal access token and target workspace ID that has access to the target workspace.


## Request parameters

::::{div} mo-api-split
:::{div} mo-api-split-main

```{raw} html
<dl class="mo-api-fields">

</dl>
```

:::
:::{div} mo-api-split-aside

```{raw} html
<p class="mo-api-example-label">Request example</p>
```

```bash
curl "https://moi.matrixorigin.cn/newmoi/workflow-templates?summary=true" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"
```

:::
::::

## Successful response

Returns `200` on success. `summary=true` when `data` is an array of digest objects:


When `summary=true` is not passed, each item returns the complete template definition:


The response fields are as follows.

In field paths, `[]` denotes each item in an array. For example, `items[].name` is the `name` field of each item in the `items` array. After a type, `[]` denotes an array; for example, `string[]` is an array of strings.

::::{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">string</span></dt><dd>OK when successful.</dd></div>
  <div class="mo-api-field"><dt><code>msg</code><span class="mo-api-field__type">string</span></dt><dd>OK when successful.</dd></div>
  <div class="mo-api-field"><dt><code>data</code><span class="mo-api-field__type">object[]</span></dt><dd>Template list; returns an empty array when there is no visible template.</dd></div>
  <div class="mo-api-field"><dt><code>data[].id</code><span class="mo-api-field__type">integer</span></dt><dd>Template ID.</dd></div>
  <div class="mo-api-field"><dt><code>data[].name</code><span class="mo-api-field__type">string</span></dt><dd>Template name.</dd></div>
  <div class="mo-api-field"><dt><code>data[].description</code><span class="mo-api-field__type">string</span></dt><dd>Template description.</dd></div>
  <div class="mo-api-field"><dt><code>data[].is_builtin</code><span class="mo-api-field__type">boolean</span></dt><dd>Whether it is a built-in template.</dd></div>
  <div class="mo-api-field"><dt><code>data[].workspace_id</code><span class="mo-api-field__type">string</span></dt><dd>The workspace ID in full mode; the built-in template is an empty string.</dd></div>
  <div class="mo-api-field"><dt><code>data[].created_by</code><span class="mo-api-field__type">string</span></dt><dd>Creator ID in full mode.</dd></div>
  <div class="mo-api-field"><dt><code>data[].updated_by</code><span class="mo-api-field__type">string</span></dt><dd>The last updater ID in full mode.</dd></div>
  <div class="mo-api-field"><dt><code>data[].template_key</code><span class="mo-api-field__type">string</span></dt><dd>The built-in template identifier in full mode; the custom template is an empty string.</dd></div>
  <div class="mo-api-field"><dt><code>data[].language</code><span class="mo-api-field__type">string</span></dt><dd>Template language in full mode.</dd></div>
  <div class="mo-api-field"><dt><code>data[].dsl_yaml</code><span class="mo-api-field__type">string</span></dt><dd>Workflow DSL YAML in full mode.</dd></div>
  <div class="mo-api-field"><dt><code>data[].runtime_fields</code><span class="mo-api-field__type">string</span></dt><dd>Runtime field JSON text in full mode.</dd></div>
  <div class="mo-api-field"><dt><code>data[].created_at</code><span class="mo-api-field__type">string</span></dt><dd>Creation time in full mode; may be omitted if not provided by the server.</dd></div>
  <div class="mo-api-field"><dt><code>data[].updated_at</code><span class="mo-api-field__type">string</span></dt><dd>The last update time in full mode; may be omitted if not provided by the server.</dd></div>
</dl>
```

:::
:::{div} mo-api-split-aside

```{raw} html
<p class="mo-api-example-label">Successful response example</p>
```

```json
{
  "code": "OK",
  "msg": "OK",
  "data": [
    {
      "id": 12,
      "name": "daily-import-template",
      "description": "每日导入工作流模板",
      "is_builtin": false
    }
  ]
}
```

:::
::::

## 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">string</span></dt><dd>Error code.</dd></div>
  <div class="mo-api-field"><dt><code>msg</code><span class="mo-api-field__type">string</span></dt><dd>Readable error message.</dd></div>
  <div class="mo-api-field"><dt><code>data</code><span class="mo-api-field__type">null</span></dt><dd>`null` in an error response.</dd></div>
</dl>
```

:::
:::{div} mo-api-split-aside

```{raw} html
<p class="mo-api-example-label">Error response example</p>
```

```json
{
  "code": "ErrWorkspaceIDMissing",
  "msg": "需要工作区标识",
  "data": null
}
```

:::
::::

## Follow-up operations

Use `data[].id` [query workflow template details](get-workflow-template.md).
