Single sign-on: one-time login link to the control panel

For server administrators · Updated 2026-10-29

On this page
  1. Before you start
  2. Request
  3. Use the link
  4. Rules
  5. Example in PHP
  6. Common questions

Your client area or billing system can give customers a "Log in to Control Panel" button: it asks the API for a one-time link and sends the customer's browser to it.

Before you start

  • An administrator or reseller API token that is not read only. Resellers need the Log in to customers' control panels privilege.
  • The account must be active. A suspended account answers 422 This account is suspended.

Request

curl -s -X POST -H "Authorization: Bearer $TOKEN" \
  https://server1.example.com:2087/api/v1/accounts/shop1/login

Response:

{"status": 1, "data": {"url": "https://server1.example.com:2083/sso/4f1c…"}}
  1. Request the link when the customer clicks the button, not in advance.
  2. Redirect the customer's browser to data.url at once.
  3. The customer sees You are about to sign in to the hosting account shop1 (shop-example.com). and clicks Continue. They are signed in to the control panel.

Rules

  • The link works once and within 60 seconds. After that the customer sees This sign-in link has expired or was already used. Open it again from your client area.
  • The Continue step makes sure a link sent by someone else cannot silently sign a visitor in.
  • Each link is recorded in Activity Log.
  • The /json-api/create_user_session function makes the same link for billing systems that use it.

Example in PHP

$ch = curl_init('https://server1.example.com:2087/api/v1/accounts/' . rawurlencode($username) . '/login');
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $token],
]);
$answer = json_decode(curl_exec($ch), true);
if (!empty($answer['status'])) {
    header('Location: ' . $answer['data']['url']);
    exit;
}
echo $answer['error'] ?? 'Could not sign in.';

Common questions

More than 60 seconds passed before the customer clicked Continue, or Continue was already clicked once with that link. Opening the link alone does not use it up. Create a new link on each click.

Was this article helpful?

Still stuck?

Ask the AI about your exact situation — it answers from this knowledge base — or contact us.