API

API reference: account and sign-in

Every route for registering, signing in, sessions, password reset, Google sign-in and two-factor authentication.

Paths are relative to https://api.perkhost.com/api/v1. "Session" means a bearer access token from sign-in. Read "API overview" for errors and limits. A body that is not listed for a route means the route takes none.

Sign-in and sessions

Sign-in and session routes
RouteAuthRequest bodySuccess
POST /auth/registerPublicname, email, password (no client: a native app sends it to /auth/register/confirm)202 and { "status": "check_email" } for every address; the outcome is emailed
POST /auth/register/confirmPublic, with the emailed tokentoken, password (the one chosen at sign-up), optional client201, a session: token and user; with client also expiresAt and refreshToken; 400 for an invalid, expired or used link or a wrong password
POST /auth/loginPublicemail, password, optional client200, a session as for register/confirm, or mfaRequired, mfaToken and expiresAt when two-factor is on
POST /auth/forgotPublicemail200, the same message for every address
POST /auth/resetPublic, with the emailed tokentoken, password204
POST /auth/refreshRefresh tokenrefreshToken200, token, expiresAt and a new refreshToken
POST /auth/logoutRefresh token or sessionoptional refreshToken204
GET /auth/meSessionnone200, id, email and name
DELETE /auth/meSessionpassword204
GET /auth/sessionsSessionnone200, a list of id, platform, name, createdAt, lastUsedAt, current for sessions started with a client
DELETE /auth/sessions/{sessionId}Sessionnone204

client is { "platform": "web" | "cli" | "mcp" | "api", "name": "<1 to 100 characters>" }. Registration, sign-in, password reset, refresh and account deletion are rate limited per address, per email or per user.

Google sign-in

Google sign-in routes
RouteAuthRequest bodySuccess
GET /auth/google/configPublicnone200, { "enabled": false } or enabled, clientId and authorizationEndpoint
POST /auth/googlePubliccode, codeVerifier, nonce, redirectUri200, a session, as for login

Two-factor authentication

Two-factor routes
RouteAuthRequest bodySuccess
GET /auth/mfaSessionnone200, enabled, totpEnabled, emailEnabled, emailPending, pending, enabledAt, recoveryCodesRemaining, requiredBy, daysLeft
POST /auth/mfa/verifySign-in challengemfaToken and one of code, recoveryCode, emailCode200, a session, as for login
POST /auth/mfa/enrolSessionpassword200, secret and otpauthUri
POST /auth/mfa/enableSessionpassword, code; with email codes on, also one of emailCode or recoveryCode200, recoveryCodes and session
POST /auth/mfa/disableSessionpassword and one of code or recoveryCode200, session
POST /auth/mfa/recovery-codesSessionpassword and one of code, recoveryCode or emailCode200, recoveryCodes
POST /auth/mfa/email/sendSign-in challengemfaToken202, message
POST /auth/mfa/email/enrolSessionpassword200, sentTo and expiresAt
POST /auth/mfa/email/enableSessionpassword, code; with the authenticator on, also one of authenticatorCode or recoveryCode200, recoveryCodes and session
POST /auth/mfa/email/step-upSessionpassword200, sentTo and expiresAt; 409 when email codes are off, 503 when the email cannot be sent
POST /auth/mfa/email/disableSessionpassword and one of code, recoveryCode or emailCode200, session

The session in an enable or disable answer carries the token to use from then on, and expiresAt for native sessions. Authenticator codes and email codes are 6 digits. A recovery code looks like xxxxx-xxxxx; case, spaces and hyphens are ignored when it is checked.