# Enable custom operator

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

Enable a custom operator so that it can be used for subsequent workflow configuration and test runs.

```text
POST https://moi.matrixorigin.cn/newmoi/workflow/v2/custom-operators/$OPERATOR_ID/enable
```

## Preparation before calling

First [query custom operator details](get-custom-operator.md) to confirm the operator to be enabled. Prepare the personal access token, target workspace ID, and custom operator ID that have 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 -X POST "https://moi.matrixorigin.cn/newmoi/workflow/v2/custom-operators/$OPERATOR_ID/enable" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"
```

:::
::::

## Successful response

The response returns the updated operator configuration. After confirming that the operator has been enabled, you can [trial run the custom operator](test-custom-operator.md).


The response fields are as follows.

::::{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 on success.</dd></div>
  <div class="mo-api-field"><dt><code>msg</code><span class="mo-api-field__type">string</span></dt><dd>OK on success.</dd></div>
  <div class="mo-api-field"><dt><code>data.id</code><span class="mo-api-field__type">integer</span></dt><dd>Custom operator ID.</dd></div>
  <div class="mo-api-field"><dt><code>data.node_id</code><span class="mo-api-field__type">string</span></dt><dd>Operator ID.</dd></div>
  <div class="mo-api-field"><dt><code>data.name</code><span class="mo-api-field__type">string</span></dt><dd>Operator name.</dd></div>
  <div class="mo-api-field"><dt><code>data.identifier</code><span class="mo-api-field__type">string</span></dt><dd>Operator ID.</dd></div>
  <div class="mo-api-field"><dt><code>data.description</code><span class="mo-api-field__type">string</span></dt><dd>Operator description; returned if there is a value.</dd></div>
  <div class="mo-api-field"><dt><code>data.handler</code><span class="mo-api-field__type">string</span></dt><dd>Processing function; returned when there is a value.</dd></div>
  <div class="mo-api-field"><dt><code>data.version</code><span class="mo-api-field__type">string</span></dt><dd>Operator version; returned if there is a value.</dd></div>
  <div class="mo-api-field"><dt><code>data.isolation_level</code><span class="mo-api-field__type">string</span></dt><dd>Isolation configuration; returned if there is a value.</dd></div>
  <div class="mo-api-field"><dt><code>data.language</code><span class="mo-api-field__type">integer</span></dt><dd>Implements the numerical encoding of the language; returns if there is a value.</dd></div>
  <div class="mo-api-field"><dt><code>data.kind</code><span class="mo-api-field__type">integer</span></dt><dd>Numeric encoding of the operator type; returned if there is a value.</dd></div>
  <div class="mo-api-field"><dt><code>data.source_file_id</code><span class="mo-api-field__type">string</span></dt><dd>Source file ID; returned when created using a source file.</dd></div>
  <div class="mo-api-field"><dt><code>data.input_schema</code><span class="mo-api-field__type">string</span></dt><dd>Enter the defined serialization content; return if there is a value.</dd></div>
  <div class="mo-api-field"><dt><code>data.output_schema</code><span class="mo-api-field__type">string</span></dt><dd>Output the defined serialized content; return if there is a value.</dd></div>
  <div class="mo-api-field"><dt><code>data.binding_config</code><span class="mo-api-field__type">string</span></dt><dd>The serialized content of the binding configuration; returned if there is a value.</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; returned if there is a value.</dd></div>
  <div class="mo-api-field"><dt><code>data.updated_by</code><span class="mo-api-field__type">string</span></dt><dd>Last updater ID; returned if there is a value.</dd></div>
  <div class="mo-api-field"><dt><code>data.created_at</code><span class="mo-api-field__type">integer</span></dt><dd>Creation timestamp; returned if there is a value.</dd></div>
  <div class="mo-api-field"><dt><code>data.updated_at</code><span class="mo-api-field__type">integer</span></dt><dd>Last updated timestamp; returned if there is a value.</dd></div>
  <div class="mo-api-field"><dt><code>data.base_node_id</code><span class="mo-api-field__type">string</span></dt><dd>The basic operator associated with the built-in binding type; returned when there is a value.</dd></div>
  <div class="mo-api-field"><dt><code>data.base_node_version</code><span class="mo-api-field__type">string</span></dt><dd>The basic operator version associated with the built-in binding type; returned when there is a value.</dd></div>
  <div class="mo-api-field"><dt><code>data.catalog_id</code><span class="mo-api-field__type">integer</span></dt><dd>The associated Catalog ID; returned if there is a value.</dd></div>
  <div class="mo-api-field"><dt><code>data.database_id</code><span class="mo-api-field__type">integer</span></dt><dd>The associated database ID; returned if there is a value.</dd></div>
  <div class="mo-api-field"><dt><code>data.enabled</code><span class="mo-api-field__type">boolean</span></dt><dd>Enabled status.</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": 123,
    "node_id": "moi:custom.operator:workspace:text_counter",
    "name": "文本计数",
    "enabled": true
  }
}
```

:::
::::

## 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": "ErrParamInvalid",
  "msg": "请求参数无效",
  "data": null
}
```

:::
::::

## Follow-up operations

After completion [Query custom operator details](get-custom-operator.md) confirms the current status.
