REST: auth, account, and settings
These endpoints cover two scopes. Account actions identify the signed-in person;
workspace settings identify the workspace selected by X-Workspace-ID or the
account's default membership. A settings endpoint with a historical user
name still edits workspace behavior.
Choose the operation
| Task | Scope | Important result |
|---|---|---|
| Register or sign in | Account | Receive a bearer token. Registration depends on instance policy. |
| Refresh or log out | Current token | Refresh replaces and revokes the old token; logout returns no body. |
| Change/reset password | Account | Active sessions are revoked under the revocation-store policy. |
| Delete account | Account and memberships | Shared-workspace ownership must be resolved first. |
| Read/save checker settings and judges | Selected workspace | Operator access for writes; omitted fields retain their values. |
| Save table columns | Member in selected workspace | Does not recompile checker settings. |
| Export proxies | Selected workspace | Text stream; the transfer must finish successfully. |
| Read profile | Account | Email and global role, independent of workspace selection. |
New clients should use GET and POST /api/workspace/settings for workspace
settings. /api/user/settings remains a compatible alias with the payloads
documented below. Start with the API workflow if you need
to obtain a token and workspace ID.
Save only what you edited
For example, update judges without resending a stale checker-rule list:
POST /api/workspace/settings
Authorization: Bearer <token>
X-Workspace-ID: 42
Content-Type: application/json
{"judges":[{"url":"https://judge.example.test/","regex":"expected response"}]}
The judge URL is a placeholder. Use a reachable judge and a validation rule
that matches its response. Supplying checker_settings replaces Default and
the full ordered rule list together; omitting it preserves those rules.
Use checker settings to understand
inheritance before constructing a full replacement.
POST /api/register
Registers a new user.
Request:
{
"password": "StrongPassword123"
}
Behavior:
- Validates email format.
- Normalizes email input to trimmed lowercase.
- Requires a strong password:
- at least 12 characters
- at least one uppercase letter
- at least one lowercase letter
- at least one number
- no whitespace
- First user in DB becomes
admin; later users becomeuser. - Registration policy can be restricted by env flags (
DISABLE_PUBLIC_REGISTRATION,ENABLE_PUBLIC_FIRST_ADMIN_BOOTSTRAP). - Route is rate-limited (
429+Retry-After). - Creates a personal workspace, owner membership, entitlement, member preferences, default judges, and default scrape sources.
Success (201):
{
"token": "<jwt>"
}
An optional warning can report that default scrape sources could not be
queued and were rolled back. The account still exists. Add sources again
after resolving the queue problem; do not register the same account again.
POST /api/login
Request:
{
"password": "StrongPassword123"
}
Success (200):
{
"token": "<jwt>",
"role": "admin"
}
Notes:
- Login email lookup is case-insensitive.
- Invalid credentials return
401with{"error":"Invalid email or password"}. - Login is protected by request and failure-based rate limiting (
429+Retry-After).
POST /api/forgotPassword
Requests a password-reset email.
Request:
{
}
Success (200):
{
"message": "If an account exists for that email, a password reset link has been sent."
}
Notes:
- Response is intentionally generic.
- If outbound email is configured and the account exists, the backend stores a hashed reset token and queues the email in the durable outbox.
- In multi-instance deployments, every backend instance can process queued outbox rows from the shared database.
- Reset links are built from
PUBLIC_APP_URL; request headers are not trusted for link generation. - Route is rate-limited both by request volume and by normalized email address.
- Default per-email throttle is 1 reset-email request per 60 seconds.
- If password recovery is not configured or the email outbox cannot persist the request, the endpoint returns
503.
POST /api/resetPassword
Consumes a reset token and sets a new password.
Request:
{
"token": "raw-reset-token",
"newPassword": "StrongPassword123"
}
Success (200):
{
"message": "Password reset successfully"
}
Notes:
- Reset tokens are single-use and expire automatically.
newPasswordmust satisfy the same strong password policy as registration.- Invalid or expired tokens return
401. - Route is rate-limited both by request volume and, for valid tokens, by the resolved account email.
- Successful reset removes all outstanding reset tokens for that user.
- Successful reset revokes active sessions under normal revocation-store operation.
- A confirmation email is queued after a successful reset.
POST /api/refreshToken
Requires auth.
Rotates the current bearer token and revokes the previous token.
Success (200):
{
"token": "<new-jwt>",
"role": "admin"
}
POST /api/logout
Requires auth.
Revokes the current bearer token.
- Success:
204 No Content
GET /api/checkLogin
Requires auth. Returns 200 if token is valid.
POST /api/changePassword
Requires auth.
Request:
{
"oldPassword": "old-value",
"newPassword": "StrongPassword123"
}
Success returns a JSON string body: "Password changed successfully".
Notes:
oldPasswordmust match the current password.newPasswordmust satisfy the same strong password policy as registration and password reset.- Successful password change revokes active sessions.
POST /api/deleteAccount
Requires auth.
Request:
{
"password": "current-password"
}
Success returns a JSON string body: "Account deleted successfully".
The request is rejected with 409 while the account is the sole owner of a
shared workspace. Transfer ownership first. Deleting an account removes its
solitary personal workspace and revokes its other memberships; it never removes
resources or capacity from shared workspaces.
GET /api/user/settings
Requires viewer or higher in the selected workspace. Returns workspace checker/scraper settings plus the authenticated member's column preferences.
Response shape:
{
"checker_settings": {
"defaults": {"protocols": ["http", "https"], "transport": "tcp", "timeout": 7500, "retries": 2},
"rules": [{"tag_id": 42, "mode": "add", "protocols": ["http"], "timeout": 5000, "retries": 0}]
},
"http_protocol": true,
"https_protocol": true,
"socks4_protocol": false,
"socks5_protocol": false,
"timeout": 7500,
"retries": 2,
"UseHttpsForSocks": true,
"transport_protocol": "tcp",
"auto_remove_failing_proxies": false,
"auto_remove_failure_threshold": 3,
"failure_action": "pause",
"judges": [{"url": "https://example/judge", "regex": "..."}],
"scraping_sources": ["https://example/source"],
"proxy_list_columns": ["ip", "country"],
"scrape_source_proxy_columns": ["ip", "protocol"],
"scrape_source_list_columns": ["url", "proxy_count"]
}
POST /api/user/settings
Requires operator or higher in the selected workspace. Saves workspace protocol/checker settings and judges. Column preferences are stored for the authenticated user in that workspace.
Request accepts the editable settings fields returned by GET /api/user/settings. Omitted fields retain
their stored values. Providing checker_settings atomically replaces Default
and the complete ordered rule list. rules[0] has highest priority and applies
last. Tag IDs must belong to the selected workspace. Duplicate tags or protocols,
invalid modes, budgets, or transport combinations return 400 without a partial
save.
Send only fields edited by the current action. A column save can send
{"proxy_list_columns": ["ip_port", "tags", "country"]}; a judge save can send
only {"judges": [...]}. Include checker_settings only when explicitly saving
Default and tag rules. Resending an older settings snapshot can overwrite newer
edits or fail validation after a referenced tag has been deleted.
Column-only saves update the member's preferences without triggering checker
reconciliation or changing workspace checker revisions.
defaults contains protocols, a list of enabled protocol names, and the required
shared transport, timeout of 1 through 65535 ms, and retries of 0 through 255. Protocol names
are http, https, socks4, and socks5. Supported transports are tcp, quic,
and http3. All enabled protocols use the same effective transport and budget.
Rules use replace, add, or remove. Add and Replace accept optional shared
transport, timeout, and retry fields. Omitted or null fields inherit from
Default and earlier matching rules. Explicit fields update all enabled protocols.
Zero retries disables retries. Remove only accepts a protocol selection, such
as {"tag_id": 42, "mode": "remove", "protocols": ["http"]}. An empty Add
selection can change only the shared fields.
Validation considers every reachable tag combination. SOCKS requires TCP and cannot inherit QUIC or HTTP/3 through another tag. Empty protocol sets are valid.
Older clients that omit checker_settings preserve tag rules. Legacy scalar
fields edit Default's shared values, and protocol booleans edit its selection.
Earlier per-protocol draft JSON remains readable. Conversion chooses the first
enabled Default protocol and each rule's first explicit field in HTTP, HTTPS,
SOCKS4, SOCKS5 order. If the converted shared transports would be incompatible
with SOCKS, they use TCP. New responses and writes use the shared profile format. See
Default and tag settings.
failure_action accepts pause or delete and defaults to pause. If omitted
or empty, the stored action is preserved for compatibility with older clients.
An unsupported value returns 400 before any settings are saved. The existing
auto_remove_failing_proxies flag enables the chosen action, and
auto_remove_failure_threshold sets its consecutive-failure threshold.
Delete applies only to the selected workspace's active managed proxies after a
subsequent failed check. It does not delete already-paused proxies or enforce
saved failure streaks during startup. A later import or scrape can add the route
again. See automatic failure action.
Success (200):
{"message": "Settings saved successfully"}
Source-management boundary:
scraping_sourcesmay be accepted in this payload but scrape-source persistence is managed byPOST /api/scrapingSourcesandDELETE /api/scrapingSources./api/workspace/settingsis the preferred alias./api/user/settingsremains available for client compatibility; both are workspace-scoped.
Read a saved workspace configuration after a write when your client needs the normalized result. Newly saved settings apply to subsequent checks; already running checks finish with their captured configuration. Current health can be unknown until the new settings projection and matching evidence exist.
GET /api/user/role
Requires auth.
Response body is a JSON string: "admin" or "user".
POST /api/user/export
Requires viewer or higher. Exports managed proxies from the selected workspace by selected IDs and/or filters.
Request:
{
"proxies": [101, 102],
"filter": true,
"http": true,
"https": true,
"socks4": false,
"socks5": false,
"maxRetries": 2,
"maxTimeout": 5000,
"proxyStatus": "alive",
"reputationLabels": ["good", "neutral"],
"tagIds": [4, 9],
"outputFormat": "ip:port"
}
When filtering is enabled, the optional states array accepts active, paused, and archived with ANY matching, for example "states": ["paused", "archived"]. The single state field remains supported. Omitting it includes all lifecycle states.
When filtering is enabled, tagIds matches proxies that have any selected tag.
Response:
Content-Type: text/plain- Body contains the formatted export content.
GET /api/user/profile
Requires authentication. Returns the signed-in account's email and role, independent of the selected workspace.
The frontend uses this endpoint to restore the session and display the email in the sidebar account menu. GET /api/user/role remains available.