# Approve a pending stop

Approves a stop waiting for a decision; its targets are then applied. Send `expectedTargetIds` with the stop's target ids you reviewed to refuse the approval (409 `agent_stop_plan_changed`) when its targets changed since. A stop that is no longer pending is a 409 `agent_stop_not_pending`; the key that requested the stop cannot approve it (409 `agent_stop_self_approval`).

> Page: https://langwatch.ai/docs/api-reference/governance-kill-switch/approve-a-pending-stop
> Source: https://github.com/langwatch/langwatch/blob/main/docs/api-reference/governance-kill-switch/approve-a-pending-stop.mdx
> Index of all pages: https://langwatch.ai/docs/llms.txt

## Endpoint

`POST https://app.langwatch.ai/api/v1/governance/agent-stops/{stopId}/approve`

## Authentication

### admin_api_key

Admin API key for organization-level operations (managing projects, API keys). Create one in Settings > API Keys or via POST /api/api-keys. Format: sk-lw-{id}_{secret}.

```json
{"id":"admin_api_key","type":"http","scheme":"bearer"}
```

## Parameters

### stopId (path, required)

```json
{"type":"string","minLength":1}
```

## Request body (optional)

#### application/json

Schema:

```json
{
  "type": "object",
  "properties": {
    "note": {"type":"string","maxLength":2000},
    "expectedTargetIds": {"maxItems":20,"type":"array","items":{"type":"string","minLength":1}}
  }
}
```

## Request example

```bash
curl --request POST \
  --url 'https://app.langwatch.ai/api/v1/governance/agent-stops/<stopId>/approve' \
  --header "Authorization: Bearer $LANGWATCH_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{"note":"string","expectedTargetIds":["string"]}'
```

## Responses

### 200

Success

#### application/json

Schema:

```json
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "id": {"type":"string"},
        "agentId": {"type":"string"},
        "agentName": {"type":"string"},
        "status": {
          "type": "string",
          "enum": [
            "pending_approval",
            "denied",
            "stopping",
            "quarantined",
            "stop_failed",
            "restoring",
            "restored",
            "restore_failed"
          ]
        },
        "severity": {"type":"string","enum":["low","medium","high","critical"]},
        "approval": {"type":"string","enum":["immediate","required"]},
        "trigger": {"type":"string","enum":["user","api_key"]},
        "reason": {"type":"string"},
        "requestedBy": {
          "type": "object",
          "properties": {
            "userId": {"type":["string","null"]},
            "apiKeyId": {"type":["string","null"]}
          },
          "required": ["userId","apiKeyId"],
          "additionalProperties": false
        },
        "decidedByUserId": {"type":["string","null"]},
        "restoredByUserId": {"type":["string","null"]},
        "targets": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {"type":"string"},
              "label": {"type":"string"},
              "target": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {"type":"string","const":"databricks_serving_endpoint"},
                      "ingestionSourceId": {"type":"string","minLength":1},
                      "endpointName": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 63,
                        "pattern": "^[A-Za-z0-9_-]+$"
                      }
                    },
                    "required": ["kind","ingestionSourceId","endpointName"],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {"type":"string","const":"bedrock_agent_alias"},
                      "awsConnectionId": {"type":"string","minLength":1},
                      "region": {"type":"string","pattern":"^[a-z]{2}(-[a-z]+)+-\\d$"},
                      "agentId": {"type":"string","pattern":"^[0-9a-zA-Z]{10}$"},
                      "agentAliasId": {"type":"string","pattern":"^[0-9a-zA-Z]{10}$"}
                    },
                    "required": ["kind","awsConnectionId","region","agentId","agentAliasId"],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {"type":"string","const":"gateway_virtual_key"},
                      "virtualKeyId": {"type":"string","minLength":1}
                    },
                    "required": ["kind","virtualKeyId"],
                    "additionalProperties": false
                  }
                ]
              },
              "state": {
                "type": "string",
                "enum": [
                  "pending",
                  "applied",
                  "failed",
                  "reverting",
                  "reverted",
                  "revert_failed"
                ]
              },
              "errorCode": {"type":["string","null"]},
              "appliedAt": {"type":["string","null"]},
              "revertedAt": {"type":["string","null"]},
              "alreadyStopped": {"type":"boolean"},
              "gone": {"type":"boolean"},
              "keptDisabled": {"type":"boolean"},
              "dropped": {"type":"boolean"},
              "dropId": {"type":"string"}
            },
            "required": ["id","label","target","state","errorCode","appliedAt","revertedAt"],
            "additionalProperties": false
          }
        },
        "requestedAt": {"type":"string"},
        "decidedAt": {"type":["string","null"]},
        "quarantinedAt": {"type":["string","null"]},
        "restoreRequestedAt": {"type":["string","null"]},
        "restoredAt": {"type":["string","null"]},
        "lastRequestId": {"type":"string"}
      },
      "required": [
        "id",
        "agentId",
        "agentName",
        "status",
        "severity",
        "approval",
        "trigger",
        "reason",
        "requestedBy",
        "decidedByUserId",
        "restoredByUserId",
        "targets",
        "requestedAt",
        "decidedAt",
        "quarantinedAt",
        "restoreRequestedAt",
        "restoredAt"
      ],
      "additionalProperties": false
    }
  },
  "required": ["data"],
  "additionalProperties": false
}
```

