Snapshot

Restore snapshot

Changed on

Restores the specified snapshot to a new branch, and optionally finalizes the restore operation to replace the original branch.

post/projects/{project_id}/snapshots/{snapshot_id}/restore

Request

  • Base URL: https://console.neon.tech/api/v2
  • URL: https://console.neon.tech/api/v2/projects/{project_id}/snapshots/{snapshot_id}/restore
  • Auth: one of:
    • HTTP bearer
    • API key in cookie zenith
    • API key in cookie keycloak_token

Query parameters

namestring

Deprecated. Use the name field in the request body instead. Removal scheduled for November 29, 2025. A name for the newly restored branch. If omitted, a default name will be generated.

Request body

namestring

A name for the newly restored branch. If not provided, the server generates a unique name for the branch automatically.

target_branch_idstring

ID of the branch to restore the snapshot into. Defaults to the snapshot's source branch (snapshot.source_branch_id); fails if that cannot be determined.

finalize_restoreboolean

Set to true to finalize the restore operation immediately. This will complete the restore and move any associated computes to the new branch, similar to the finalizeRestoreBranch operation. Defaults to false to allow previewing the restored snapshot data first.

Response

Branch restored from snapshot and its operations.

Example response

{
  "branch": {
    "id": "br-wispy-meadow-118737",
    "project_id": "spring-example-302709",
    "parent_id": "br-aged-salad-637688",
    "parent_lsn": "0/1DE2850",
    "name": "dev2",
    "protected": false,
    "current_state": "ready",
    "state_changed_at": "2022-11-30T20:09:48Z",
    "creation_source": "console",
    "created_at": "2022-11-30T19:09:48Z",
    "updated_at": "2022-12-01T19:53:05Z",
    "default": true,
    "init_source": "parent-data",
    "data_transfer_bytes": 72911987,
    "written_data_bytes": 542998300,
    "compute_time_seconds": 823880990,
    "active_time_seconds": 922200,
    "cpu_used_sec": 461100
  },
  "endpoints": [
    {
      "host": "ep-silent-smoke-806639.us-east-2.aws.neon.tech",
      "id": "ep-silent-smoke-806639",
      "name": "My cool compute",
      "project_id": "spring-example-302709",
      "branch_id": "br-wispy-meadow-118737",
      "autoscaling_limit_min_cu": 1,
      "autoscaling_limit_max_cu": 1,
      "region_id": "aws-us-east-2",
      "type": "read_write",
      "current_state": "init",
      "pending_state": "active",
      "settings": {
        "pg_settings": {}
      },
      "pooler_enabled": false,
      "pooler_mode": "transaction",
      "disabled": false,
      "passwordless_access": true,
      "creation_source": "console",
      "created_at": "2022-12-03T15:37:07Z",
      "updated_at": "2022-12-03T15:37:07Z",
      "proxy_host": "us-east-2.aws.neon.tech",
      "suspend_timeout_seconds": 0,
      "provisioner": "k8s-neonvm"
    }
  ],
  "operations": [
    {
      "id": "d8ac46eb-a757-42b1-9907-f78322ee394e",
      "project_id": "spring-example-302709",
      "branch_id": "br-wispy-meadow-118737",
      "endpoint_id": "ep-silent-smoke-806639",
      "action": "start_compute",
      "status": "finished",
      "failures_count": 0,
      "created_at": "2022-11-15T20:02:00Z",
      "updated_at": "2022-11-15T20:02:02Z",
      "total_duration_ms": 200
    }
  ]
}

Changes

    • ●

      added the new epc_sync enum value to the ////// response property for the response status

    • ●

      added the new tenant_attach_safekeepers enum value to the ////// response property for the response status

    • ●

      added the new tenant_detach_safekeepers enum value to the ////// response property for the response status