---
title: "Reorder a project's edge rules"
method: PUT
path: "/projects/{project_id}/edge-rules/order"
tags: ["Edge Rules"]
---

# Reorder a project's edge rules

`PUT /projects/{project_id}/edge-rules/order`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/projects/{project_id}/edge-rules/order`
- Auth: HTTP bearer

`rule_ids` must list every rule of the project once, in the new order.

## Path parameters

- `project_id` integer, required

## Request body

- ReorderEdgeRulesRequest: Body for reordering: every rule id of the project, in the new order.
  - `rule_ids` integer[], required

## Response `200`

The rules in their new order

- EdgeRuleListResponse: A project's rules in evaluation order. The list is bounded by `max_rules`, so it is returned whole rather than paginated: order is the point, and a page of an ordered rule set cannot be reasoned about.
  - `max_rules` integer, required: Maximum number of rules a project may hold.
  - `project_id` integer, required
  - `rules` EdgeRuleResponse[], required
    - `action` union, required: What a matching rule does.
      - object: Return an error response. Status 400–499.
        - `body` string: Plain-text body, up to 1024 bytes. Empty for a short default.
        - `status` integer, required
        - `type` 'block', required
      - object: Skip the remaining edge rules. Rate limits, attack mode and password protection still apply.
        - `type` 'allow', required
      - object: Serve the proof-of-work challenge unless the visitor holds clearance.
        - `type` 'challenge', required
      - object: Redirect to a path or an absolute URL with a fixed host. `{path}` and `{query}` insert the visitor's normalized path and raw query string.
        - `status` integer, required
        - `target` string, required
        - `type` 'redirect', required
      - object: Record the match and keep evaluating.
        - `type` 'log', required
    - `created_at` string, date-time, required
    - `enabled` boolean, required
    - `environment_id` integer, nullable: `null` applies the rule to every environment of the project.
    - `expression` EdgeRuleGroup, required: A group of conditions and nested groups.
      - `children` EdgeRuleExpression[]
        - union: A node of a rule's match expression.
          - object: A single test against one request attribute.
            - `case_insensitive` boolean: Compare without case. Hosts, methods, countries and enumerated fields always compare without case.
            - `field` 'ip' | 'country' | 'continent' | 'asn' | 'is_hosting_provider' | 'host' | 'path' | 'raw_path' | 'method' | 'query' | 'header' | 'cookie' | 'user_agent' | 'ja4' | 'bot_class', required: A request attribute a condition tests.
            - `id` string: Node identifier, unique within the rule. Assigned by the server when empty; used to attach validation messages to the right condition.
            - `key` string, nullable: Header, query parameter or cookie name. Required for those fields.
            - `op` 'eq' | 'in' | 'in_cidr' | 'starts_with' | 'ends_with' | 'contains' | 'glob' | 'regex' | 'exists' | 'not_exists', required: How a condition compares the request value with its `values`.
            - `values` string[]: One value for single-value operators, a list for `in`/`in_cidr`, none for `exists`/`not_exists`.
            - `kind` 'condition', required
          - object: A group of conditions and nested groups.
            - `children` EdgeRuleExpression[]
            - `combinator` 'all' | 'any' | 'none', required: How a group combines its children. `none` is `not(any(...))`.
            - `id` string
            - `kind` 'group', required
      - `combinator` 'all' | 'any' | 'none', required: How a group combines its children. `none` is `not(any(...))`.
      - `id` string
    - `hits` integer, required: Requests this rule has matched, across every proxy. Counters are flushed every few seconds.
    - `id` integer, required
    - `last_hit_at` string, date-time, nullable
    - `mode` 'enforce' | 'log_only', required: `log_only` evaluates the rule and records matches but never acts.
    - `name` string, required
    - `position` integer, required: 0-based evaluation order. The first rule that decides wins.
    - `project_id` integer, required
    - `revision` integer, required: Edit counter. Send it back on update so a concurrent change is refused instead of overwritten.
    - `summary` string, required: The rule in one sentence, e.g. "Block with 403 when path starts with /admin".
    - `updated_at` string, date-time, required

## Other responses

- `400`: The list does not name every rule exactly once
- `401`: Unauthorized
- `403`: Insufficient permissions
- `404`: Project not found
- `500`: Internal server error

## Changes

- **2026-11-09** `12896146b193`: 5 breaking
  - removed the required property `extensions` from the response with the `400` status
  - removed the required property `extensions` from the response with the `401` status
  - removed the required property `extensions` from the response with the `403` status
  - removed the required property `extensions` from the response with the `404` status
  - …1 more
- **2026-10-31** `c2d57aea4875`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/projects/:project_id/edge-rules/order/put.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
