PanelDOCSv1.0.0

API: websites, PHP and logs

Subdomains, redirects, blocked addresses, error pages, PHP versions and settings and logs through the token API.

These endpoints do what the Domains, Redirects, Error pages and PHP screens and the log viewer do, with the same checks, plan limits and activity log lines.

The paths name the account (/v1/accounts/{username}/…); the rules are those of every per-account endpoint. The REST conventions (paging, errors, Location) apply.

bash
A=https://api.yourdomain.com/v1
H="Authorization: Bearer hf_xxx"

Subdomains

Method Path Who What it does
GET /v1/accounts/{username}/subdomains per account The account's subdomains
POST /v1/accounts/{username}/subdomains per account, write Add a subdomain under one of the account's main domains
GET /v1/accounts/{username}/subdomains/{subdomain} per account One subdomain
PATCH /v1/accounts/{username}/subdomains/{subdomain} per account, write Set a subdomain's document folder or PHP version
DELETE /v1/accounts/{username}/subdomains/{subdomain} per account, write Remove a subdomain

POST /v1/accounts/{username}/subdomains

Field Type Required Meaning
label string yes the part before the main domain: letters, numbers and dashes (not "www")
parent string yes the main domain it belongs to
folder string the document folder inside web/ (default: its own)

PATCH /v1/accounts/{username}/subdomains/{subdomain}

Field Type Required Meaning
folder string the document folder inside web/
php string an installed PHP version, e.g. 8.3

DELETE /v1/accounts/{username}/subdomains/{subdomain}

Query: purge (also delete its files)

Redirects

Method Path Who What it does
GET /v1/accounts/{username}/redirects per account The account's redirects and whole-site redirects
POST /v1/accounts/{username}/redirects per account, write Redirect a path, or the whole website, to another address (a whole-site redirect replaces the earlier one)
GET /v1/accounts/{username}/redirects/{id} per account One redirect
DELETE /v1/accounts/{username}/redirects/{id} per account, write Remove a redirect

GET /v1/accounts/{username}/redirects

Query: domain (only this website)

POST /v1/accounts/{username}/redirects

Field Type Required Meaning
domain string yes the website
kind one of redirect, whole redirect (default) or whole
path string redirect: the path on the site, e.g. /old-page
target string yes redirect: a full address; whole: https://newsite.com
code one of 301, 302 301 (default, permanent) or 302

Blocked addresses

The older address of the account's IP blocker: the same list, the same entries (AccountBlock). An address blocked here applies to every website of the account and never expires.

Method Path Who What it does
GET /v1/accounts/{username}/ip-blocks per account The addresses blocked on the account's websites
POST /v1/accounts/{username}/ip-blocks per account, write Block an address or range on every website of the account
DELETE /v1/accounts/{username}/ip-blocks/{id} per account, write Unblock an address of the IP blocker

POST /v1/accounts/{username}/ip-blocks

Field Type Required Meaning
ip string yes an address like 203.0.113.9 or a range like 203.0.113.0/24

Error pages

A website can have its own page for 400, 401, 403, 404, 429, 500, 502, 503 and 504 ({code}; another code answers 404). 429 is what a visitor gets from the firewall rules' request limit; 502 and 504 when the website's app or PHP does not answer.

Method Path Who What it does
GET /v1/accounts/{username}/error-pages per account The error codes a website can have its own page for, for each website of the account
GET /v1/accounts/{username}/error-pages/{domain}/{code} per account A website's page for an error code: its HTML (when custom) and a template to start from
PUT /v1/accounts/{username}/error-pages/{domain}/{code} per account, write Save a website's own page for an error code
DELETE /v1/accounts/{username}/error-pages/{domain}/{code} per account, write Go back to the standard page for an error code

PUT /v1/accounts/{username}/error-pages/{domain}/{code}

Field Type Required Meaning
html string yes the page (up to 200,000 bytes)

PHP

PATCH /php sets the account's PHP version and settings; /php/sites/{domain} overrides them for one website.

Method Path Who What it does
GET /v1/accounts/{username}/php per account The account's PHP version, settings, extensions and websites
PATCH /v1/accounts/{username}/php per account, write Switch every website to another PHP version, and/or set the PHP settings of all websites
GET /v1/accounts/{username}/php/sites per account Each website's PHP version, web server mode and page cache
GET /v1/accounts/{username}/php/sites/{domain} per account One website's PHP version, mode, page cache and its own PHP settings
PATCH /v1/accounts/{username}/php/sites/{domain} per account, write Set one website's PHP version, web server mode, page cache minutes and/or its own PHP settings (.user.ini)
POST /v1/accounts/{username}/php/sites/{domain}/cache/clear per account, write Empty a website's page cache

PATCH /v1/accounts/{username}/php

Field Type Required Meaning
version string an available PHP version, e.g. 8.3
settings object memory_limit, upload_max_filesize, post_max_size (like 256M), max_execution_time, max_input_time (seconds), max_input_vars, display_errors, date.timezone; the ones you leave out go back to the defaults

PATCH /v1/accounts/{username}/php/sites/{domain}

Field Type Required Meaning
version string an available PHP version
mode one of nginx, hybrid nginx (Nginx only, fastest) or hybrid (Nginx and Apache: .htaccess works)
page_cache one of 0, 5, 10, 30, 60 minutes pages are kept: 0 (off), 5, 10, 30 or 60
settings object the settings to write into the website's .user.ini (same names as for the account)

Logs

Method Path Who What it does
GET /v1/accounts/{username}/logs per account A website's access, error or PHP log (the last 300 lines), the explained errors, or the raw files in ~/logs

GET /v1/accounts/{username}/logs

Query: type (errors (default), access, error, php or raw); domain (the website (access and error logs))