developers / API reference
Auth API
The Auth API: get a session token with email and password, and sign out, with every endpoint's fields, who may call it, its rate limit and a curl example.
This page as MarkdownSign in with an email address and a password
post/auth/login
A closed account answers 403 `ACCOUNT_CLOSED` once the password is right, with when it was closed, the decision's number and why in a line. Without two-step sign-in, the answer is the signed-in user and a session token. With it, the answer is a `challenge` instead: send its token with the second step to `POST /auth/login/second-factor` within five minutes. Ten wrong passwords for one address within 15 minutes refuse it (429, `TOO_MANY_SIGN_INS`) until the oldest of them is 15 minutes old, whether or not an account uses it.
- Needs
- No token needed
- Anyone may call it.
- Rate limit
- 10 a minute
- Per address, for this endpoint.
- App scope
- Not open to apps
- Signing in, sessions and upload tokens are the account's own. Nor to API keys.
Body
emailstringrequiredpasswordstringrequiredAt least 8 characters
curl -X POST 'https://api.hematite.gg/v1/auth/login' \
-H "Content-Type: application/json" \
-d '{"email":"nova@example.com","password":"••••••••"}'{
"user": {
"id": 1,
"username": "nova",
"email": "nova@example.com",
"emailConfirmedAt": "2026-11-10T18:24:00.000Z",
"createdAt": "2026-11-10T18:24:00.000Z",
"updatedAt": "2026-11-10T18:24:00.000Z",
"permissionGroupId": 1,
"subscriptionGroupId": 1,
"stripeSubscriptionId": "string",
"domainId": 1,
"avatarId": 1,
"stripeCustomerId": "string",
"inviteId": 1,
"timeZone": "string",
"avatar": {
"key": "images/a1b2c3d4e5f6.png"
},
"badgeIds": [
1
],
"storageUsed": 2457600,
"storageLimit": 1073741824,
"imageCount": 1,
"folderCount": 0,
"publicImageCount": 0,
"publicFolderCount": 0,
"profile": {
"bio": "Screenshots from ranked nights",
"hideProfile": false,
"activityVisibility": "All"
}
},
"token": "hms_live_m0plGGtn67kMZy6D_…"
}WebAuthn's options for the second step with a passkey: hand them to the browser (`startAuthentication({ optionsJSON })` of `@simplewebauthn/browser`) and send its answer to `POST /auth/login/second-factor` as `passkey`
post/auth/login/passkey-options
Each set works once, for five minutes.
- Needs
- No token needed
- Anyone may call it.
- Rate limit
- 10 a minute
- Per address, for this endpoint.
- App scope
- Not open to apps
- Signing in, sessions and upload tokens are the account's own. Nor to API keys.
Body
challengestringrequiredThe challenge's token from POST /auth/login.
At most 256 characters
Response
Returns an object with these fields:
challengestringtimeoutnumberoptionalrpIdstringoptionalallowCredentialsobject[]optionalidstringtype"public-key"transportsenum[]optionalOne of
blecablehybridinternalnfcsmart-cardusb
userVerificationenumoptionalOne of
requiredpreferreddiscouraged
curl -X POST 'https://api.hematite.gg/v1/auth/login/passkey-options' \
-H "Content-Type: application/json" \
-d '{"challenge":"string"}'{
"challenge": "string",
"timeout": 0,
"rpId": "string",
"allowCredentials": [
{
"id": "string",
"type": "public-key",
"transports": [
"ble"
]
}
],
"userVerification": "required"
}The second step of signing in with two-step sign-in: the challenge `POST /auth/login` answered, with exactly one of a code from the authenticator app, a recovery code, or a passkey's answer (ask `POST /auth/login/passkey-options` for its options first)
post/auth/login/second-factor
Answers the signed-in user and a session token, as signing in without it does. A challenge takes five wrong answers; ten wrong second steps for an account within 15 minutes lock its second step for 15 minutes (429, `SECOND_STEP_LOCKED`) and email the account.
- Needs
- No token needed
- Anyone may call it.
- Rate limit
- 10 a minute
- Per address, for this endpoint.
- App scope
- Not open to apps
- Signing in, sessions and upload tokens are the account's own. Nor to API keys.
Body
challengestringrequiredThe challenge's token from POST /auth/login.
At most 256 characters
totpstringThe six digits the authenticator app shows now.
At most 16 characters
recoveryCodestringOne of the account's recovery codes (4KQ7-9MXT-2B); each works once.
At most 32 characters
passkeyobjectWhat the browser's navigator.credentials.get() answered, as JSON (WebAuthn's AuthenticationResponseJSON; startAuthentication() of @simplewebauthn/browser gives it).
idstringrequired1 to 1024 characters, matches ^[A-Za-z0-9_-]*$
rawIdstringrequired1 to 1024 characters, matches ^[A-Za-z0-9_-]*$
type"public-key"requiredauthenticatorAttachmentenumOne of
platformcross-platformclientExtensionResultsmap of anyresponseobjectrequiredclientDataJSONstringrequiredAt most 16384 characters, matches ^[A-Za-z0-9_-]*$
authenticatorDatastringrequiredAt most 16384 characters, matches ^[A-Za-z0-9_-]*$
signaturestringrequiredAt most 16384 characters, matches ^[A-Za-z0-9_-]*$
userHandlestringAt most 16384 characters, matches ^[A-Za-z0-9_-]*$
Response
Returns an object with these fields:
userUsertokenstringrecoveryCodesLeftinteger | nullAfter a recovery code: how many are left (a new set from Settings → Security once few are). Null otherwise.
curl -X POST 'https://api.hematite.gg/v1/auth/login/second-factor' \
-H "Content-Type: application/json" \
-d '{"challenge":"string"}'{
"user": {
"id": 1,
"username": "nova",
"email": "nova@example.com",
"emailConfirmedAt": "2026-11-10T18:24:00.000Z",
"createdAt": "2026-11-10T18:24:00.000Z",
"updatedAt": "2026-11-10T18:24:00.000Z",
"permissionGroupId": 1,
"subscriptionGroupId": 1,
"stripeSubscriptionId": "string",
"domainId": 1,
"avatarId": 1,
"stripeCustomerId": "string",
"inviteId": 1,
"timeZone": "string",
"avatar": {
"key": "images/a1b2c3d4e5f6.png"
},
"badgeIds": [
1
],
"storageUsed": 2457600,
"storageLimit": 1073741824,
"imageCount": 1,
"folderCount": 0,
"publicImageCount": 0,
"publicFolderCount": 0,
"profile": {
"bio": "Screenshots from ranked nights",
"hideProfile": false,
"activityVisibility": "All"
}
},
"token": "hms_live_m0plGGtn67kMZy6D_…",
"recoveryCodesLeft": 0
}Delete the current session
post/auth/logout
- Needs
- Session token
- The token from signing in, in the Authorization header.
- Rate limit
- 120 a minute
- Per address, for this endpoint.
- App scope
- Not open to apps
- Signing in, sessions and upload tokens are the account's own. Nor to API keys.
Response
data is empty: the status says it worked.
curl -X POST 'https://api.hematite.gg/v1/auth/logout' \
-H "Authorization: $HEMATITE_TOKEN"The step-up: this sign-in proves again that it's its person, for ten minutes, before a change that hands the account over (two-step sign-in, an upload token, an app, the email or the password)
post/auth/reauth
With two-step sign-in on, exactly one of a code from the authenticator app, a recovery code or a passkey's answer (options from `POST /auth/reauth/passkey-options`); without it, the password. Only a sign-in on the website can step up. Answers until when it holds.
- Needs
- Session token
- The token from signing in, in the Authorization header.
- Rate limit
- 5 a minute
- Per address, for this endpoint.
- App scope
- Not open to apps
- Signing in, sessions and upload tokens are the account's own. Nor to API keys.
Body
passwordstringThe password, for an account without two-step sign-in.
At most 128 characters
totpstringThe six digits the authenticator app shows now.
At most 16 characters
recoveryCodestringOne of the account's recovery codes (4KQ7-9MXT-2B); each works once.
At most 32 characters
passkeyobjectWhat the browser's navigator.credentials.get() answered, as JSON (WebAuthn's AuthenticationResponseJSON; startAuthentication() of @simplewebauthn/browser gives it).
idstringrequired1 to 1024 characters, matches ^[A-Za-z0-9_-]*$
rawIdstringrequired1 to 1024 characters, matches ^[A-Za-z0-9_-]*$
type"public-key"requiredauthenticatorAttachmentenumOne of
platformcross-platformclientExtensionResultsmap of anyresponseobjectrequiredclientDataJSONstringrequiredAt most 16384 characters, matches ^[A-Za-z0-9_-]*$
authenticatorDatastringrequiredAt most 16384 characters, matches ^[A-Za-z0-9_-]*$
signaturestringrequiredAt most 16384 characters, matches ^[A-Za-z0-9_-]*$
userHandlestringAt most 16384 characters, matches ^[A-Za-z0-9_-]*$
Response
Returns an object with these fields:
untildate-timerecoveryCodesLeftinteger | nullAfter a recovery code: how many are left. Null otherwise.
curl -X POST 'https://api.hematite.gg/v1/auth/reauth' \
-H "Authorization: $HEMATITE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"password":"••••••••"}'{
"until": "2026-11-10T18:24:00.000Z",
"recoveryCodesLeft": 0
}WebAuthn's options for a step-up with a passkey: hand them to the browser and send its answer to `POST /auth/reauth` as `passkey`
post/auth/reauth/passkey-options
Each set works once, for five minutes, for this sign-in.
- Needs
- Session token
- The token from signing in, in the Authorization header.
- Rate limit
- 10 a minute
- Per address, for this endpoint.
- App scope
- Not open to apps
- Signing in, sessions and upload tokens are the account's own. Nor to API keys.
Response
Returns an object with these fields:
challengestringtimeoutnumberoptionalrpIdstringoptionalallowCredentialsobject[]optionalidstringtype"public-key"transportsenum[]optionalOne of
blecablehybridinternalnfcsmart-cardusb
userVerificationenumoptionalOne of
requiredpreferreddiscouraged
curl -X POST 'https://api.hematite.gg/v1/auth/reauth/passkey-options' \
-H "Authorization: $HEMATITE_TOKEN"{
"challenge": "string",
"timeout": 0,
"rpId": "string",
"allowCredentials": [
{
"id": "string",
"type": "public-key",
"transports": [
"ble"
]
}
],
"userVerification": "required"
}