Authentication

Create a scoped ScalPanel API token, send it as a bearer token, and keep it safe.

ScalPanel knows two kinds of credentials:

CredentialUsed byHow it is sent
Panel sessionThe hosting panel and the admin panel in a browserA secure, HTTP-only cookie plus an X-CSRF-Token header on changes
API tokenScripts, billing systems, AI assistantsAuthorization: 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

  1. Sign in to the panel as the user the script should act as.
  2. Open Account → My security in the hosting panel, or Settings → My security in the admin panel.
  3. In API tokens, select New token.
  4. Enter a name (1–64 characters), pick the scopes (or a preset), and set Expires in (days).
  5. 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:

SettingDefaultHighest
API tokens allowedOn—
Tokens per user10100
Longest lifetime90 days365 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.

AreaScopes
Accounts and resellerstenants.read, accounts.create, accounts.manage, tenants.suspend, resellers.create
Usersusers.read, users.manage
Packages and policypackages.read, packages.manage, policies.read, policies.manage
Websitessites.read, sites.manage
Domainsdomains.read, domains.manage
Databasesdatabases.read, databases.manage
DNSdns.read, dns.manage
Mailmail.read, mail.manage
SSH accessssh.read, ssh.manage
Cron jobscron.read, cron.manage
Filesfiles.read, files.manage
Backupsbackups.read, backups.manage
Alerts and webhooksalerts.read, alerts.manage
Audit logaudit.read
Brandingbranding.manage
Servers (provider)nodes.read, nodes.manage
Server settings (provider)provider.settings
Your own login, 2FA and tokensself.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 Origin header from another site are refused with CSRF_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 Authorization header.
  • 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.