Skip to content

Authentication

Homestead has four kinds of credentials. All tokens are 32 random bytes, base62-encoded, with a prefix that says what they are. The server stores only their SHA-256 hashes.

CredentialPrefixWhoHow to send it
Session cookiehs_sessionWeb appCookie, plus X-CSRF-Token on writes
Device tokenhsd_Phone app, Firefox companion, scripts acting as a memberAuthorization: Bearer hsd_…
Agent tokenhst_Hermes, OpenClaw, scriptsAuthorization: Bearer hst_…
Capture upload tokenhsu_Homestead HelperAuthorization: Bearer hsu_…

Sign in with "client": "web":

Terminal window
curl -X POST http://localhost:8080/api/v1/auth/login -H "Content-Type: application/json" -d '{"username":"mali","password":"your-password","client":"web"}'

The reply sets the hs_session cookie (HttpOnly, SameSite=Lax, and Secure over HTTPS) and returns a csrfToken. It’s also readable later from GET /api/v1/me.

Every write with the cookie (anything other than GET, HEAD or OPTIONS) must:

  • send X-CSRF-Token equal to that csrfToken, and
  • come from the same origin. When HOMESTEAD_BASE_URL is set, the Origin header must match its scheme and host exactly. Otherwise 403 forbidden.

A web session lasts 30 days and renews while used.

A device token acts as the member who created it, with that member’s role. Bearer requests don’t need CSRF.

  • Sign in with "client": "device" (and an optional deviceName); the reply carries deviceToken, shown once.
  • Or pair: a signed-in member creates a pairing code with POST /api/v1/auth/pairing-codes (10 minutes, 8 characters, QR payload homestead://pair?server=<baseUrl>&code=<code>), and the device sends it to POST /api/v1/auth/pair with a deviceName.
  • The Firefox companion pairs the same way with "client": "extension".

Device tokens last 365 days and renew while used. POST /api/v1/auth/logout ends one.

Created by a member on the Agents screen, with POST /api/v1/agent/tokens, or with homestead token create on the server. The token and a ready-made setup block (REST base URL, MCP URL, Hermes YAML, OpenClaw JSON5, an env block) are returned once.

{
"name": "Hermes on homeserver",
"agentKind": "hermes",
"preset": "fetcher",
"platforms": ["instagram", "douyin"]
}

Agent tokens never get household administration: members, invites, tokens and source settings are off limits. An operation without x-required-scopes refuses agent tokens with 403 agent_not_allowed; one whose scope the token lacks gives 403 scope_missing.

ScopeAllows
people:readList and read people, accounts, platforms
people:writeResolve input, quick-add, create and edit people and accounts
circles:readList and read circles
circles:writeCreate and edit circles and membership
shares:writeCreate share links and import circle packs
feed:readRead feed, story rail, moments
tasks:workLease and complete agent tasks
ingest:writePush moments and upload media
PresetScopes
fetcherpeople:read, tasks:work, ingest:write
helper (default)All scopes except shares:write
fullAll scopes

scopes, when given, overrides preset. platforms limits which platforms’ tasks the token can lease.

Each use updates the token’s last-used time, shown in the app. Revoke with DELETE /api/v1/agent/tokens/{tokenId}; its leased tasks return to the queue.

createCapture returns an hsu_ token valid for 10 minutes, for uploadCaptureAsset on that one capture only. Operations that accept it are marked x-capture-upload in the spec.

RoleCan
ownerEverything, including household settings, members, source settings and agent tokens
memberAdd and edit people, accounts, circles, shares; create agent tokens; invite viewers
viewerRead feed, stories, people, circles; mark seen; record visits; snooze; edit own profile

Each operation lists its minimum role as x-min-role. Public operations (x-public), such as health, setup, login, pair, invite preview and the public share, need no credentials.

Login, pair and accept-invite are limited to 10 a minute per IP. Five failed logins lock that username for 15 minutes. See Conventions.