# GET /files/{user}/size

First published 27 Oct 2026 (release 0.2.18) · Unchanged since publication

UrbeStack release 0.2.35 API operation in the files group.

Measure disk usage for a directory or its immediate subdirectories

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

UrbeStack runs du with the customer's permissions on each request and discards the measurements after responding. It measures allocated disk blocks that count toward the account's disk usage, counts each hard-linked file once, stays on the same filesystem, and skips symbolic link targets. If path names a symbolic link, specify the target directory directly.

With inside set to true, the operation measures each immediate subdirectory of path, up to 5000. The du command has 20 seconds to measure disk usage. If time runs out, timed_out is true, folders contains the completed measurements, and unmeasured lists the remaining directories. A directory is marked partial if it contains entries the customer cannot read. Its reported size includes only the blocks that could be counted.

## As a command

- [urbestack-file-size](https://urbestack.com/docs/commands/urbestack-file-size.md): Measures the disk space used by a directory in the customer's home.

## 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): Directory path starting with /. Defaults to /, the customer's home directory.
- `inside` (query, boolean): Whether to measure each immediate subdirectory instead of path itself. Defaults to false.

## 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/size?path=public_html/index.php&inside=1" \
  -H "Authorization: Bearer $TOKEN"
```

Response, 200 OK:

```
{
  "folders": [
    {
      "bytes": 1,
      "name": "alice",
      "partial": true,
      "path": "public_html/index.php"
    }
  ],
  "inside": true,
  "path": "public_html/index.php",
  "seconds": 1,
  "timed_out": true,
  "unmeasured": [
    {
      "name": "alice",
      "path": "public_html/index.php"
    }
  ],
  "user": "alice"
}
```

## Errors

- 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 boolean
- 400: Invalid username: 2 to 32 lowercase letters, digits or underscores, starting with a letter
- 400: Username '<value>' is reserved
- 401: Authentication required
