# POST /files/{user}/copy

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

UrbeStack release 0.2.35 API operation in the files group.

Copy entries into a directory in a customer's home

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

Supply 1 to 1000 source paths in paths and the destination directory in to. An invalid paths list returns 400. The operation uses the customer's permissions, copies directories recursively, preserves modes and timestamps, and copies symbolic links as links.

If a destination name is already in use, UrbeStack gives the copy a numbered name such as report (2).pdf. Copying an entry into its current directory creates a duplicate. The operation refuses to copy a directory into itself.

## Parameters

- `user` (path, Username, required): Username of the customer who owns the home directory. Administrators can specify any customer, and customers can specify only themselves.

## Request body

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

- `paths` (array of HomePath, required)
- `to` (HomePath, required): Destination directory for the entries.

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

Response, 200 OK:

```
{
  "copied": [
    {
      "from": "text",
      "to": "text"
    }
  ],
  "count": 1
}
```

## Errors

- 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: Username '<value>' is reserved
- 401: Authentication required