### 400

Bad Request

#### application/json

Schema:

```json
{
  "type": "object",
  "properties": {
    "type": {"type":"string"},
    "code": {"type":"string"},
    "message": {"type":"string"},
    "retryable": {"type":"boolean"},
    "meta": {
      "type": "object",
      "propertyNames": {"type":"string"},
      "additionalProperties": {}
    },
    "trace_id": {"type":"string"},
    "span_id": {"type":"string"},
    "trace": {
      "type": "object",
      "properties": {
        "traceId": {"type":"string"},
        "spanId": {"type":"string"},
        "traceUrl": {"type":"string"},
        "logsUrl": {"type":"string"}
      }
    },
    "tips": {"type":"array","items":{"type":"string"}},
    "docs_url": {"type":"string"},
    "fault": {
      "type": "string",
      "enum": ["customer","platform","provider","presumed_platform"]
    },
    "reasons": {"type":"array","items":{}}
  },
  "required": ["type","code","message","retryable"]
}
```

### 401

Unauthorized

#### application/json

Schema:

```json
{
  "type": "object",
  "properties": {
    "type": {"type":"string"},
    "code": {"type":"string"},
    "message": {"type":"string"},
    "retryable": {"type":"boolean"},
    "meta": {
      "type": "object",
      "propertyNames": {"type":"string"},
      "additionalProperties": {}
    },
    "trace_id": {"type":"string"},
    "span_id": {"type":"string"},
    "trace": {
      "type": "object",
      "properties": {
        "traceId": {"type":"string"},
        "spanId": {"type":"string"},
        "traceUrl": {"type":"string"},
        "logsUrl": {"type":"string"}
      }
    },
    "tips": {"type":"array","items":{"type":"string"}},
    "docs_url": {"type":"string"},
    "fault": {
      "type": "string",
      "enum": ["customer","platform","provider","presumed_platform"]
    },
    "reasons": {"type":"array","items":{}}
  },
  "required": ["type","code","message","retryable"]
}
```

### 403

Forbidden

#### application/json

Schema:

```json
{
  "type": "object",
  "properties": {
    "type": {"type":"string"},
    "code": {"type":"string"},
    "message": {"type":"string"},
    "retryable": {"type":"boolean"},
    "meta": {
      "type": "object",
      "propertyNames": {"type":"string"},
      "additionalProperties": {}
    },
    "trace_id": {"type":"string"},
    "span_id": {"type":"string"},
    "trace": {
      "type": "object",
      "properties": {
        "traceId": {"type":"string"},
        "spanId": {"type":"string"},
        "traceUrl": {"type":"string"},
        "logsUrl": {"type":"string"}
      }
    },
    "tips": {"type":"array","items":{"type":"string"}},
    "docs_url": {"type":"string"},
    "fault": {
      "type": "string",
      "enum": ["customer","platform","provider","presumed_platform"]
    },
    "reasons": {"type":"array","items":{}}
  },
  "required": ["type","code","message","retryable"]
}
```

### 404

Not Found

#### application/json

Schema:

