---
title: "Create a routing rule"
method: POST
path: "/v1/endpoints/{id}/rules"
---

# Create a routing rule

`POST /v1/endpoints/{id}/rules`

## Request

- Base URL: `https://webhook-studio.com`
- URL: `https://webhook-studio.com/v1/endpoints/{id}/rules`
- Auth: HTTP bearer

The condition tree is validated on write; a malformed one is rejected rather than stored as a rule that silently never matches.

## Request body

- object
  - `name` string, required
  - `condition_tree` object, required: A condition group { op: "AND"|"OR", children: [...] } or a leaf { field, operator, value? }, nested arbitrarily. field is "body.<dot.path>", "header.<name>" or "meta.<key>". operator is equals|not_equals|contains|exists|regex; all but exists require value. An empty AND group matches every event.
  - `destination_ids` string[], required
  - `active` boolean

## Response `201`

Created

## Other responses

- `400`: Error
- `401`: Error
- `404`: Error

---

[API](https://skmtc.dev/webhook-studio/apis/webhook-studio-api.md) · [All operations](https://skmtc.dev/webhook-studio/apis/webhook-studio-api/llms.txt) · [OpenAPI document](https://skmtc.dev/webhook-studio/apis/webhook-studio-api/revisions/99d81099e6d6?raw)
