---
title: "corestack_nginx_rules_revert"
url: https://docs.corefinity.com/mcp/tools/corestack_nginx_rules_revert
type: tool
last_updated: 2026-11-13
feature: nginx-rules
related:
  - https://docs.corefinity.com/api/reference/site-settings/restore-site-nginx-revision.md
  - https://docs.corefinity.com/guides/sites/site-settings/web-server-rules.md
---
# corestack_nginx_rules_revert

**Restore an nginx rules revision.** Restore an earlier nginx rules revision on an environment row: its four hooks become a new revision, checked, tested and saved like any change (rolled back automatically if the platform rejects it). Needs the version corestack_nginx_rules_get answered. Scope: write. Long-running: answers with a task.

- Scope: `write`
- Runs as a task: yes

## When to use it

Restore an earlier nginx rules revision on an environment row: its four hooks become a new revision, checked, tested and saved like any change (rolled back automatically if the platform rejects it). Needs the version corestack_nginx_rules_get answered.

Every hook takes the old revision's text, a hook it did not have included (cleared). The answer and the task are corestack_nginx_rules_update's.

## Inputs

- `site_id` (integer, ≥ 1, required): The environment row.
- `revision_id` (integer, ≥ 1, required): The revision to restore (from corestack_nginx_rules_history_list).
- `version` (integer, ≥ 0, required): The version from corestack_nginx_rules_get.
- `note` (string, at most 200 characters): Why, shown in the history (default "Restored revision N").
- `test_id` (integer, ≥ 1): A passed test for this same content.
- `apply` (string, `now` or `tonight`): Only when the restored rules adopt the runtime update on save: now or tonight. Default now.

### Input schema

```json
{
  "additionalProperties": false,
  "properties": {
    "apply": {
      "default": "now",
      "description": "Only when the restored rules adopt the runtime update on save: now or tonight. Default now. window: the row's next maintenance window (tonight is kept as its alias).",
      "enum": [
        "now",
        "window",
        "tonight"
      ],
      "type": "string"
    },
    "note": {
      "description": "Why, shown in the history (default \"Restored revision N\").",
      "maxLength": 200,
      "type": "string"
    },
    "revision_id": {
      "description": "The revision to restore (from corestack_nginx_rules_history_list).",
      "minimum": 1,
      "type": "integer"
    },
    "site_id": {
      "description": "The environment row.",
      "minimum": 1,
      "type": "integer"
    },
    "test_id": {
      "description": "A passed test for this same content.",
      "minimum": 1,
      "type": "integer"
    },
    "version": {
      "description": "The version from corestack_nginx_rules_get.",
      "minimum": 0,
      "type": "integer"
    }
  },
  "required": [
    "site_id",
    "revision_id",
    "version"
  ],
  "type": "object"
}
```

## Refusals

- `stale`: the rules changed since `version` was read; read them again with corestack_nginx_rules_get.
- `nginx_invalid`: the policy refused the rules; `details.diagnostics` lists each error with hook, file line and column.
- `nginx_test_failed`: nginx -t failed on the environment's nginx; `details.diagnostics`.
- `hook_unavailable`: a hook (or a rule) needs the one-time runtime update, which cannot be turned on for this environment yet.
- `nginx_rules_locked`: Corefinity staff hold this environment's nginx rules.
- `busy`: another change runs on the environment; retry when it ends.
- `change_pending`: a change is queued for tonight.
- `batch_window`: adopting now is not possible outside the environment's window; send `apply: tonight`.
- `migration_halted`: the night's migration is halted; send `apply: tonight`.
- `apm_provenance_unreadable`, `image_volume_unsupported`, `legacy_module_unmapped`: the runtime update cannot be turned on until Corefinity checks the environment (contact support).
- `too_large`: a hook is over its size limit.
- `managed_elsewhere` (message: "This site is managed by another control panel"): another control panel manages this site, so use that control panel for it. This is refused before anything else about the site, as in the Control Panel and the API. Nothing was done.
- The refusals every tool can answer: `invalid_arguments`, `tenant_mismatch`, `scope_required`, `pin_refused`, `rate_limited`, `temporarily_unavailable`, `internal_error` (corestack://guides/how-this-server-works).

## Example

```json
{
  "name": "corestack_nginx_rules_revert",
  "arguments": {
    "site_id": 4211,
    "revision_id": 812,
    "version": 7
  }
}
```

## Path apps

A revert restores the revision's path apps and gates with its four hooks: the environment's whole list becomes the revision's (a revision without any clears the list). The restored list is checked as any saved one: a record the policy refuses is `nginx_invalid` with the record named in `details.diagnostics` (hook `path_apps`). While this environment cannot serve path apps (corestack_nginx_rules_get answers `path_apps.available` false), the hooks are restored and the current list is kept.

## Prompt

```text
Using the Corefinity MCP server, call corestack_nginx_rules_revert with site_id 4211, revision_id 812, version 7. (Restore an nginx rules revision.) Tell me what it returned.
```

## The same task elsewhere

- Endpoint: [POST /api/corestack/sites/{site}/nginx-rules/revisions/{revision}/revert](https://docs.corefinity.com/api/reference/site-settings/restore-site-nginx-revision.md)
- Guide: [Web server rules](https://docs.corefinity.com/guides/sites/site-settings/web-server-rules.md)
