Connect and Test a Reseller API Login
Verify the Reseller API identity over HTTPS with standalone cURL, Python and PHP examples before calling authenticated operations.
Use the credentials created in Reseller API Manager. Replace server.example.com, examplereseller, billing_api and YOUR_API_PASSWORD in each example. Python needs Requests; PHP needs the cURL extension. Each example is standalone and sends all three required authentication headers.
Request
Send GET or POST to https://server.example.com:4444/api/v1/. No operation-specific fields are required. The default /api/ root also maps to the current reseller login handler. Use an independent client without panel-session cookies so the test verifies these headers rather than an existing browser login.
cURL example
curl --silent --show-error --include \
--connect-timeout 5 --max-time 30 \
--request POST \
--header 'X-RESELLER: examplereseller' \
--header 'X-API-USER: billing_api' \
--header 'X-API-PASSWORD: YOUR_API_PASSWORD' \
'https://server.example.com:4444/api/v1/'Python example
import json
import requests
url = "https://server.example.com:4444/api/v1/"
headers = {
"X-RESELLER": "examplereseller",
"X-API-USER": "billing_api",
"X-API-PASSWORD": "YOUR_API_PASSWORD",
}
payload = {}
try:
response = requests.post(url, headers=headers, data=payload,
timeout=(5, 30), allow_redirects=False)
if response.status_code != 200:
raise RuntimeError(f"HTTP {response.status_code}: {response.text}")
result = response.json()
if (not isinstance(result, dict) or result.get("reseller") != "examplereseller"
or result.get("username") != "billing_api" or result.get("auth") != "None"):
raise RuntimeError("Unexpected API response")
print(json.dumps(result, indent=2))
except (requests.RequestException, ValueError, RuntimeError) as error:
raise SystemExit(f"API request failed: {error}")PHP example
<?php
try {
$url = 'https://server.example.com:4444/api/v1/';
$payload = [];
$ch = curl_init($url);
if ($ch === false) {
throw new RuntimeException('Unable to initialize cURL');
}
try {
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query($payload),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => false,
CURLOPT_CONNECTTIMEOUT => 5,
CURLOPT_TIMEOUT => 30,
CURLOPT_SSL_VERIFYPEER => true,
CURLOPT_SSL_VERIFYHOST => 2,
CURLOPT_HTTPHEADER => [
'X-RESELLER: examplereseller',
'X-API-USER: billing_api',
'X-API-PASSWORD: YOUR_API_PASSWORD',
],
]);
$body = curl_exec($ch);
if ($body === false) {
throw new RuntimeException(curl_error($ch));
}
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
} finally {
curl_close($ch);
}
if ($httpCode !== 200) {
throw new RuntimeException('HTTP ' . $httpCode . ': ' . $body);
}
$result = json_decode($body, true, 512, JSON_THROW_ON_ERROR);
if (!is_array($result) || ($result['reseller'] ?? null) !== 'examplereseller'
|| ($result['username'] ?? null) !== 'billing_api'
|| ($result['auth'] ?? null) !== 'None') {
throw new RuntimeException('Unexpected API response');
}
echo json_encode($result, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR) . PHP_EOL;
} catch (Throwable $error) {
fwrite(STDERR, 'API request failed: ' . $error->getMessage() . PHP_EOL);
exit(1);
}Expected identity
HTTP 200 with these illustrative values:
{
"reseller": "examplereseller",
"username": "billing_api",
"auth": "None"
}The reseller and username must match the two chosen identities. auth is the string "None", not JSON null or a bearer token. The login does not issue a token or authenticate later requests automatically: keep sending all three headers.
Test operation access
Next call test_connection. The API-root login is not demo-wrapped, so a successful identity check can still be followed by an operation rejected on a demo server. Successful connection testing does not establish that the target account/package belongs to the reseller or that chain reselling is enabled.
If the request fails
| Symptom | Check |
|---|---|
| Connection/TLS failure | Direct server hostname, RAPP HTTPS port 4444, DNS/network reachability and certificate trust. Do not disable certificate validation to conceal a hostname/trust failure. |
| HTTP 403 without an authenticated identity | All three headers are non-empty; X-RESELLER identifies an existing reseller and satisfies the identifier pattern. Body/query credentials do not replace these headers. |
| Invalid API credentials | Correct reseller/API-user pair, current password and allowed source IP. API users belong to one reseller. |
| Source-IP mismatch | Actual remote address or first forwarded address as observed by the panel; trusted proxies must replace untrusted forwarding headers. |
| Redirect response | Use the final direct HTTPS endpoint; the examples reject redirects instead of forwarding credentials automatically. |
| Unexpected identity/shape | Confirm the base URL and remove session cookies or other authentication. A WAP login has a different response shape. |
| Later operation returns HTTP 400 | Read its JSON error: target ownership, suspended state, package ownership, reseller limits or demo restrictions can prevent the call. |
Authentication/permission errors generally contain detail rather than the operation data/info/status envelope. Inspect HTTP status and response shape separately. See the authentication and ownership rules.