Add Sub-user
Last updated Changelog
On this page
POST /crates/{handle}/logins
Adds a sub-user named <handle>-<name>, with the folders it can use. Returns its password, once. Without a folder it’s kept but can’t sign in until it’s given one. 422 when the name is taken or isn’t valid, or a folder isn’t the crate’s; 400 when the plan’s sub-user limit is reached.
Parameters
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| name | string | Yes | Lowercase letters, digits and hyphens, up to 32 characters | |
| folders | object | No | {} | Folder name to read (list and download) or write (also add, change and delete) |
| home | string | No | its first folder | The folder its sessions start in: one of its folders |
| ssh | boolean | No | true | SFTP, SCP, rsync, borg and restic |
| ssh_password | boolean | No | false | Allow the password over SSH (keys always work) |
| file_keys | boolean | No | true | Honor keys the login keeps in its own /data/.ssh/authorized_keys |
| ftp | boolean | No | false | FTPS |
| ftp_plain | boolean | No | false | Also unencrypted FTP, when the plan allows it (plain_ftp_allowed); ignored otherwise |
| webdav | boolean | No | true | WebDAV over HTTPS |
| allowed_ips | array | No | [] | Addresses and CIDR ranges the login may connect from (up to 50); empty allows any |
Every login finds its folders at /data/<folder>. SSH, SFTP, rsync, borg and FTP start in home, so paths without a leading slash land there; WebDAV shows every folder at the top. borg needs write on a folder to use a repository there, even only to read it; restic reads a read folder with --no-lock.
{ "name": "office", "folders": { "shared": "read", "scans": "write" }, "home": "scans", "ssh": false }
Response (201)
{
"login": "c7xk2m9p-office",
"password": "Kt7wq2Xn9pRz4Vm8Hs3bYc6D",
"message": "Sub-user added. Its password is shown only now."
}
Errors
Besides the errors any endpoint can return:
| Status | Code | When |
|---|---|---|
| 400 | limit_reached |
The plan allows no more of this (domains, databases, sub-users, snapshots, keys). |
| 400 | operation_rejected |
The server behind the API (mail, database, storage) or the registrar refused the operation. error says why. |
| 403 | scope_denied |
This API key does not have Crates write access for this crate. |
| 403 | service_inactive |
This crate is not active. |
| 404 | not_found |
Crate not found. |
| 502 | upstream_unavailable |
This crate has no storage node. |