Repository navigation
API
The panel's web interface uses the same HTTP API that scripts can use. It is served on the panel's address under /api/. Requests and responses are JSON, except archive uploads, which send the raw file as the request body.
| Client | How |
|---|---|
| Programs (scripts, CI) |
Authorization: Bearer op_… with an access token |
| Browsers | the session cookie ownpanel_session, set by POST /api/login or POST /api/setup
|
- Access tokens are described in Users and Access.
- If an
Authorizationheader is present it must beBearer <token>; a wrong token is refused right away with401. Otherwise the cookie is used. A stale cookie just means nobody is signed in. -
Cookie requests that change something (anything but
GETandHEAD) must send the headerX-Ownpanel-Request: 1, otherwise they get403. Token requests do not need it. - If an
Originheader is sent on a changing request without a token, its host must equal the request'sHost, otherwise403("requests from other web sites are not allowed"). The API never allows cross-origin requests (no CORS). - Tokens and passwords can only be managed when signed in with a password, not with a token.
- Some routes are open:
GET /api/session,POST /api/setup(needs the setup code),POST /api/login,POST /api/logout, andPOST /api/uploads/{id}(the link is the credential).
curl -H "Authorization: Bearer op_…" https://panel.example.com/api/sitesErrors are JSON with a readable sentence:
{"error": "Site not found"}| Status | Meaning |
|---|---|
400 |
bad input: invalid JSON, name, domain, archive, password, setup code, record |
401 |
not signed in, wrong credentials, or an invalid token |
403 |
known, but not allowed (read-only or site-limited token, not an admin, missing header) |
404 |
missing, or not visible to you (the two look the same); unknown endpoint |
409 |
cannot be done in the current state: name taken, nothing to go back to, last admin, user still owns sites, setup already done |
429 |
too many failed sign-in attempts, or Hetzner's request limit was reached |
502 |
the change is saved but the web server could not be updated yet (the loop retries), or an outside service such as Hetzner is unavailable |
500 |
something went wrong on the server; the details are only in the log |
Responses carry Cache-Control: no-store. Request bodies that are JSON are limited to 1 MB; archives to 512 MB.
Site: {"name", "domains": [..], "owner", "current_release", "releases": [..]}. releases lists version ids oldest first; current_release is empty until something is published.
User: {"id", "name", "role", "created_at"}, role "admin" or "member".
Token: {"id", "name", "access", "sites", "created_at", "last_used_at"}. sites is null for all sites. Creating a token also returns "token" (the secret, shown once).
Activity: {"id", "at", "actor", "action", "target", "detail"}.
DNS connection: {"id", "provider", "name", "owner", "created_at", "last_checked_at", "last_error", "can_write", "zone_count"}. can_write and zone_count are null while unknown; the token is never returned.
Record set: {"name", "type", "ttl", "values": [..], "locked"}. name is @ for the zone itself; ttl is null for the zone default; TXT values are plain text.
Redirect: {"id", "owner", "source_domain", "source_path", "target", "code", "keep_path", "keep_query", "created_at"}. source_path is "" for a whole-domain redirect, otherwise /exact or a prefix /path/*; code is 301, 302, 307 or 308. See Redirects.
Zone: {"connection_id", "connection_name", "name", "read_only", "nameservers": [..]}. nameservers are the provider's nameservers to enter at the domain's registrar.
"Anyone" means any authenticated person or token. "Write" means a token needs write access; limited tokens work only on their sites. "Admin" means the admin role with a password sign-in or an unrestricted write token. Details are in Users and Access.
| Method | Path | Who | Request | Response |
|---|---|---|---|---|
GET |
/api/session |
open | {"setup_required": bool, "user": User or null, "via": "session" or "token" or null} |
|
POST |
/api/setup |
open, needs setup code | {"setup_code", "name", "password"} |
201 User; sets the session cookie. 409 once set up |
POST |
/api/login |
open | {"name", "password"} |
User; sets the cookie. 401 wrong credentials, 429 throttled |
POST |
/api/logout |
open |
204; clears the cookie |
|
PUT |
/api/account/password |
password sign-in | {"current", "new"} |
204; ends your other sessions |
| Method | Path | Who | Request | Response |
|---|---|---|---|---|
GET |
/api/tokens |
password sign-in | list of Token (your own) | |
POST |
/api/tokens |
password sign-in | {"name", "access": "read" or "write", "sites": null or ["name", …]} |
201 Token with token
|
DELETE |
/api/tokens/{id} |
password sign-in | 204 |
| Method | Path | Who | Request | Response |
|---|---|---|---|---|
GET |
/api/sites |
anyone | list of Site you may see | |
GET |
/api/sites/{name} |
anyone, own site | Site | |
PUT |
/api/sites/{name} |
write; creating needs an unrestricted token | {"domains": ["example.com"]} |
Site. Creates the site if the name is free, otherwise replaces its domains |
DELETE |
/api/sites/{name} |
write, unrestricted | 204 |
|
POST |
/api/sites/{name}/deployments |
write, own site | raw .zip or .tar.gz body |
201 Site |
POST |
/api/sites/{name}/rollback |
write, own site | optional {"release": "<id>"}; no body means the previous version |
Site |
POST |
/api/uploads/{id} |
open (upload link) | raw archive body |
201 Site; 404 for unknown, used or expired links |
| Method | Path | Who | Request | Response |
|---|---|---|---|---|
GET |
/api/users |
admin | list of User | |
POST |
/api/users |
admin | {"name", "password", "role"} |
201 User |
PUT |
/api/users/{id} |
admin |
{"role"} and/or {"password"}
|
User |
DELETE |
/api/users/{id} |
admin |
204; 409 for the last admin or a user who owns sites |
|
GET |
/api/activity?limit=50 |
admin |
limit 1 to 200 (default 50) |
list of Activity, newest first |
| Method | Path | Who | Request | Response |
|---|---|---|---|---|
GET |
/api/server |
anyone |
{"ips": [..]}: the addresses given with -server-ip
|
|
GET |
/api/dns/connections |
anyone, not site-limited | list of DNS connection (yours; admins see all) | |
POST |
/api/dns/connections |
password sign-in or unrestricted write | {"provider": "hetzner", "name", "token"} |
201 DNS connection |
POST |
/api/dns/connections/{id}/check |
password sign-in or unrestricted write, your own | DNS connection; the outcome is in last_error
|
|
DELETE |
/api/dns/connections/{id} |
same as above; admins may remove anyone's | 204 |
|
GET |
/api/dns/zones |
anyone, not site-limited |
{"zones": [{"connection_id", "connection_name", "name", "read_only"}], "problems": [{"connection_id", "connection_name", "error"}]} across your connections |
|
GET |
/api/dns/connections/{id}/zones/{zone}/records |
anyone, not site-limited, your own connection | list of Record set | |
PUT |
/api/dns/connections/{id}/zones/{zone}/records/{name}/{type} |
write, unrestricted, your own connection | {"ttl": 3600 or null, "values": [..]} |
Record set as written |
DELETE |
/api/dns/connections/{id}/zones/{zone}/records/{name}/{type} |
same |
204; deleting a missing record set is fine |
|
GET |
/api/sites/{name}/domains/status |
anyone, own site | list of {"domain", "state", "found": [..], "zone": null or {"connection_id", "connection_name", "zone", "record_name"}}; state is points_here, points_elsewhere, no_record or lookup_failed. 409 if no -server-ip is set |
|
POST |
/api/sites/{name}/domains/{domain}/point |
write, own site | {"changed": [Record set, …]} |
|
GET |
/api/dns/domain-status?domain=<domain> |
anyone; a domain of a site you may see or of a domain redirect you may see | one element of the site domain status list above. 404 for other domains |
|
POST |
/api/dns/point |
write; same domains | {"domain": "www.example.com"} |
{"changed": [Record set, …]}, like the site route |
POST |
/api/dns/connections/{id}/zones |
password sign-in or unrestricted write, your own connection | {"name": "example.com"} |
201 Zone. Only registrable domains (no subdomains). 409 if it exists already |
DELETE |
/api/dns/connections/{id}/zones/{zone} |
same | {"confirm": "<zone name>"} |
204. 400 if confirm does not match; 409 while a site, redirect or the panel domain (of anyone) uses a domain in the zone, listing them, or if the zone is protected at the provider |
Entries of GET /api/dns/zones are Zone objects, with nameservers.
| Method | Path | Who | Request | Response |
|---|---|---|---|---|
GET |
/api/redirects |
anyone | list of Redirect you may see (admins: all), sorted by domain and path | |
GET |
/api/sites/{name}/redirects |
anyone, own site | list of the path redirects on the site's domains | |
POST |
/api/redirects |
write; domain redirects need a token that is not limited to sites | {"source_domain", "source_path", "target", "code", "keep_path", "keep_query"} |
201 Redirect |
PUT |
/api/redirects/{id} |
write; owner, admin, or (path redirects) whoever may change the site | same as POST
|
Redirect |
DELETE |
/api/redirects/{id} |
same | 204 |
For record routes, {name} is @ for the zone itself, and {type} is for example A or TXT. See DNS for what is allowed.
Any other path under /api/ answers 404 with {"error": "No such API endpoint"}.
curl --fail-with-body -X POST \
-H "Authorization: Bearer $OWNPANEL_TOKEN" \
--data-binary @site.tar.gz \
https://panel.example.com/api/sites/demo/deploymentsUse a write token limited to the one site, so a leaked token can publish to that site but cannot create or delete sites.
ownpanel: https://github.com/danielgtmn/ownpanel. This wiki is generated from the wiki/ folder in the repository; edit the files there, not in the wiki.
ownpanel
Get going
Using ownpanel
- Sites and Publishing
- GitHub Action
- GitHub
- Git repositories
- Users and Access
- DNS
- Redirects
- MCP
- API
- Backup and Restore
Background