---
title: "Restore Backup or Point in Time to New Cluster"
method: POST
path: "/postgres/{postgres_cluster_id}/restore"
tags: ["Postgres Clusters"]
---

# Restore Backup or Point in Time to New Cluster

`POST /postgres/{postgres_cluster_id}/restore`

Restore a backup, or a point in time within the cluster's PITR recovery window, into a new Managed Postgres cluster. The source cluster is left unchanged, and a new cluster is provisioned asynchronously.

## Path parameters

- `postgres_cluster_id` string, required

## Request body

- RestorePostgresClusterRequest
  - `backup_id` string — Backup label to restore from, as returned by the backups list. Mutually exclusive with pitr_time.
  - `name` string — Name for the restored cluster. Defaults to a generated name derived from the source cluster and backup/point in time when omitted or blank.
  - `pitr_time` string — Point in time to restore to, as an RFC3339 timestamp with an explicit offset from UTC (e.g. Z or +02:00). Normalized to UTC and must fall within the cluster's PITR recovery window. Mutually exclusive with backup_id.

## Response `201`

New cluster provisioned from the backup or point in time

- ShowPostgresClusterResponse
  - `data` PostgresCluster
    - `attached_apps` PostgresAttachedApp[] — Apps attached to the cluster.
      - `name` string — Attached Fly app name.
    - `cpu_kind` 'shared' | 'performance' — CPU class.
    - `cpus` integer — vCPUs per node.
    - `created_at` string — RFC 3339 creation timestamp.
    - `disk_size_gb` integer — Disk size in gigabytes.
    - `endpoints` PostgresClusterEndpoints
      - `primary` PostgresNodeEndpoints
        - `direct` PostgresEndpoint
          - `host` string — Hostname to connect to.
          - `port` integer — TCP port.
        - `pooler` PostgresEndpoint
          - `host` string — Hostname to connect to.
          - `port` integer — TCP port.
    - `id` string — Cluster ID.
    - `memory_mb` integer — Memory per node in megabytes.
    - `name` string — Cluster name.
    - `organization` OrganizationRef
      - `name` string — Organization name.
      - `slug` string — Organization slug.
    - `pg_major_version` '16' | '17' — Postgres major version.
    - `plan` 'basic' | 'starter' | 'launch' | 'scale' | 'Performance' — Plan slug.
    - `postgis_enabled` boolean — Whether PostGIS support is enabled.
    - `region` string — Fly region code.
    - `replicas` integer — Number of replicas.
    - `status` 'creating' | 'initializing' | 'ready' | 'deleting' | 'deleted' | 'failed' — Current lifecycle status.

## Other responses

- `400` — Restore failed
- `404` — 'Cluster not found' for the cluster; 'Backup <backup_id> not found for cluster <postgres_cluster_id>' for the backup
- `422` — A restore target is missing, both backup_id and pitr_time were supplied, point-in-time restore is outside the recovery window or unavailable, or name is invalid

---

[API](https://skmtc.net/machines/apis/machines-api.md) · [All operations](https://skmtc.net/machines/apis/machines-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/machines/machines-api/revisions/9e3fcdb7f087/schema)
