Authentication
Get a login token or use your personal API token, send it, renew it, and see which routes refuse the personal token.
Every Central API route except sign-in and sign-up needs a bearer token. There are two kinds of token. Which one you use depends on what is calling.
| Login token | Personal API token | |
|---|---|---|
| For | An app that signs a person in, with a password and a two-factor code if the account has one. | Your own scripts, CI jobs and tools. |
| You get it from | POST /auth/login | Account → API access in the panel. |
| Lifetime | 15 days, then renew it with a refresh token (30 days). | It never expires. It stops working when you turn API access off or generate a new token. |
| Can call | Every customer route. | Every customer route except the ones listed in Routes that refuse the personal API token. |
Send the token in the Authorization header of every request:
curl https://<api-address>/api/v1/account/profile \
-H "Accept: application/json" \
-H "Authorization: Bearer <token>"For scripts, use the personal API token. It needs no sign-in, no two-factor code and no renewing. Turn it on under Account → API access. See API access.
Keep tokens secret
Anyone with a token can use the API as you. Never put one in a public repository or a page of a website. If a personal API token leaks, generate a new one. If a login token leaks, log that device out under Account → Security → Active sessions. See Sessions and login history.
The rest of this page describes the login token routes. Skip to Routes that refuse the personal API token if you only use the personal token.
Sign in
POST /auth/login
Signs in with an email and a password. No Authorization header.
| Field | Type | Required | Rules |
|---|---|---|---|
email | string | yes | A valid email address, at most 254 characters. |
password | string | yes | At most 255 characters. |
curl -X POST https://<api-address>/api/v1/auth/login \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"email": "jane@example.com", "password": "your-password"}'200 when the account has no two-factor authentication:
{
"data": {
"two_factor_required": false,
"token": {
"access_token": "12|abcdefghijklmnopqrstuvwxyz",
"token_type": "Bearer",
"expires_at": "2026-12-10T10:00:00+00:00",
"refresh_token": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl",
"refresh_expires_at": "2026-12-25T10:00:00+00:00"
},
"user": {
"id": 1,
"name": "Jane Doe",
"email": "jane@example.com",
"status": "active",
"email_verified": true,
"email_verified_at": "2026-11-10T10:00:00+00:00",
"created_at": "2026-11-10T10:00:00+00:00"
},
"organizations": [
{
"id": 1,
"name": "Acme Hosting",
"description": "Our servers",
"logo_url": "https://<api-address>/storage/organizations/logos/logo.png",
"is_owner": true,
"is_default": true,
"role": { "id": 1, "name": "Owner", "key": "owner" },
"created_at": "2026-11-10T10:00:00+00:00"
}
]
},
"message": "You are now logged in."
}Use token.access_token as the bearer token. Keep token.refresh_token to renew it. An unverified email does not stop sign-in: check user.email_verified. role.key is owner, admin, or null for a custom role.
200 when the account has two-factor authentication. You get a challenge instead of a token:
{
"data": {
"two_factor_required": true,
"challenge_token": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl",
"methods": ["email", "backup_code"],
"expires_at": "2026-11-25T10:10:00+00:00"
},
"message": "Enter your two-factor authentication code to continue."
}methods is ["email", "backup_code"] for an account that uses email codes, or ["authenticator", "backup_code"] for an account with an authenticator app. Send the code to POST /auth/two-factor/challenge.
Errors:
- 422 —
These credentials do not match our records.The email or password is wrong. - 403
account_banned—Your account has been suspended. Please contact support. - 403
ip_not_approved—Login from this IP address needs approval. We sent an approval link to your email address.Your account has the IP whitelist on and this IP is not on it. Open the link in the email, or callPOST /auth/ip-approvals, then sign in again. - 429 — more than 5 tries a minute for the same email and IP, or more than 20 a minute from one IP.
POST /auth/two-factor/challenge
Finishes a sign-in with a two-factor code. No Authorization header.
| Field | Type | Required | Rules |
|---|---|---|---|
challenge_token | string | yes | The challenge_token from the login answer. At most 255 characters. |
method | string | yes | One of email, authenticator, backup_code. It must be one of the methods of the challenge. |
code | string | yes | The code, at most 64 characters. Six digits for email and authenticator. |
200 has the same body as a login without two-factor authentication: data.token, data.user and data.organizations.
Errors:
- 422 —
The code is incorrect. Please try again.The answer also hasattempts_left, which counts down from 4. The fifth wrong code returns the 401 below. - 422 —
This verification method is not available for your account.Themethodis not one of the challenge'smethods. - 401
two_factor_expired—This login attempt has expired. Please log in again.The challenge is unknown, already used, older than 10 minutes, or had 5 wrong codes. Sign in again. - 403
account_bannedorip_not_approved, as for login. - 429 — more than 10 tries a minute from one IP.
POST /auth/two-factor/email-code
Sends a new email code for a challenge that uses the email method. The old code stops working, the 10 minutes start again, and the count of wrong codes is kept.
| Field | Type | Required | Rules |
|---|---|---|---|
challenge_token | string | yes | At most 255 characters. |
200 — A new login code has been sent to your email address.
Errors: 401 two_factor_expired as above. 422 — This verification method is not available for your account. The challenge does not use the email method. 429 — more than 3 new codes in 10 minutes for one challenge, or more than 10 a minute from one IP.
POST /auth/ip-approvals
Approves the IP address of a sign-in that answered ip_not_approved. The link in the email opens a page of the panel with a token, and the page calls this route. The link is valid for 24 hours. No Authorization header.
| Field | Type | Required | Rules |
|---|---|---|---|
token | string | yes | The token from the link. At most 255 characters. |
200:
{
"data": {
"ip": "203.0.113.9",
"approved_at": "2026-11-25T10:00:00+00:00"
},
"message": "IP address 203.0.113.9 is approved. You can log in now."
}422 — This approval link is invalid or has expired. Please log in again to get a new one. 429 — more than 10 tries a minute from one IP.
Renew and sign out
POST /auth/token/refresh
Swaps a refresh token for a new pair of tokens. No Authorization header.
| Field | Type | Required | Rules |
|---|---|---|---|
refresh_token | string | yes | At most 255 characters. |
curl -X POST https://<api-address>/api/v1/auth/token/refresh \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"refresh_token": "<refresh-token>"}'200:
{
"data": {
"token": {
"access_token": "13|abcdefghijklmnopqrstuvwxyz",
"token_type": "Bearer",
"expires_at": "2026-12-10T10:00:00+00:00",
"refresh_token": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl",
"refresh_expires_at": "2026-12-25T10:00:00+00:00"
}
},
"message": "Your session has been renewed."
}Store the new pair. The old access token and the old refresh token stop working.
Use each refresh token once
If a refresh token that was already used is sent again, Central treats it as stolen. It answers session_expired and ends every token of that sign-in. Sign in again to get a new pair.
Errors:
- 401
session_expired—Your session has expired. Please log in again.The refresh token is unknown, expired (30 days), or already used. - 403
account_banned. - 429 — more than 10 tries a minute from one IP.
POST /auth/logout
Signs out the token you call it with. Send the bearer token and no body.
curl -X POST https://<api-address>/api/v1/auth/logout \
-H "Accept: application/json" \
-H "Authorization: Bearer <access-token>"200 — You have been logged out. The access token and its refresh token stop working. Other sign-ins of the account are not affected. To end other sessions, use Active sessions under Account → Security in the panel.
Call it with a login token only. In the code, the route deletes whichever token it is called with, so calling it with the personal API token deletes that token.
401 unauthenticated when the token is missing or no longer valid.
Sign up, verify and reset a password
These routes belong to the sign-up and password pages of the panel. They need no token. A script does not normally call them.
| Route | Purpose | Fields | Limit |
|---|---|---|---|
POST /auth/register | Create an account. The password needs a confirmation. | name, email, password, password_confirmation, turnstile_token, and the optional referral_code, affiliate_code, invitation_code. | 5 a minute per IP. |
POST /auth/email/verify/{id}/{hash} | Confirm an email address from the link in the verification email. | None. | 10 a minute per IP. |
POST /auth/email/resend | Send a new verification email. | email | 3 in 10 minutes per email and IP, 10 a minute per IP. |
POST /auth/forgot-password | Send a reset link. | email | 3 in 10 minutes per email and IP, 10 a minute per IP. |
POST /auth/reset-password | Set a new password from the reset link. | token, email, password, password_confirmation | 5 a minute per IP. |
POST /auth/social/{provider}/redirect | Start a sign-in with Google or GitHub. provider is google or github. The answer has data.redirect_url. | The optional referral_code, affiliate_code, invitation_code. | 20 a minute per IP. |
POST /auth/social/{provider}/callback | Finish a sign-in with Google or GitHub. The answer is the same as a login. | code, state | 10 a minute per IP. |
A password needs at least 8 characters with upper and lower case letters, a number and a symbol, and at most 255 characters. register also needs a Cloudflare Turnstile token, so it only works from a browser page.
The personal API token
You do not get this token from the API. A person turns it on in the panel, under Account → API access. The page shows the token, and the person copies it into the script. See API access.
The token has the ability api only. It is made as you, so every route checks your organization role and permissions as usual. It can read your profile and call the routes of your organizations, servers and applications. It cannot change your account.
A request that is not allowed with this token answers 403:
{
"message": "The API token cannot change account settings. Log in to the panel to do this.",
"code": "api_token_not_allowed"
}Turning API access on or off and generating a new token are account routes, so they refuse the personal token too. Do them in the panel.
Routes that refuse the personal API token
These routes need a login token. With the personal API token they answer 403 and api_token_not_allowed.
| Group | Routes |
|---|---|
| Account | Every /account/... route except GET /account/profile. This covers profile changes, password, email, two-factor authentication, IP whitelist, sessions, login history, the activity log, notifications, notification channels, API access, delete protection, wallet and billing, add-on purchases (White label, Log Monitoring, Premium Hosting Care, WP Toolkit, Blueprints), referral, and DELETE /account. |
| Roles | POST, PATCH and DELETE on /organizations/{organization}/roles. Listing and reading roles works with the personal token. |
| Cloud providers | Connect, edit, check, disconnect, and the saved credentials, under /organizations/{organization}/cloud-provider-accounts. Listing works. |
| Git accounts | Connect, edit, check, delete, and the server sync and remove routes, under /organizations/{organization}/git-accounts. Listing, repositories and servers work. |
| Storage accounts | Connect, edit, test, delete, the Log in with Google routes, and the server sync and remove routes, under /organizations/{organization}/storage-accounts. Listing and servers work. |
| Cloudflare | Connect, edit, check and delete under /organizations/{organization}/cloudflare-accounts. Listing, domains and zones work. |
| Server sharing | Every /organizations/{organization}/servers/{server}/shares route and every /shared-servers route. |
| Server panel | POST .../servers/{server}/git-accounts/{gitAccount}/connect, POST .../servers/{server}/storage-accounts/{storageAccount}/connect and POST .../servers/{server}/storage-destinations/{ossDestination}/test. |
Every other customer route works with both kinds of token. That includes the organization routes, members, servers, databases, applications and backups, as far as your role allows. The page of each group says which of its routes refuse the personal token.
Limits
- Login token: 15 days. Refresh token: 30 days, one use.
- Sign-in: 5 tries a minute per email and IP, 20 a minute per IP.
- Two-factor code: 5 wrong codes end the challenge. The challenge lasts 10 minutes.
- Personal API token: no expiry. Turning it on, generating a new one and turning it off together are limited to 10 a minute per user.
- Every route is also limited by the general rate limit.
Common errors
- Please log in to continue. (
unauthenticated, 401) The token is missing, expired or was revoked. Renew it, or sign in again. - The API token cannot change account settings. Log in to the panel to do this. (
api_token_not_allowed, 403) The route needs a login token. - Your account has been suspended. Please contact support. (
account_banned, 403) The account is suspended. - Please verify your email address to continue. (
email_not_verified, 403) The action needs a verified email address.