Documentation
Authentication and Billing
API keys, the shared balance and the ledger.
Authentication
Send X-API-Key on every request. Each account has its own key (shown on its
SERP API page); the server-wide API_KEY from .env still
works and bills the administrator. Usage is charged to the key's owner, and a missing, revoked or
invalid key returns 401.
Accounts
UI_USERNAME/UI_PASSWORD create the first administrator on startup. From
Admin → Users that administrator can create further accounts, give them an opening
balance, top them up, disable them, reset passwords, rotate API keys and delete them.
Every account is isolated: its own trackers, cloud tasks, API key, balance and usage. Non-admin accounts see the workspace only (Overview, Rank Tracker, Cloud Scraping, SERP API) — no billing, settings or user management, so nobody can fund themselves.
Dashboard login
Set UI_USERNAME and UI_PASSWORD in .env to seed the first administrator and require a sign-in.
Sessions are signed with a persisted server secret, expire after 12 hours, and signing out
invalidates every issued cookie. Set UI_COOKIE_SECURE=true when the dashboard is
served over HTTPS.
Combine it with UI_ALLOWED_IPS when the server is public: the allowlist is checked
before the login form, and the API at /v1/search always requires X-API-Key.
Cache hits are free
Identical requests reuse a stored response for CACHE_TTL seconds
(300 by default). A cache hit returns "cache": {"hit": true} with
"cost": 0, is not written to the ledger, and answers in milliseconds.
Cloud tasks and trackers that re-read recently collected keywords are not billed
for the cached answers, so re-runs only pay for fresh scrapes.
Send Cache-Control: no-cache to force a fresh scrape, or set
CACHE_ENABLED=false to disable reuse entirely.
Rates
| Product | Rate | Billed when |
|---|---|---|
| SERP API | $0.0005 | A successful request returns a page. |
| Rank Tracker | $0.0005 | Each results page searched. |
| Cloud Scraping | $0.0001 | Each successful query, up to five pages. |
Balance
The balance is the sum of credits and charges in the ledger. A request with an empty
balance returns 402 with ERR_BILLING_001. Add funds from
Billing; this self-hosted build does not process real payments.
Idempotency
Send a stable Idempotency-Key per logical request. A replay within 24
hours returns the original JSON with X-Idempotent-Replay: true and is not
charged again.