User API
The user API manages resources that belong to the authenticated customer. Every path is scoped: a token for one account cannot read or write another account's data, even with a guessed identifier.
Endpoints
| Method | Path | Purpose |
|---|---|---|
GET | /api/user/sites | List sites |
POST | /api/user/sites | Create a site |
GET | /api/user/sites/{id} | Site detail |
PATCH | /api/user/sites/{id} | Update settings |
DELETE | /api/user/sites/{id} | Delete a site |
GET | /api/user/sites/{id}/php/settings | Read PHP configuration |
PUT | /api/user/sites/{id}/php/settings | Update overrides |
POST | /api/user/sites/{id}/php/settings/reset | Reset overrides |
GET | /api/user/sites/{id}/php/extensions | List extensions |
GET | /api/user/databases | List databases |
POST | /api/user/databases | Create a database |
GET | /api/user/backups | List snapshots |
POST | /api/user/backups/run | Trigger a backup |
GET | /api/user/tickets | List tickets |
POST | /api/user/tickets | Open a ticket |
List sites
GET /api/user/sites?page=1&per_page=25
Authorization: Bearer <token>{
"ok": true,
"data": [
{
"id": 42,
"domain": "app.example.com",
"document_root": "/home/acme/sites/app.example.com/public",
"php_version": "8.3",
"ssl": { "status": "active", "expires_at": "2027-02-18T00:00:00Z" },
"disk_used_mb": 1840,
"status": "active"
}
],
"meta": { "page": 1, "per_page": 25, "total": 1 }
}Create a site
POST /api/user/sites
Content-Type: application/json
{
"domain": "shop.example.com",
"php_version": "8.3",
"document_root": "/home/acme/sites/shop.example.com/public"
}Validation rejects a domain that is already used in the account, a document root outside the account home and an unsupported PHP version. A successful create returns 201 with the site object.
Read PHP settings
GET /api/user/sites/42/php/settings{
"ok": true,
"data": {
"php_version": "8.3",
"runtime": "fpm",
"supported": [
"memory_limit", "max_execution_time", "max_input_time",
"upload_max_filesize", "post_max_size", "max_input_vars",
"display_errors", "error_reporting", "date.timezone",
"session.gc_maxlifetime"
],
"inherited": {
"memory_limit": "128M",
"max_execution_time": "60",
"post_max_size": "64M"
},
"overrides": {
"memory_limit": "256M"
},
"effective": {
"memory_limit": "256M",
"max_execution_time": "60",
"post_max_size": "64M"
},
"limits": {
"memory_limit": { "min": "64M", "max": "1G" },
"max_execution_time": { "min": 30, "max": 300 }
},
"warnings": []
}
}Update overrides
Send only the directives you want to change. Omitted keys keep their current value; null removes an override and restores inheritance.
PUT /api/user/sites/42/php/settings
Content-Type: application/json
{
"overrides": {
"memory_limit": "256M",
"upload_max_filesize": "128M",
"post_max_size": "128M",
"date.timezone": "Asia/Shanghai"
}
}Invalid values fail atomically — nothing is written unless every directive passes validation:
{
"ok": false,
"error": {
"code": "validation_failed",
"message": "post_max_size must be greater than or equal to upload_max_filesize",
"fields": { "post_max_size": "lt_upload_max_filesize" },
"request_id": "req_01J8Z4A2"
}
}Reset all overrides:
POST /api/user/sites/42/php/settings/resetExtensions
GET /api/user/sites/42/php/extensions{
"ok": true,
"data": {
"php_version": "8.3",
"loaded": ["bcmath", "curl", "gd", "intl", "mbstring", "opcache", "openssl", "pdo_mysql", "redis", "zip"],
"available": ["imagick", "sodium", "xdebug"]
}
}Extension changes require an administrator when they need system packages; request them through a ticket.
Databases and backups
POST /api/user/databases
{
"name": "shop_prod",
"user": "shop_user",
"charset": "utf8mb4"
}POST /api/user/backups/run
{
"scope": ["files", "database"],
"site_id": 42
}Backup jobs return a job identifier; poll GET /api/user/backups for status rather than blocking the request.
Errors
| Code | Meaning |
|---|---|
validation_failed | One or more fields rejected |
quota_exceeded | Package limit reached |
duplicate_domain | Domain already exists in scope |
not_found | Resource outside the token's account |
php_reload_failed | Configuration valid but reload failed |
Related
- PHP runtime for directive semantics
- API overview for auth and pagination
- Admin API for fleet operations