---
title: "Reorder all rule sets"
method: PUT
path: "/v1/programs/{program_id}/rule-sets/order"
tags: ["Rule Sets"]
---

# Reorder all rule sets

`PUT /v1/programs/{program_id}/rule-sets/order`

## Request

- Base URL: `https://api.scrip.dev`
- URL: `https://api.scrip.dev/v1/programs/{program_id}/rule-sets/order`
- Auth: HTTP bearer

Set the order of every rule set in a program, renumbered 1..N with no gaps.

## Path parameters

- `program_id` string, uuid, required

## Request body

- ReorderRuleSetsRequest: The full list of a program's rule set ids in the order you want.
  - `expected_rule_configuration_version` integer, required: Current rule_configuration_version from the configuration read endpoint. A stale value rejects the request.
  - `rule_set_ids` string[], required: Every current rule-set ID, exactly once, in the desired execution order.

## Response `200`

The rule sets in their new order, and the new rule_configuration_version

- NormalizedRuleSetOrderResponse: The rule sets in a program after reordering, numbered in order, and the new rule configuration version.
  - `rule_configuration_version` integer: Resulting program rule-configuration version.
  - `rule_sets` RuleSetResponse[]: Complete rule-set sequence after renumbering.
    - `created_at` string, date-time: When this rule set was created.
    - `id` string, uuid: The id of the rule set. Use it in `rule_set_id` fields and paths.
    - `key` string: Immutable program-scoped key.
    - `name` string: Operator-facing display name.
    - `order` integer: Execution position among participating sets; lower executes first. This does not control participation, stacking, replacement, or suppression.
    - `program_id` string, uuid: Program that owns this rule set.
    - `rule_configuration_version` integer: Resulting program rule-configuration revision. Present on mutation responses.
    - `updated_at` string, date-time: When this rule set was last modified.

## Other responses

- `400`: The body is malformed, or expected_rule_configuration_version is missing (code: validation_error | invalid_json)
- `401`: The API key is missing or not valid. See [Authentication](https://docs.scrip.dev/authentication).
- `403`: The caller is not allowed to do this.
- `404`: Program not found (code: program_not_found)
- `409`: expected_rule_configuration_version is behind the live version, or the program is archived (code: rule_configuration_version_conflict | program_archived)
- `422`: The list repeats, leaves out, or adds a rule set (code: invalid_position)
- `429`: Too many requests. Wait the number of seconds in the `Retry-After` header, then retry. See [Limits and durations](https://docs.scrip.dev/limits#rate-limits).
- `500`: Something failed on Scrip's side. Retry the request, and quote `request_id` if it keeps failing. [Errors](https://docs.scrip.dev/errors) lists every code, and the [API introduction](https://docs.scrip.dev/api-reference/introduction) describes the error format.

---

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