Get your free beta license ↗
API operation · backups group
POST

/users/{name}/backups/restore

First published 3 Oct 20260.1.0Unchanged since publication

Queue a customer restore from an on-demand or nightly backup archive

Who may call it
AdministratorResellerCustomer
Token scope, any of
backupsall
Answers202 Accepted

Use own for an on-demand archive or day for a nightly archive. A nonempty own takes precedence over day. The archive must be an UrbeStack customer archive with a matching schema version. Choose one scope. The default, everything, restores account records, the home directory including mail, and every database in the archive. Use files for the home directory excluding mail, mail for mailbox contents, database for one database dump, or records for account records. With database scope, the named database must have a dump in the archive.

The API returns 400 if the target account is an administrator, neither archive selector is supplied, the selected value has an invalid format, own ends in .part, scope is invalid, or database is missing or invalid for database scope. The API returns 409 if a restore or on-demand backup for the customer is already queued or running. For customers and resellers, the API returns 403 if the package excludes on-demand backups or if day is selected while either backups.enabled or backups.nights_for_customers is off. Only an administrator can restore a suspended account.

For a customer or reseller, UrbeStack treats the archive as untrusted and restores into the account specified by name, regardless of the account named in the archive. An archive selected by own must be a regular file owned by the customer. Symbolic links are refused. UrbeStack extracts files and mail with tar running as the customer and loads dumps as the customer's phpMyAdmin user, rewriting every DEFINER to that user so the restore can access only the customer's databases.

Customer restores validate records using the same rules as manual changes. For existing domains, they can restore DNS records, mail accounts and their passwords, forwarders, filters, autoresponders, mailing lists, customer-configurable mail settings and FTP accounts. They can also restore databases with their users and grants, SSH keys, backup exclusions and cron jobs. The job result identifies omissions involving domains, domain settings, administrator-only settings and the customer account itself.

Administrator restores run as root and warn if the archive is owned by another user. An administrator restore using own requires the archive to name the specified customer. It recreates missing databases, database users and grants from the archive, and dumps replace the tables covered by their DROP TABLE statements. Restored files and records are applied over the existing account, replacing matching entries.

The response contains the queued restore job in job. The job reports progress, stops at the first failure and lists the steps completed before it.

As a command

Run as root on the server

Parameters

namepath ·UsernameRequired

Request body

JSON· 4 fields
databasestring
Name of the database to restore, required when scope is database. Use 1 to 64 ASCII letters, digits or underscores.
daystring, matching ^\d{4}-\d{2}-\d{2}$
Date of the server's nightly backup in YYYY-MM-DD format.
ownstring
Filename of a completed archive in the customer's backups/ directory. It starts with an ASCII letter or digit, followed by up to 200 ASCII letters, digits, dots, underscores or hyphens, and ends in .tar.gz.
scopestring, one of everything, files, mail, database, records

Example

See the API overview for how to set $API and $TOKEN.
Request
curl -sS -X POST "$API/users/alice/backups/restore" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "database": "alice_shop",
    "day": "2026-09-09",
    "own": "text",
    "scope": "everything"
  }'
Response · 202 Accepted
{
  "job": {}
}

Errors

19 errors, each a status and a sentence
400<f> is still being written
400A database name is letters, digits and underscores
400A day is named YYYY-MM-DD
400A new job is queued or running
400An administrator has no home to restore into
400An archive is named <user>-<date>-<time>.tar.gz
400Invalid <what>:
400Invalid username: 2 to 32 lowercase letters, digits or underscores, starting with a letter
400Job parameters must be an object
400Name the archive: own, one of the customer's, or day, a night of the server
400The database scope names the database
400The scope is one of
400Unknown job type
400Username '<value>' is reserved
401Authentication required
403Nightly backups aren't available to customers on this server. Restore from one of the account's on-demand backups instead.
403The package <p.name> does not include <SWITCH_WHAT>{<switch>}
404User '<user>' not found
409A restore or a backup of <name> is already <j.status> (job <j.id>); one at a time
Generated from release 0.2.35 (current) · the API’s own descriptionThis entry has been unchanged since it was first published in release 0.1.0 on 3 Oct 2026.
urbestack.com/docs/api/post-users-name-backups-restore/