API Reference
Dashboard
  1. API Reference
  2. Box API
  3. Guides

Authentication

The box checks every call in this order: an API key if one is sent, then the address the call comes from, then the dashboard username and password. This page explains each step, the switches that change it, and what the box answers when it refuses a call.

To turn the switches on and off in the panel, follow Secure the XProxy dashboard.

Three ways to sign in

MethodHow you send itWhere it worksUse it for
Admin login (HTTP Basic)Authorization: Basic <base64 of user:password>, or curl -u user:passwordEvery route, including API key managementYour own scripts and the panel
Full access key (xpf_…)Authorization: Bearer xpf_YOUR_KEY only, never in a URLEvery route that accepts the admin login, except API key managementBots, servers and tools that should not know your password
Rotate only key (xpr_…)?token=xpr_YOUR_KEY on the link, or Authorization: Bearer xpr_YOUR_KEYOnly the rotation links /reset, /api/v1/rotate_ip/proxy/{proxy} and /api/v1/rotate_ip/position/{position}The Change IP URL of AdsPower, Dolphin and other antidetect browsers

API keys exist from XProxy v21.3.61. Older boxes accept only the admin login.

Some links carry their own token and ignore everything on this page: the per-port token links, the selling platform links (?token= of a sold proxy) and the VPN rotation link. Treat each of those tokens like a password.

HTTP Basic auth: the admin login in a header

Basic auth sends the dashboard username and password in the Authorization header. Join them with a colon, encode the result as base64, and put Basic in front. For the username admin and the password secret:

admin:secret  →  base64  →  YWRtaW46c2VjcmV0

Authorization: Basic YWRtaW46c2VjcmV0

Check your own value in a terminal (-n keeps the line break out of it):

echo -n 'admin:secret' | base64
# YWRtaW46c2VjcmV0

Most tools build the header for you:

cURL

# curl encodes the login itself
curl -u "admin:secret" "http://192.0.2.10/api/v1/info_list"

# the same request with the header written out
curl -H "Authorization: Basic YWRtaW46c2VjcmV0" "http://192.0.2.10/api/v1/info_list"

Python

import requests

r = requests.get("http://192.0.2.10/api/v1/info_list", auth=("admin", "secret"), timeout=30)
print(r.status_code, r.json())

Node.js

const login = Buffer.from("admin:secret").toString("base64");
const r = await fetch("http://192.0.2.10/api/v1/info_list", {
  headers: { Authorization: `Basic ${login}` },
});
console.log(r.status, await r.json());

PHP

$ch = curl_init("http://192.0.2.10/api/v1/info_list");
curl_setopt($ch, CURLOPT_USERPWD, "admin:secret");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch);

