---
orphan: true
---

# Update callback rules

Update a saved callback rule.

```text
PATCH https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/callback-rules/{callback_rule_id}
```

## Before you call

The examples below use `$AI_STUDIO_API_KEY`, `$WORKSPACE_ID`, and `$CALLBACK_RULE_ID`.

## Request example

```bash
curl -X PATCH "https://moi.matrixorigin.cn/newmoi/workspaces/$WORKSPACE_ID/callback-rules/$CALLBACK_RULE_ID" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Issue 回调",
    "version": 1
  }'
```

## Request body

| Parameters | Type | Is it required | Description |
| --- | --- | --- | --- |
| `name` | string | No | Callback rule name. |
| `description` | string | No | Callback rule description. |
| `enabled` | boolean | No | Whether to enable the rule. |
| `priority` | integer | No | Match priority. |
| `match` | object | No | Matching criteria, which can include `resource_kinds`, `event_types`, `event_actions`, and `field_equals`. |
| `target_type` | string | No | Callback target type. |
| `target_config` | object | No | Callback target configuration. |
| `stop_after_match` | boolean | No | Whether to stop matching after hitting this rule. |
| `version` | integer | Yes | The rule version to update. |

## Successful response

Returns `200` and updated rules on success.

```json
{"code":0,"data":{"id":"rule_01"}}
```

The response fields are as follows.

| Field | Type | Description |
| --- | --- | --- |
| `data.id` | string | Callback rule ID. |

## Error response

```json
{"code":5,"message":"callback rule not found"}
```
