# POST /files/{user}/extract

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

UrbeStack release 0.2.35 API operation in the files group.

Extract an archive in a customer's home

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

The operation uses the customer's permissions and the Linux distribution's unzip for .zip archives or tar for .tar, .tar.gz, and .tgz archives. By default, it extracts into the archive's parent directory and overwrites entries with matching names. To extract into a new directory, specify its path in into. That path must be unused.

If a .zip archive's uncompressed size exceeds the account's remaining disk space, the operation refuses it before extracting anything. For .tar, .tar.gz, and .tgz archives, extraction proceeds until it completes or the account runs out of disk space.

## As a command

- [urbestack-file-extract](https://urbestack.com/docs/commands/urbestack-file-extract.md): Extracts an archive in a customer's home directory with the customer's filesystem permissions.

## 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 [FileExtract](https://urbestack.com/docs/api/types/FileExtract.md).

- `path` (HomePath, required): A path within the customer's home directory, with / representing the home directory itself. The path cannot contain .. components or control characters.
- `into` (HomePath): Path of a new directory to create for extraction, which must not already exist. If into is omitted, the archive is extracted into the directory that contains it.

## 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/extract" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "into": "text",
    "path": "public_html/index.php"
  }'
```

Response, 200 OK:

```
{
  "into": "text",
  "path": "public_html/index.php",
  "tool": "text",
  "warnings": "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> 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
