# POST /backups/run

First published 3 Oct 2026 (release 0.1.0) · Unchanged since publication

UrbeStack release 0.2.35 API operation in the backups group.

Queue a server backup run

- Who may call it: administrator
- Token scope, any of: backups, all
- Answers: 202 Accepted

The response contains the queued job in job. A full run uses the same process as the scheduled nightly run. It writes one archive per eligible customer beside server.json in the day folder under backups.dir, then removes days beyond backups.keep_days. Repeating a full run for the same day replaces that day's archives.

Use day in YYYY-MM-DD format to select the backup day. Use user to back up a single customer regardless of their nightly backup switch. The API returns 400 if day has an invalid format or user names an administrator, and 404 if user names an account that does not exist.

The API returns 403 if the caller lacks administrator privileges and 409 if another server backup run is queued or running, including a scheduled run. It also returns 409 if server backups are off and identifies backups.enabled in the error. The worker runs one job at a time, so other jobs wait while the backup runs.

## Request body

JSON, the type [BackupsRunRequest](https://urbestack.com/docs/api/types/BackupsRunRequest.md).

- `day` (string, matching ^\d{4}-\d{2}-\d{2}$): Name of the backup day folder in YYYY-MM-DD format. Defaults to today's date.
- `user` (Username): Username of the single account to back up, regardless of its nightly backup setting or status. As with Back up now in the web interface, UrbeStack writes an archive in the nightly format and a fresh server.json to the day folder, then skips retention and the remote copy. The operation returns 404 for an unknown username and 400 for an administrator's username.

## Example

Set $API to the base URL and $TOKEN to the token, as the [API overview](https://urbestack.com/docs/api.md) shows.

```
curl -sS -X POST "$API/backups/run" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "day": "2026-09-09",
    "user": "alice"
  }'
```

Response, 202 Accepted:

```
{
  "job": {
    "created_at": "2026-09-09T10:15:00Z",
    "created_by": 1,
    "created_by_name": "text",
    "dismissed_at": "text",
    "finished_at": "2026-09-09T10:15:04Z",
    "id": 1,
    "lane": "short",
    "log": "",
    "params": {},
    "progress": 100,
    "result": {},
    "started_at": "2026-09-09T10:15:01Z",
    "status": "queued",
    "type": "rebuild",
    "usual_seconds": 1
  }
}
```

## Errors

- 400: <name> is an administrator: administrators have no home, so no archive of theirs
- 400: A day is named YYYY-MM-DD
- 400: A new job is queued or running
- 400: Invalid <what>: 
- 400: Invalid username: 2 to 32 lowercase letters, digits or underscores, starting with a letter
- 400: Job parameters must be an object
- 400: Unknown job type
- 400: Username '<value>' is reserved
- 401: Authentication required
- 403: Insufficient privileges
- 404: No user named <user>
- 404: User '<user>' not found
- 409: A backup run is already <j.status> (job <j.id>); one at a time
- 409: The server's backups are off (backups.enabled): turn them on on the Backups page, or with urbestack-setting-set --key backups.enabled --value true
