# PATCH /users/{name}

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

UrbeStack release 0.2.35 API operation in the users group.

Update a user account

- Who may call it: administrator, reseller, customer
- Token scope, any of: users, all
- Answers: 200 OK

Any user can change their own email address and password. Administrators can manage any account. Resellers can change their customers' email addresses, passwords, status, packages, shell access and nightly backup settings. Changing role or owner requires an administrator. The API returns 403 for a change the caller lacks permission to make. It returns 400 if the request specifies no changes or if an administrator tries to change their own role, status, shell, backups or owner. An administrator can change their own package.

Changing your own password requires current_password. It revokes your other sessions and preserves the calling token and manually created tokens. Resetting another account's password or suspending an account revokes all of that account's tokens. A new password must contain 8 to 128 printable characters. For a customer, it also sets the password used for SFTP and shell access.

Pass an empty string in email to clear the email address or in package to remove the package and its limits. An invalid package name returns 400. Changing an administrator's email address or moving an account into or out of the administrator role updates delivery of root's mail.

Use active or suspended for status. Other values return 400. For a customer, suspension also disables their mailboxes in Dovecot and their domains' senders in Postfix. Reactivation restores both. Accounts suspended for a server move must be reactivated through the move workflow. For a copy awaiting cutover, use the Move section of the web interface or urbestack-move-cutover --user NAME. For a frozen account on the source server, use urbestack-move-source-release --user NAME. Add --take-back to the latter if the account has already moved.

For an account with a Linux account, set shell to true to enable Bash access and remove the SFTP jail. Set shell to false to restore jailed SFTP access and end running system sessions. For an account with a home directory, set backups to false to exclude it from nightly server backups. Set it to true to restore the default inclusion. Customers can still request backups.

Set owner to a reseller's name to transfer the customer, or pass an empty string to transfer the customer to the administrator. Change or clear a package belonging to the former reseller before or during the transfer. A transfer to a reseller must fit their customer count, disk and bandwidth limits. Increasing a customer's disk or bandwidth allowance must also fit their reseller's limits. To change a customer's role, first place the customer under the administrator. To change a reseller's role, first reassign all their customers.

The response contains the updated account in user. For customers and resellers, home gives the path configured through home_base and uid gives the Linux user ID, or null if the Linux account is missing. Both fields are null for administrators.

## As a command

- [urbestack-user-set](https://urbestack.com/docs/commands/urbestack-user-set.md): Updates an existing UrbeStack account.

## Parameters

- `name` (path, Username, required)

## Request body

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

- `backups` (boolean): Whether the customer is included in the server's nightly backup run. Only administrators can change this setting.
- `current_password` (string, up to 128 characters): Current password, required when users change their own password.
- `email` (string, up to 254 characters or null): New email address. Use null or an empty string to remove it.
- `owner` (string, up to 32 characters or null): New reseller for the customer, or an empty string for direct ownership by the administrator. Only administrators can move the customer, and UrbeStack refuses the move if the customer still uses a package belonging to the current owner or the move would exceed the new owner's limit.
- `package` (string, up to 64 characters or null): Package, which only administrators can change. Use null or an empty string to remove the assignment.
- `password` (string, up to 128 characters)
- `role` (Role): Role, which only administrators can change.
- `shell` (boolean): Customer shell access, which only administrators can change. Turning it off ends the customer's active sessions, and either setting preserves the customer's files.
- `status` (string, one of active, suspended): Status, which only administrators can change. Suspending a customer disables their mailboxes and senders in the mail stack.

## 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 PATCH "$API/users/alice" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "backups": true,
    "current_password": "text",
    "email": "alice@example.com",
    "owner": "text",
    "package": "basic",
    "password": "Sup3r-Secret-Passphrase",
    "role": "user",
    "shell": true,
    "status": "active"
  }'
```

Response, 200 OK:

```
{
  "user": {
    "backups": true,
    "bandwidth_bytes": 1,
    "bandwidth_cut": true,
    "bandwidth_cut_at": "text",
    "bandwidth_limit_bytes": 1,
    "created_at": "2026-09-09T10:15:00Z",
    "customers": 1,
    "disk_limit_bytes": 1,
    "email": "alice@example.com",
    "home": "text",
    "id": 1,
    "move_state": "leaving",
    "name": "alice",
    "owner": "text",
    "owner_id": 1,
    "package": "basic",
    "package_backups": true,
    "package_id": 1,
    "package_shell": true,
    "role": "user",
    "second_factor": true,
    "shell": true,
    "status": "active",
    "system_password": true,
    "uid": 1
  }
}
```

## Errors

- 400: --name is required
- 400: <name> has an owner: move them to the administrator before changing their role
- 400: <name> is an administrator: administrators have no home, so nothing to back up
- 400: <name> is an administrator: administrators have no system account
- 400: <name> is an administrator: administrators have no system account, so no shell
- 400: Cannot demote or suspend the last active administrator
- 400: Domain name required
- 400: Domain name too long
- 400: Invalid IPv4 address
- 400: Invalid IPv6 address
- 400: Invalid boolean
- 400: Invalid domain name
- 400: Invalid email address
- 400: Invalid id
- 400: Invalid package name
- 400: Invalid password hash
- 400: Invalid password: 8 to 128 printable characters
- 400: Invalid port
- 400: Invalid role: admin, user or reseller
- 400: Invalid setting key
- 400: Invalid status
- 400: Invalid system password hash
- 400: Invalid username: 2 to 32 lowercase letters, digits or underscores, starting with a letter
- 400: Nothing to change
- 400: Only a customer has an owner: an administrator or a reseller is the administrator's own
- 400: The second factor can only be turned off here; a user enrols from their own page
- 400: Username '<value>' is reserved
- 400: You cannot change your own role, status, shell, backups or owner
- 400: status must be active or suspended
- 401: Authentication required
- 401: The password is not the panel password
- 403: Only an administrator changes a user's <k>
- 403: Only an administrator or the customer's reseller changes a user's <k>
- 404: Setting '<key>' not found
- 404: User '<name>' not found
- 409: <name> is on the package <p.name> of the reseller <p.owner>: change the package before the move
- 409: <name> owns <owned> 
- 409: <who> and its bandwidth for the month is used up: 
- 409: <who> and its disk is used up: 
- 409: The package <p.name> allows <limit> 
