Authentication
Create a scoped ScalPanel API token, send it as a bearer token, and keep it safe.
ScalPanel knows two kinds of credentials:
| Credential | Used by | How it is sent |
|---|---|---|
| Panel session | The hosting panel and the admin panel in a browser | A secure, HTTP-only cookie plus an X-CSRF-Token header on changes |
| API token | Scripts, billing systems, AI assistants | Authorization: Bearer <token> |
Use an API token for anything that is not a person in a browser. Session cookies only work through the panels' own pages, and signing in from a script is not supported.
Create a token
- Sign in to the panel as the user the script should act as.
- Open Account → My security in the hosting panel, or Settings → My security in the admin panel.
- In API tokens, select New token.
- Enter a name (1–64 characters), pick the scopes (or a preset), and set Expires in (days).
- Select Create token and copy the token. It is shown only once.
A token looks like spt_ followed by two parts joined by _. The spt_ prefix lets secret scanners spot a leaked token.
Note: Tokens can only be created from a signed-in panel session, never with another token. A provider or reseller who opened a customer's panel ("log in as") cannot create tokens for that customer.
Limits on tokens
Your provider controls these through the account's package and policy:
| Setting | Default | Highest |
|---|---|---|
| API tokens allowed | On | — |
| Tokens per user | 10 | 100 |
| Longest lifetime | 90 days | 365 days |
If your provider makes API tokens read-only for your account, you cannot create new ones. If they hide the feature, existing tokens stop working as well.
Scopes
A scope is a permission. A token holds only the scopes you pick, and only those your own role already has. You cannot pick a scope you do not hold. If your role later loses a permission, the token loses it too.
| Area | Scopes |
|---|---|
| Accounts and resellers | tenants.read, accounts.create, accounts.manage, tenants.suspend, resellers.create |
| Users | users.read, users.manage |
| Packages and policy | packages.read, packages.manage, policies.read, policies.manage |
| Websites | sites.read, sites.manage |
| Domains | domains.read, domains.manage |
| Databases | databases.read, databases.manage |
| DNS | dns.read, dns.manage |
mail.read, mail.manage | |
| SSH access | ssh.read, ssh.manage |
| Cron jobs | cron.read, cron.manage |
| Files | files.read, files.manage |
| Backups | backups.read, backups.manage |
| Alerts and webhooks | alerts.read, alerts.manage |
| Audit log | audit.read |
| Branding | branding.manage |
| Servers (provider) | nodes.read, nodes.manage |
| Server settings (provider) | provider.settings |
| Your own login, 2FA and tokens | self.manage |
*.read scopes only read. *.manage scopes create, change and delete. Pick the smallest set that works.
Call the API
Send the token in the Authorization header to either panel address. Start with GET /v1/session: it shows who the token acts as, the tenant ID you need for most other calls, and the permissions the token really holds.
export SCALPANEL_TOKEN="spt_..." # paste your token; never commit it
curl -s https://panel.example.com:2083/v1/session \
-H "Authorization: Bearer $SCALPANEL_TOKEN"
The answer includes user, tenant (with its id and kind), auth_method ("token") and permissions.
Changes work the same way. With a token you do not need a CSRF token:
curl -s -X POST https://panel.example.com:2083/v1/tenants/$TENANT_ID/domains \
-H "Authorization: Bearer $SCALPANEL_TOKEN" \
-H "Content-Type: application/json" \
-d '{"domain": "example.org"}'
A missing, expired, revoked or malformed token answers 401 with the code UNAUTHENTICATED.
Revoke a token
Open My security → API tokens and select Revoke. Scripts using it stop working at once. The list also shows when each token was last used, so you can find and remove tokens nobody uses.
These also end all of your tokens:
- changing your own password;
- an administrator setting or resetting your password.
Two-factor authentication and tokens
- A token does not ask for a two-factor code. It is created from a session that already passed two-factor authentication, so treat it like a signed-in session.
- If your provider requires two-factor authentication and you have not set it up yet, your tokens are refused until you do.
- Single sign-on links from billing systems are refused for users with two-factor authentication: they sign in normally instead.
Other rules that apply to tokens
- Staff networks. If the provider limits the admin panel to certain networks, provider and reseller tokens only work from those networks too.
- Suspended accounts. A suspended user or account cannot use the API.
- Browser requests. Changes that carry an
Originheader from another site are refused withCSRF_FAILED.
Keep tokens safe
- Give each script its own token, so you can revoke one without breaking the others.
- Choose the shortest lifetime that works.
- Store tokens in a secret store or an environment variable, not in code or in a repository.
- Never put a token in a URL. Always send it in the
Authorizationheader. - Revoke a token as soon as you suspect it leaked. The token itself is stored only as a hash, so even ScalPanel cannot show it to you again.