# POST /files/{user}/trash

First published 14 Oct 2026 (release 0.2.0) · Unchanged since publication

UrbeStack release 0.2.35 API operation in the files group.

Move entries to the customer's Trash

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

UrbeStack moves entries within the home using the customer's permissions. The move is quick regardless of entry size. Each entry goes to /.trash/DAY/WHERE/NAME, where DAY is the deletion date, WHERE encodes the original parent directory, and NAME is the entry's name. Trashed entries still count toward the account's disk usage. Use POST /files/{user}/trash/restore to restore them before nightly cleanup permanently deletes entries whose deletion day is older than files.trash_days.

This operation refuses entries already in the Trash. Use POST /files/{user}/delete to delete them permanently, or pass /.trash to that operation to empty the Trash.

Give 1 to 1000 paths in paths. Each path starts with /, which represents the home directory. UrbeStack normalizes repeated slashes and . components. The API returns 400 for an invalid list, a missing path, a path that lacks the leading / or contains a control character or a .. component, a path over 4096 characters, or a component over 255 characters. It also returns 400 if user identifies an administrator.

## As a command

- [urbestack-file-trash](https://urbestack.com/docs/commands/urbestack-file-trash.md): Moves entries to the customer's Trash using the customer's permissions.

## Parameters

- `user` (path, Username, required): Username of the customer whose entries to move to the Trash. Administrators can select any customer, and customers can select only themselves.

## Request body

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

- `paths` (array of HomePath, required)

## 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/files/alice/trash" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "paths": [
      "text"
    ]
  }'
```

Response, 200 OK:

```
{
  "count": 1,
  "keep_days": 1,
  "trashed": [
    {
      "path": "public_html/index.php",
      "to": "text"
    }
  ]
}
```

## Errors

- 400: --path is required
- 400: --user is required
- 400: <name> is an administrator: administrators have no home
- 400: <what> climbs out of the home with ..
- 400: <what> has a name over 255 characters
- 400: <what> holds a control character
- 400: <what> is required
- 400: <what> is too long
- 400: <what> may hold at most 1000 paths
- 400: <what> must be a list of at least one path
- 400: <what> must start with /, which is the home
- 400: Invalid username: 2 to 32 lowercase letters, digits or underscores, starting with a letter
- 400: Nothing to delete
- 400: Username '<value>' is reserved
- 401: Authentication required
