# GET /files/{user}/download

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

UrbeStack release 0.2.35 API operation in the files group.

Download a file or download a directory as a ZIP archive

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

UrbeStack streams downloads without a size limit, without buffering the full download in memory, and without saving a copy on the server. If a failure occurs after streaming begins, the response ends early without an error message.

A file is returned as application/octet-stream with Content-Length. To resume a file download, send Range: bytes=N-. The offset N can contain up to 18 decimal digits. A partial response returns 206 with Content-Range. A zero offset or an unsupported Range format yields the full file with status 200.

A directory is returned as a streamed application/zip archive with status 200. The response omits Content-Length and ignores Range. The archive excludes symbolic links and excludes Trash when downloading the home directory. To create an archive that preserves symbolic links, use POST /files/{user}/compress.

The server allows two concurrent downloads in total and one per account. A request that exceeds either limit returns 429.

## 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.
- `path` (query, HomePath, required): Required path to the file or directory, starting with /. Use / to download the customer's home directory.

## 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 GET "$API/files/alice/download?path=public_html/index.php" \
  -H "Authorization: Bearer $TOKEN"
```

Response, 200 OK:

The response body is the file itself.

## 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
