> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getnexor.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Set Stage Gate

<span class="badge--patch">PATCH</span> <code class="endpoint-url">/workflows/:id/tools/:toolId/stage-gate</code>

Gate a custom tool to specific funnel stages, so the agent only offers it once a lead reaches the right status.

## Path Parameters

| Parameter | Type          | Required | Description |
| --------- | ------------- | -------- | ----------- |
| `id`      | string (uuid) | **Yes**  | Agent ID    |
| `toolId`  | string (uuid) | **Yes**  | Tool ID     |

## Request Body

| Field                   | Type              | Required | Description                                                                                               |
| ----------------------- | ----------------- | -------- | --------------------------------------------------------------------------------------------------------- |
| `available_in_statuses` | string\[] \| null | **Yes**  | Funnel status keys where the tool is offered. `null` clears the gate, making it available in every status |

## Responses

### `200` — Updated

```json theme={null}
{
  "success": true,
  "tool": {
    "id": "9a1b2c3d-0000-4000-8000-000000000001",
    "name": "check_availability",
    "available_in_statuses": ["qualified", "negotiating"]
  }
}
```

### `400` — Validation error

```json theme={null}
{
  "error": "Invalid input",
  "message": "available_in_statuses must be an array of status keys, or null to clear"
}
```

### `401` — Authentication error

See [Authentication](/docs/en/api/authentication).

### `404` — Not found

```json theme={null}
{
  "error": "Not found",
  "message": "Tool not found"
}
```

### `500` — Internal server error