```json
{
  "type": "object",
  "properties": {
    "type": {"type":"string"},
    "code": {"type":"string"},
    "message": {"type":"string"},
    "retryable": {"type":"boolean"},
    "meta": {
      "type": "object",
      "propertyNames": {"type":"string"},
      "additionalProperties": {}
    },
    "trace_id": {"type":"string"},
    "span_id": {"type":"string"},
    "trace": {
      "type": "object",
      "properties": {
        "traceId": {"type":"string"},
        "spanId": {"type":"string"},
        "traceUrl": {"type":"string"},
        "logsUrl": {"type":"string"}
      }
    },
    "tips": {"type":"array","items":{"type":"string"}},
    "docs_url": {"type":"string"},
    "fault": {
      "type": "string",
      "enum": ["customer","platform","provider","presumed_platform"]
    },
    "reasons": {"type":"array","items":{}}
  },
  "required": ["type","code","message","retryable"]
}
```

### 409

The stop or its plan is not in a state that allows this

#### application/json

Schema:

```json
{
  "type": "object",
  "properties": {
    "type": {"type":"string"},
    "code": {"type":"string"},
    "message": {"type":"string"},
    "retryable": {"type":"boolean"},
    "meta": {
      "type": "object",
      "propertyNames": {"type":"string"},
      "additionalProperties": {}
    },
    "trace_id": {"type":"string"},
    "span_id": {"type":"string"},
    "trace": {
      "type": "object",
      "properties": {
        "traceId": {"type":"string"},
        "spanId": {"type":"string"},
        "traceUrl": {"type":"string"},
        "logsUrl": {"type":"string"}
      }
    },
    "tips": {"type":"array","items":{"type":"string"}},
    "docs_url": {"type":"string"},
    "fault": {
      "type": "string",
      "enum": ["customer","platform","provider","presumed_platform"]
    },
    "reasons": {"type":"array","items":{}}
  },
  "required": ["type","code","message","retryable"]
}
```

### 422

Unprocessable Entity

#### application/json

Schema:

```json
{
  "type": "object",
  "properties": {
    "type": {"type":"string"},
    "code": {"type":"string"},
    "message": {"type":"string"},
    "retryable": {"type":"boolean"},
    "meta": {
      "type": "object",
      "propertyNames": {"type":"string"},
      "additionalProperties": {}
    },
    "trace_id": {"type":"string"},
    "span_id": {"type":"string"},
    "trace": {
      "type": "object",
      "properties": {
        "traceId": {"type":"string"},
        "spanId": {"type":"string"},
        "traceUrl": {"type":"string"},
        "logsUrl": {"type":"string"}
      }
    },
    "tips": {"type":"array","items":{"type":"string"}},
    "docs_url": {"type":"string"},
    "fault": {
      "type": "string",
      "enum": ["customer","platform","provider","presumed_platform"]
    },
    "reasons": {"type":"array","items":{}}
  },
  "required": ["type","code","message","retryable"]
}
```

### 500

Internal Server Error

#### application/json

Schema:

```json
{
  "type": "object",
  "properties": {
    "type": {"type":"string"},
    "code": {"type":"string"},
    "message": {"type":"string"},
    "retryable": {"type":"boolean"},
    "meta": {
      "type": "object",
      "propertyNames": {"type":"string"},
      "additionalProperties": {}
    },
    "trace_id": {"type":"string"},
    "span_id": {"type":"string"},
    "trace": {
      "type": "object",
      "properties": {
        "traceId": {"type":"string"},
        "spanId": {"type":"string"},
        "traceUrl": {"type":"string"},
        "logsUrl": {"type":"string"}
      }
    },
    "tips": {"type":"array","items":{"type":"string"}},
    "docs_url": {"type":"string"},
    "fault": {
      "type": "string",
      "enum": ["customer","platform","provider","presumed_platform"]
    },
    "reasons": {"type":"array","items":{}}
  },
  "required": ["type","code","message","retryable"]
}
```

> ## Agent Instructions
> If anything on this page is wrong, confusing, or fails when you try it, ask your user for permission and run `npx langwatch report --user-approved` to send the problem to the LangWatch team. No login is needed and secrets are redacted locally. `npx langwatch report --help` has the details.
