# POST /users/{name}/backup-excludes

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

UrbeStack release 0.2.35 API operation in the backups group.

Add a backup exclusion for a customer

- Who may call it: administrator, reseller, customer
- Token scope, any of: backups, all
- Answers: 201 Created

An administrator or the customer can add an exclusion. Specify path relative to the customer's home directory, for example web/example.com/public_html/cache. Use at most 255 characters drawn from letters, digits, dots, underscores, hyphens and slashes. The API returns 400 for an invalid path, including a path with a leading slash or a .. component.

An administrator can set locked to true to prevent the customer from editing or removing the exclusion. The API returns 403 if another caller sets locked to true. The response contains the new exclusion in exclude.

## As a command

- [urbestack-backup-exclude-add](https://urbestack.com/docs/commands/urbestack-backup-exclude-add.md): Adds a path to the customer's backup exclusions.

## Parameters

- `name` (path, Username, required)

## Request body

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

- `path` (string, up to 255 characters, required): Path relative to the customer's home directory. A leading slash and .. are prohibited.
- `locked` (boolean): Whether to lock the exclusion against customer edits and removal. Only administrators can set this field.

## 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/users/alice/backup-excludes" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "locked": true,
    "path": "public_html/index.php"
  }'
```

Response, 201 Created:

```
{
  "exclude": {
    "created_at": "2026-09-09T10:15:00Z",
    "id": 1,
    "locked": true,
    "path": "public_html/index.php"
  }
}
```

## Errors

- 400: --path is required
- 400: --user is required
- 400: A path to leave out is at most 255 characters
- 400: A path to leave out is relative to the home, like web/example.com/public_html/cache: letters, digits, dots, dashes and slashes, no .. and no leading slash
- 400: An administrator has no home to back up
- 400: Invalid boolean
- 400: Invalid relative path
- 400: Invalid username: 2 to 32 lowercase letters, digits or underscores, starting with a letter
- 400: Username '<value>' is reserved
- 401: Authentication required
- 403: Only an administrator locks a row
- 404: Unknown user <user>
- 409: <path> is already left out
