Edge Rules

Create an edge rule

Changed on

The rule is enforced by every proxy within seconds. Create it with mode: log_only to watch what it would match before it acts.

post/projects/{project_id}/edge-rules

Request

  • Base URL
    /api (relative, and the document was published on a file host, not at the API’s origin)
  • Auth
    HTTP bearer

Path parameters

project_idinteger required

Project ID

Request body

enabledboolean
environment_idinteger nullable
mode'enforce' | 'log_only'

enforce acts on matches; log_only (the default) records them without acting, so a new rule can be watched before it enforces.

namestring nullable

Up to 80 characters. Left empty, a name is generated from the rule, e.g. "Block when path starts with /admin".

positioninteger nullable

Where to insert the rule (0 = first). Defaults to the end.

Response

Rule created

created_atstring date-time required
enabledboolean required
environment_idinteger nullable

null applies the rule to every environment of the project.

hitsinteger required

Requests this rule has matched, across every proxy. Counters are flushed every few seconds.

idinteger required
last_hit_atstring date-time nullable
mode'enforce' | 'log_only' required

log_only evaluates the rule and records matches but never acts.

namestring required
positioninteger required

0-based evaluation order. The first rule that decides wins.

project_idinteger required
revisioninteger required

Edit counter. Send it back on update so a concurrent change is refused instead of overwritten.

summarystring required

The rule in one sentence, e.g. "Block with 403 when path starts with /admin".

updated_atstring date-time required

Example response

{
  "created_at": "2026-10-31T09:30:00Z",
  "last_hit_at": "2026-10-31T09:30:00Z",
  "updated_at": "2026-10-31T09:30:00Z"
}

Changes

    • breaking

      removed the required property extensions from the response with the status

    • breaking

      removed the required property extensions from the response with the status

    • breaking

      removed the required property extensions from the response with the status

    3 more changes in this revision