restore_database #

View this page as Markdown

On this page

Generated automatically from the published contract sources.

A script calls this action over HTTPS at POST https://tzcloud.turnzero.ai/v1/restore_database, with a bearer credential and the action's payload as the JSON body. An MCP connection lists this action as the tool tzcloud_restore_database.

OAuth access tokens and minted tokens, including the turnzero command's computer token, are bearer credentials. The action determines which kinds, scopes and grants it accepts (Sign-in, sessions, and tokens).

Build metadata: Registered in this build. Registration describes the default dispatcher in this build. It does not guarantee that a caller has the required credential or grant, that a tool is listed for that connection, or that the required service is configured.

Contract description #

Restore your application's dedicated production database to a UTC instant at the owner's request. Confirm the instant and data loss with the owner. The 202 response gives a browser approval link. A completed approval returns the restore's move ID. Match that ID in production's database_move from read_status with wait_seconds. The outcome done confirms the restore. If it reads reverted, the original database is back in use. For a shared database, ask support.

More about this action #

Use this action for your application's dedicated production database with a credential that admits destructive actions. Development stays unchanged. For a shared database, ask support at support@turnzero.ai.

Pass application and point_in_time. Use a UTC instant to the second, such as 2026-11-23T14:03:48Z. Pick a time at least five minutes ago and within the last 35 days. It must be at or after both the server's creation and the switch that put the database on it. Confirm the instant with the owner before requesting the restore. Future restores cannot reach before this restore's switch.

A successful restore uses the schema and data as they were at that time. It discards later changes, including inserts, updates and deletes made while Turn Zero prepares the restored copy. Production's serving version is redeployed on the restored database. A startup migration can run again if the serving version contains it and the restored database has no record of it. To undo a migration, roll production back to a version without it first. Then choose an instant before the migration's applied time in schema_migrations.

The 202 response gives pending_action and approval_url. Give the owner the link for browser approval. A decline or expiry changes nothing. Read read_approval_status with the pending action's ID. A completed approval means the restore started. Read read_status with wait_seconds for production's database_move. Its point_in_time gives the restore instant. Its outcome is null until it ends as done or reverted.

Production keeps serving while the platform prepares a new dedicated server of the same size. Production is unavailable from freeze until the redeploy succeeds or a revert restores it. Production deploys and promotes return database_move_in_flight until the whole move ends. Retry them afterward.

The restore removes any earlier move's kept copy first. It keeps the database that served before this restore for one day. You cannot switch back to that kept copy. A restore costs nothing extra. The account is not charged for the new server or for the kept copy.

If the restore returns HTTP 503 with dedicated_capacity, read the detail. Wait for a move to end if too many are running. If the cell or region has no room for a restored server, ask support.

For a time refusal, use the allowed range and boundary in the detail. If the platform cannot tell when the database began serving on its server, or cannot read the server's size, ask support. For a paused account, wait for the scheduled reset or ask support. If a move or production deploy is in flight, wait for it to end.

If approval ends with job_run_in_flight, read the job run before requesting the restore again. Wait if it is still starting or running. A run that Cloud began starting can still block the database request if it was cancelled, timed out or ended without a recorded provider execution. The block lasts until more than the run's timeout plus 90 seconds have passed since Cloud began starting it. For a retry estimate, add the job's timeout for that run plus three minutes to requested_at.

Access and action metadata #

{
  "name": "restore_database",
  "resource": "application",
  "tier": "destructive",
  "surface": "tzcloud",
  "addresses": [
    "tzcloud"
  ],
  "product": "cloud",
  "summary": "Restore your application's dedicated production database to a UTC instant. The 202 response gives a pending action and a link for browser approval. Approval starts the restore on a new server of the same size. Production stops during the switch and redeploy. For a shared database, ask support.",
  "annotations": {
    "readOnlyHint": false,
    "destructiveHint": true,
    "openWorldHint": true
  }
}

MCP catalog entry #

{
  "name": "restore_database",
  "title": "Restore a production database",
  "tier": "destructive",
  "scenario": "API-L0-33",
  "summary": "Restore your application's dedicated production database to a UTC instant at the owner's request. Confirm the instant and data loss with the owner. The 202 response gives a browser approval link. A completed approval returns the restore's move ID. Match that ID in production's `database_move` from `read_status` with `wait_seconds`. The outcome `done` confirms the restore. If it reads `reverted`, the original database is back in use. For a shared database, ask support.",
  "owners": [
    "API-L0-33"
  ]
}

request #

JSON pointer Description and constraints
"" (root) Type: object
Required fields: ["application","point_in_time"]
/properties/application Your own application's ID from list_applications. The application must have a dedicated production database.

Type: string
/properties/point_in_time The restore time in UTC to the second, such as 2026-11-23T14:03:48Z. Use a time at least five minutes ago, within 35 days, and at or after the server's creation and the switch that put the database there.

Type: string
Format: date-time
Pattern: ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$
/properties/request_id Any string you choose. A repeat from the same account while the earlier pending action is live (requested, approved, or executing) returns it again; once it has ended, it starts a new one. Omitted, every call creates a new one.

Type: string

response #

JSON pointer Description and constraints
"" (root) The 202 response gives the pending action and browser approval link. Read read_approval_status for the outcome. A successful approval starts the restore. A decline or expiry changes nothing.

