# POST /profile/files

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

UrbeStack release 0.2.35 API operation in the export group.

Register a hand-edited file for profile exports

- Who may call it: administrator
- Token scope, any of: settings, all
- Answers: 201 Created

Set path to the absolute path of an existing regular file of up to 1 MB, such as /etc/php.d/99-custom.ini. For a symbolic link, register its target. Each path can be registered once. The optional note accepts up to 200 printable ASCII characters.

The API returns 400 for a missing or malformed path or an invalid note. Path components may contain word characters and the characters .+@%:-. The components . and .. are forbidden. The API also returns 400 for paths under UrbeStack's own directories or under /proc, /sys, /dev, or /run, for files UrbeStack manages such as its adapter files and the hosts file, and for paths whose names suggest they contain secrets. These restrictions apply to both the supplied path and its resolved path.

The API returns 201 with the new registration and its current disk metadata in file. Profile exports include the file's contents, mode, owner, and group. To restore the file, run urbestack-import --trust-files at the shell. The import result lists the restored file.

## As a command

- [urbestack-profile-file-add](https://urbestack.com/docs/commands/urbestack-profile-file-add.md): Registers a hand-edited file for inclusion in profile exports.

## Request body

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

- `path` (string, up to 1024 characters, required)
- `note` (string, up to 200 characters)

## 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/profile/files" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "note": "added by hand",
    "path": "public_html/index.php"
  }'
```

Response, 201 Created:

```
{
  "file": {
    "changed_at": "text",
    "created_at": "2026-09-09T10:15:00Z",
    "group": "text",
    "id": 1,
    "mode": "text",
    "note": "added by hand",
    "owner": "text",
    "package": {
      "name": "alice",
      "version": "0.0.1"
    },
    "path": "public_html/index.php",
    "present": true,
    "size": 1
  }
}
```

## Errors

- 400: <path> is a file the panel writes itself; what it holds travels with the profile already
- 400: <path> is inside <own>, which the panel manages itself
- 400: <path> looks like a secret and may not travel in a profile
- 400: A path is required
- 400: Invalid note
- 400: The path may not contain . or .. components
- 400: The path must be absolute and plain
- 401: Authentication required
- 409: <path> is already registered
