Every Webhood API endpoint requires a valid credential. There are no public or anonymous routes. The system supports two credential types — interactive user sessions and long-lived API tokens — and enforces role-based access so that each credential class can only reach the routes appropriate for its purpose.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/webhood-io/webhood/llms.txt
Use this file to discover all available pages before exploring further.
User Authentication
User accounts are stored in PocketBase’susers collection. Authentication is performed by posting an email/password pair to the standard PocketBase auth endpoint:
Bearer token on all subsequent requests. The core UI uses the official PocketBase JavaScript client to handle this flow; on a successful login the token is stored in localStorage via pb.authStore.
Example: Obtaining a Token with curl
token field and a record object containing the user’s details including their role.
Self-registration is disabled by default (
SELF_REGISTER=false in the compose environment). New user accounts must be created by a PocketBase admin or by an admin-role user through the Webhood UI Settings panel.API Token Authentication
API tokens provide programmatic access without requiring an interactive login. They are stored in theapi_tokens collection and are created in one of two ways:
- Settings → Accounts in the Webhood UI (for regular API access tokens)
- PocketBase admin panel for direct record management
Authorization header exactly as you would a user JWT:
users and api_tokens collections on API routes:
Scanner Authentication
The scanner uses a special API token generated through the admin API. This token is issued per scanner record and is distinct from user-created API tokens. To generate one, an admin-role user calls:WebhoodAdminApiMiddleware, which requires both a valid users credential and the admin role. The generated token is then placed in the SCANNER_TOKEN environment variable of the scanner container.
scanner role. This role is intentionally narrow: it permits the scanner to pick up queued scans and post results, but it cannot call any admin routes.
Role-Based Access Control
TheRequireCustomRoleAuth middleware enforces role checks on protected routes. After standard PocketBase authentication succeeds, it reads the role field from the authenticated record and compares it against the role required by the route:
| Route group | Collections accepted | Role required |
|---|---|---|
/api/beta/scans, /api/v1/scans (scanner routes) | users, api_tokens | scanner |
/api/ui/scans (UI routes) | users only | (any authenticated user) |
/api/beta/admin/* | users only | admin |
/_/ admin panel) bypass the role check entirely and have unrestricted access to all routes.