Type: object
Required fields: ["contract_version","pending_action","approval_url"]
/properties/contract_version Required value: 1
/properties/reference The short reference the platform recorded your call under: ten lowercase hexadecimal characters, the value in the call’s record row. Quote it when you report the call.

Type: string
Pattern: ^[0-9a-f]{10}$
/properties/pending_action The pending action for browser approval. Its successful outcome describes the restore that started.

/properties/pending_action/allOf/0 $ref: #/shapes/pending_action
/properties/pending_action/allOf/1 Type: object
/properties/pending_action/allOf/1/properties/outcome The successful approval outcome records the start of the restore. A failed execution gives its refusal.

Type: ["object","null"]
/properties/pending_action/allOf/1/properties/outcome/properties/application The application whose production database restore started.

Type: string
/properties/pending_action/allOf/1/properties/outcome/properties/size The dedicated size that the restored production database keeps.

Type: string
Allowed values: ["database-dedicated-2gb","database-dedicated-4gb","database-dedicated-8gb"]
/properties/pending_action/allOf/1/properties/outcome/properties/move The restore's first recorded move state.

Type: object
Required fields: ["id","phase","started_at","point_in_time"]
/properties/pending_action/allOf/1/properties/outcome/properties/move/properties/id The identifier of the database move that started.

Type: string
/properties/pending_action/allOf/1/properties/outcome/properties/move/properties/phase The move's phase when its start was recorded.

Type: string
/properties/pending_action/allOf/1/properties/outcome/properties/move/properties/started_at The UTC instant the move's first record was created.

Type: string
Format: date-time
/properties/pending_action/allOf/1/properties/outcome/properties/move/properties/point_in_time The chosen UTC instant for the production database restore.

Type: string
Format: date-time
/properties/pending_action/allOf/1/properties/outcome/properties/detail Confirms the restore started and production deploys and promotes are refused until the move ends. Follow progress with read_status.

Type: string
/properties/approval_url Open this link in the browser for the person to approve or decline the pending action.

Type: string
/properties/detail Says a destructive action completes only through browser approval, directs you to give the person the link, and points to read_approval_status for the outcome.

Type: string

Complete payload contract #

{
  "request": {
    "type": "object",
    "required": [
      "application",
      "point_in_time"
    ],
    "properties": {
      "application": {
        "type": "string",
        "description": "Your own application's ID from `list_applications`. The application must have a dedicated production database."
      },
      "point_in_time": {
        "type": "string",
        "format": "date-time",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$",
        "description": "The restore time in UTC to the second, such as 2026-11-23T14:03:48Z. Use a time at least five minutes ago, within 35 days, and at or after the server's creation and the switch that put the database there."
      },
      "request_id": {
        "type": "string",
        "description": "Any string you choose. A repeat from the same account while the earlier pending action is live (requested, approved, or executing) returns it again; once it has ended, it starts a new one. Omitted, every call creates a new one."
      }
    }
  },
  "response": {
    "type": "object",
    "description": "The 202 response gives the pending action and browser approval link. Read `read_approval_status` for the outcome. A successful approval starts the restore. A decline or expiry changes nothing.",
    "required": [
      "contract_version",
      "pending_action",
      "approval_url"
    ],
    "properties": {
      "contract_version": {
        "const": 1
      },
      "reference": {
        "type": "string",
        "pattern": "^[0-9a-f]{10}$",
        "description": "The short reference the platform recorded your call under: ten lowercase hexadecimal characters, the value in the call’s record row. Quote it when you report the call."
      },
      "pending_action": {
        "allOf": [
          {
            "$ref": "#/shapes/pending_action"
          },
          {
            "type": "object",
            "properties": {
              "outcome": {
                "type": [
                  "object",
                  "null"
                ],
                "description": "The successful approval outcome records the start of the restore. A failed execution gives its refusal.",
                "properties": {
                  "application": {
                    "type": "string",
                    "description": "The application whose production database restore started."
                  },
                  "size": {
                    "type": "string",
                    "enum": [
                      "database-dedicated-2gb",
                      "database-dedicated-4gb",
                      "database-dedicated-8gb"
                    ],
                    "description": "The dedicated size that the restored production database keeps."
                  },
                  "move": {
                    "type": "object",
                    "required": [
                      "id",
                      "phase",
                      "started_at",
                      "point_in_time"
                    ],
                    "description": "The restore's first recorded move state.",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "The identifier of the database move that started."
                      },
                      "phase": {
                        "type": "string",
                        "description": "The move's phase when its start was recorded."
                      },
                      "started_at": {
                        "type": "string",
                        "format": "date-time",
                        "description": "The UTC instant the move's first record was created."
                      },
                      "point_in_time": {
                        "type": "string",
                        "format": "date-time",
                        "description": "The chosen UTC instant for the production database restore."
                      }
                    }
                  },
                  "detail": {
                    "type": "string",
                    "description": "Confirms the restore started and production deploys and promotes are refused until the move ends. Follow progress with `read_status`."
                  }
                }
              }
            }
          }
        ],
        "description": "The pending action for browser approval. Its successful outcome describes the restore that started."
      },
      "approval_url": {
        "type": "string",
        "description": "Open this link in the browser for the person to approve or decline the pending action."
      },
      "detail": {
        "type": "string",
        "description": "Says a destructive action completes only through browser approval, directs you to give the person the link, and points to `read_approval_status` for the outcome."
      }
    }
  }
}

Shared contracts #