Reorder Routing Rules

POST /v1/endpoints/{uuid}/routing-rules/reorder

Rewrite the priority column for every routing rule under an endpoint based on a client-supplied ID order. Used by the dashboard's drag-to-reorder UI on the routing-rules tab — the cards record their new order and POST it here in one shot.

Priorities are reassigned in a single transaction (1, 2, 3, …) so two rules can never share the same priority after a reorder. The scope guard means rules belonging to other endpoints are rejected silently.

Request body

ordered_ids int[] Req
Rule IDs in the desired order. Index 0 becomes priority 1 (highest), index 1 becomes 2, and so on. IDs not in this list keep their current priority but will sort AFTER the listed ones (the next reorder fixes the gap).

Response (200 OK)

success bool
Always true when the call returns 200.

Errors

400
Empty ordered_ids, malformed body, or non-integer IDs.
401
Missing auth.
403
Plan doesn't include the endpoint_routing_rules entitlement.
404
Endpoint UUID not owned by the caller (or doesn't exist).
500
Transactional update failed — every priority change is rolled back; original order is preserved.
Request
curl -X POST "https://api.ngris.com/v1/endpoints/<uuid>/routing-rules/reorder" \ -H "X-API-KEY: <your_api_key>" \ -H "Content-Type: application/json" \ -d '{ "ordered_ids": [42, 17, 88, 19] }'
Response — 200 OK
{"success": true}
On this page
Reorder Routing Rules
Iris