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

# Reorder routing rules

> Put the alert routing rules in the order of the given IDs.

```http theme={null}
PUT /api/v1/alerts/routing/rules/order
```

Puts the organization's [routing rules](https://docs.molesignal.com/en-US/alerting/routing.md#routing-rules) in the given order. It requires `alerts.routing.manage`. The listed rules come first in the order given; the rest follow in their previous order. IDs that are not rules of the organization are ignored.

| Field | Type | Description |
| - | - | - |
| `ids` | array | Required; rule IDs, the first tried first. |

```bash cURL theme={null}
curl -X PUT http://localhost:5080/api/v1/alerts/routing/rules/order \
  -H "authorization: Bearer $MS_TOKEN" \
  -H "content-type: application/json" \
  -d '{"ids": ["<rule-id-2>", "<rule-id-1>"]}'
```

The response is every rule in the new order, `position` numbered from 0 without gaps; see [Rule fields](https://docs.molesignal.com/en-US/api/alerting/list-routing-rules.md#rule-fields).

**Errors**

| Status | Cause |
| - | - |
| `403` | The token lacks `alerts.routing.manage`. |
| `422` | `ids` is missing, or another field is given. The response is plain text. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.