Things to know:

  • base64 is an encoding, not encryption. Anyone who sees the request can read the password. Over the internet, call the box through HTTPS (a domain with a certificate) or through Tailscale, or use an API key you can delete at any time.
  • The box checks the password only while Dashboard Auth is on. While it is off, no password is ever accepted, so a caller that is not trusted (see [Who can call without a password](#trusted)) is refused even with the right login.
  • The box splits at the first colon. A colon inside the password is fine; a colon inside the username is not.
  • The login is the one you set under General Settings → System Setting → Security → Dashboard Auth.

API keys: Bearer header or token on the link

The panel admin creates keys under Settings → System Setting → Security → API keys (step by step), or through Create an API key. A key is shown once, when it is created or regenerated; afterwards the panel shows only a masked form such as xpf_…abcd.

Full access key

curl -H "Authorization: Bearer xpf_YOUR_KEY" "http://192.0.2.10/api/v1/info_list"

Rotate only key in a Change IP URL

http://192.0.2.10/api/v1/rotate_ip/position/3?token=xpr_YOUR_KEY
  • A key is checked before anything else. A valid key passes from any address, also when Force API Auth is on. A key that is not valid is refused with invalid_token from every address, the LAN and the box itself included: the box never falls back to the LAN or whitelist exemption.
  • Keep a Full access key out of URLs: links end up in browser history, proxy logs and Referer headers. A Full access key sent as ?token= is refused.
  • A Rotate only key can rotate IPs and nothing else, so it is the safe choice for a link you paste into another program.
  • A key can expire. Regenerating a key stops the old secret at once; deleting it stops it for good. A box holds at most 50 keys.
  • Keys cannot manage keys: /v2/api_keys and its sub-routes need the admin login and refuse every key.

Who can call without a password

Some callers are trusted by their address and need no login:

  • The box itself (127.0.0.1): always.
  • The LAN: any private IPv4 address (10.x, 172.16-31.x, 192.168.x), unless Force LAN Auth is on.
  • Whitelisted IPs: the ranges in Whitelist IPs, while IP Auth is on.
  • Tailscale: devices on the box's Tailscale network, while the Tailscale switch allows it.

Calls that reach the box through VPS forwarding are never trusted by address: through the VPS they arrive from a local address, so the box treats them like internet traffic and asks for a login or a key.

The box has two kinds of routes:

  • Public routes: rotate, status, reboot and proxy list (/api/v1/… and the legacy /reset, /status, /reboot_usb). While Force API Auth is off, anyone who can reach the box can call them. Turn it on to require a trusted address, the login or a key.
  • Panel routes: everything else (settings, modems, logs, …). They always need a trusted address, the admin login or a Full access key. Force API Auth does not change them.

Public routes, by caller and settings:

CallerForce API Auth off (default)Force API Auth on, Dashboard Auth offForce API Auth on, Dashboard Auth on
The box itself (127.0.0.1)OpenOpenOpenLoopback is always trusted.
LANOpenOpenRefused when Force LAN auth is on.OpenNeeds credentials when Force LAN auth is on.
Whitelisted IPOpenRefusedOpen when IP whitelist auth is enabled (Disable IP whitelist auth off).Open when IP whitelist auth is enabled (Disable IP whitelist auth off).
TailscaleOpenRefusedOpen when Allow Tailscale without login is on.Open when Allow Tailscale without login is on.
Internet (WAN, domain or VPS forwarding)OpenAnyone who can reach the box can call these routes.RefusedTraffic relayed through your VPS never gets the LAN, Tailscale or whitelist exemptions.
  • Open Answers without credentials
  • Needs HTTP Basic credentials
  • Refused Refused (401), even with credentials

The switches

All of them are in the panel under General Settings → System Setting → Security. Secure the XProxy dashboard shows where each one is.

Panel switchDefaultWhat it does
Dashboard Auth (dashboard_disable_auth off)OffChecks the username and password. While it is off, no login is ever accepted.
Force API Auth (api_auth_check)OffPublic routes then need a trusted address, the login or a key, like panel routes.
Force LAN Auth (dashboard_force_auth_local)OffLAN callers lose their exemption and must log in or send a key.
IP Auth (dashboard_disable_ip_auth off)OffLets the addresses in Whitelist IPs in without a login.
Tailscale (dashboard_auth_allow_tailscale)OffLets devices on the box's Tailscale network in without a login.

Turning on Force API Auth breaks rotation links that your bots or antidetect browsers call without a login. Give them a Rotate only key first, then turn the switch on.

When the box says no

HTTP and bodyWhyWhat to do
401 {"message": "Unauthorized. Your IP: 203.0.113.25"}The caller is not trusted and sent no valid login or key, while Force API Auth is off (a panel route, or a LAN caller with Force LAN Auth on). The IP is the address the box saw.Send the login or a Full access key, or trust that address (whitelist, Tailscale).
401 {"message": "Unauthorized", "status": false}Force API Auth is on and the caller is not trusted and sent no valid login or key.Send the login or a key. For rotation links, a Rotate only key.
401 {"status": false, "msg": "invalid_token"}An API key was sent and refused: unknown, expired, deleted, regenerated, malformed, a Full access key in ?token=, a Rotate only key on a non-rotation route, or any key on /v2/api_keys. The body is the same in every case.Check the key in the panel and create a new one if needed. Remove a token parameter you did not mean to send.
401 plain text Unauthorized AccessA panel route refused the login.Check the username and password, and that Dashboard Auth is on.
403 {"status": false, "code": "cross_origin"}A web page on another address called /v2/api_keys from a browser.Manage keys in the panel itself, or call these routes from a script.

A rotation link that carries a token value that is not a valid Rotate only key gets invalid_token instead of rotating, even from the LAN. Some tools append their own token parameter; remove it or replace it with your key.

Which one should I use?

You want toUse
Change the IP from AdsPower, Dolphin or another antidetect browserA Rotate only key in the Change IP URL
Run a bot or script on a server outside your LANA Full access key in the Bearer header, over HTTPS or Tailscale
Call the box from a computer on the same LANNothing, unless Force LAN Auth is on
Manage API keys from a scriptThe admin login (keys cannot manage keys)
Open the box to the internet safelyDashboard Auth with a strong password, then Force API Auth; see Secure the XProxy dashboard