Accounts and access
6. Accounts and sessions
An account is an email address and a password (or an SSO identity; see section 9). Email addresses are trimmed and lower-cased before they are stored or compared. The server does not send email: it does not verify addresses, and there is no self-service "forgot password" flow (section 6.8).
6.1 Sign-up modes#
Who may create an account is set by the SIGNUP environment variable, read at start-up.
SIGNUP |
Behaviour |
|---|---|
open (default) |
Anyone may sign up. |
first |
Only the first account may be created. After that, sign-up answers 403 signup_closed. The server remembers that it has been claimed: sign-up stays closed even if that first account is later deleted. |
invite |
Sign-up requires the shared code in INVITE_CODE, sent as the invite field. The server refuses to start in this mode without INVITE_CODE. |
closed |
Nobody may sign up. |
In every mode there is one additional way in: an organisation invite issued by the instance owner for the same email address (section 10.5) admits a new account, sent as the orgInvite field. An invite issued by any other account does not open a restricted server by itself: the sign-up must also pass the mode's own check (for example, carry the correct invite code when SIGNUP=invite). Whenever a sign-up is admitted and carries a valid orgInvite for its address, the new account joins that organisation.
6.2 The password field#
The server treats the password string as opaque: it hashes whatever it receives (Argon2id) and compares against that hash at login. The first-party apps and the server's own browser pages never send the password the user typed. They send a derived value:
password_field = base64( SHA-256( "graphlife/auth/v1|" + lowercase(trim(email)) + "|" + typed_password ) )
using standard base64 with padding. An integration that creates accounts or logs in on behalf of people who will also use the GraphLife apps, the built-in web pages or the OAuth consent screen must send the same derived value, or those people will not be able to sign in there. An account used only by your own integration may send any string of at least 8 characters, as long as it sends the same one every time.
EMAIL='[email protected]'
PW='correct horse battery staple'
DERIVED=$(printf '%s' "graphlife/auth/v1|${EMAIL}|${PW}" | openssl dgst -sha256 -binary | base64)
The examples below use $DERIVED wherever a password is sent.
POST/v1/accounts/signup#
Creates an account. Public, subject to the sign-up mode.
| Body field | Type | Required | Meaning |
|---|---|---|---|
email |
string | yes | The account's address. |
password |
string | yes | At least 8 characters. See section 6.2. |
invite |
string | when SIGNUP=invite |
The server's invite code. |
orgInvite |
string | no | An organisation invite token for this address. If valid, the new account joins that organisation with the invited role. |
curl -X POST https://graphlife.example.com/v1/accounts/signup \
-H 'Content-Type: application/json' \
-d "{\"email\":\"[email protected]\",\"password\":\"$DERIVED\"}"
Response: 202 Accepted
{ "status": "ok" }
The response is the same whether the address was new or already had an account; an existing account is left unchanged. No tokens are returned: call POST /v1/accounts/login next.
| Status | code |
When |
|---|---|---|
| 400 | invalid |
Missing email, or password shorter than 8 characters. |
| 403 | signup_closed |
The sign-up mode does not admit this request. |
| 403 | invite_invalid |
SIGNUP=invite and the invite code is missing or wrong. |
| 429 | rate_limited |
POST/v1/accounts/login#
Exchanges an email and password for a session. Public.
| Body field | Type | Required | Meaning |
|---|---|---|---|
email |
string | yes | |
password |
string | yes | See section 6.2. |
device_id |
string | no | A label of your choosing for this client. It is stored with the session and echoed in the access token's claims. |
curl -X POST https://graphlife.example.com/v1/accounts/login \
-H 'Content-Type: application/json' \
-d "{\"email\":\"[email protected]\",\"password\":\"$DERIVED\",\"device_id\":\"billing-sync\"}"
Response: 200 OK
{
"user_id": "0b6f2c1e-8a41-4d0f-9c55-2f1f0c9d7a10",
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refresh_token": "glr_...",
"expires_in": 3600
}
| Status | code |
When |
|---|---|---|
| 401 | unauthorized |
Unknown address, wrong password, an account scheduled for deletion, or an SSO-only account (which has no password). The response does not distinguish between these. |
| 429 | rate_limited |
POST/v1/accounts/token/refresh#
Exchanges a refresh token for a new access token and a new refresh token. Public (the refresh token is the credential).
| Body field | Type | Required |
|---|---|---|
refresh_token |
string | yes |
curl -X POST https://graphlife.example.com/v1/accounts/token/refresh \
-H 'Content-Type: application/json' \
-d '{"refresh_token":"glr_..."}'
Response: 200 OK, the same shape as login.
Refresh tokens are single use and rotated: each call revokes the token presented and returns a new one. Store the new refresh token every time. Presenting a refresh token that has already been used revokes the whole chain of sessions descended from the original login, and the client must log in again. If two processes share one session, make sure only one of them refreshes.
A session created through SSO cannot be refreshed more than SSO_SESSION_HOURS (default 24) after the sign-in at the identity provider; after that the person must sign in again.
| Status | code |
When |
|---|---|---|
| 400 | invalid |
refresh_token missing. |
| 401 | unauthorized |
Unknown, expired, already-used or revoked token; or an SSO session past its maximum age. |
POST/v1/accounts/logout#
Revokes sessions. Session.
| Body field | Type | Meaning |
|---|---|---|
all |
boolean | true revokes every session of the account, on every device. |
refresh_token |
string | Revokes the session that owns this refresh token. |
| (neither) | Revokes the session of the access token used for the call. |
Response: 204 No Content. 401 unauthorized without a valid session.
POST/v1/accounts/password#
Changes the caller's own password. Session.
| Body field | Type | Required | Meaning |
|---|---|---|---|
currentPassword |
string | yes | The current password, in the form used at login. |
newPassword |
string | yes | At least 8 characters, in the form you will use at login (section 6.2). |
Response: 200 OK with {"status":"ok"}. Every session of the account is revoked, including the one that made the call; log in again with the new password. API keys the account minted and OAuth connections it approved are not revoked by a password change; revoke those separately (sections 7 and 8) if the account may have been compromised.
| Status | code |
When |
|---|---|---|
| 400 | invalid |
A field is missing or the new password is too short. |
| 401 | unauthorized |
No valid session. |
| 403 | wrong_password |
currentPassword does not match. |
| 409 | sso_account |
The account signs in only through an identity provider and has no password here. |
DELETE/v1/accounts/me#
Schedules the caller's account for deletion. Session, with re-authentication.
| Body field | Type | Required | Meaning |
|---|---|---|---|
confirm |
string | yes | Must be exactly DELETE. |
password |
string | for password accounts | Re-authentication (section 2.2). |
now |
boolean | no | true deletes immediately instead of after the grace period. |
curl -X DELETE https://graphlife.example.com/v1/accounts/me \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H 'Content-Type: application/json' \
-d "{\"confirm\":\"DELETE\",\"password\":\"$DERIVED\"}"
Response: 202 Accepted
{ "status": "purge_scheduled", "purge_scheduled_for": 1767225600 }
Effects, at the moment of the call: every session of the account is revoked, its share grants are revoked, its personal data connections stop syncing, and any organisation graph anchored to the account is re-anchored to another member. The account can no longer log in, and its API keys and OAuth connections on organisation graphs stop reaching anything. The account's data is hard-deleted by an hourly sweep once purge_scheduled_for has passed (72 hours later by default, or at once with now: true). There is no API to cancel a scheduled deletion.
Two consequences to plan for:
- API keys and OAuth tokens on the account's personal graphs are not revoked at the moment of the call. They keep working until the data is purged. Revoke them first if they must stop at once, or use
now: true. - An organisation whose graphs are anchored to this account, and in which no other active owner, admin or member remains to take them over, is deleted immediately, with those graphs, not at the end of the grace period. In practice this is an organisation whose only member is the account being deleted.
| Status | code |
When |
|---|---|---|
| 400 | invalid |
confirm is not DELETE, or a password account sent no password. |
| 401 | unauthorized |
No valid session, or re-authentication failed. |
| 409 | org_owner |
The account is the only owner of an organisation that still has other members. Transfer ownership or delete the organisation first. |
POST/v1/accounts/me/export#
Returns a ZIP archive of everything the server holds for the caller's own account. Session, with re-authentication. Limited to one export per account per 24 hours.
| Body field | Type | Required |
|---|---|---|
password |
string | for password accounts |
curl -X POST https://graphlife.example.com/v1/accounts/me/export \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H 'Content-Type: application/json' \
-d "{\"password\":\"$DERIVED\"}" \
-o account-export.zip
Response: 200 OK, Content-Type: application/zip, Content-Disposition: attachment; filename="account-export.zip".
| Archive entry | Contents |
|---|---|
manifest.json |
format (graphlife.export), version (1), generated_at, subject, the list of graphs, and notes. |
account.json |
Account id, email, creation time, status, organisation memberships, subscription record if any, linked SSO identities, linked principals. |
graphs/<graphId>.sqlite |
Each personal hosted graph as a SQLite database file. |
documents/<graphId>/<docId>-<name> |
Files attached to those graphs. |
audit.ndjson |
The account's audit trail, one JSON object per line. |
sealed/… |
End-to-end encrypted data exactly as stored; the server cannot decrypt it. |
Organisation graphs are not included; the organisation's owner exports those (section 11.3).
| Status | code |
When |
|---|---|---|
| 401 | unauthorized |
No valid session, or re-authentication failed. |
| 429 | rate_limited |
An export was already made in the last 24 hours. |
GET/v1/activity#
Lists the caller's own audit events, newest first. Session.
| Query parameter | Default | Meaning |
|---|---|---|
limit |
100 | 1 to 500. |
{
"activity": [
{ "event": "live_key_created", "actor": "session", "detail": null, "at": 1764201600, "keyId": "c7a1e0d4-52b9-4f0e-b1a2-6f3d9e8c4b77" },
{ "event": "login", "actor": "user", "detail": null, "at": 1764201500 }
]
}
keyId is present only on events written by or about an API key. There is no cursor: the route returns the most recent limit events only. Events record that something happened, never the content involved.
6.8 Password recovery#
There is no password-reset endpoint and the server does not send email. A forgotten password is reset by the operator of the deployment, at start-up:
- Set
RESET_PASSWORD_FORto the account's email address andRESET_PASSWORD_TOto the new password (at least 8 characters, as the person would type it). - Restart the server. It stores the new password in the derived form described in section 6.2 and logs a single line saying whether an account was updated. If
RESET_PASSWORD_TOis shorter than 8 characters, nothing is changed and nothing is logged. - Remove both variables and restart again.
The reset does not revoke the account's existing sessions, API keys or OAuth connections.
A related start-up diagnostic, DIAG_ACCOUNTS=1, writes one line per account (id, email, creation time, status, number of graphs) and one line per hosted graph to the server's standard error stream. It prints no secrets.
6.9 Related: listing graphs#
Key minting needs a graph id. GET /v1/graphs (Session) lists the caller's personal hosted graphs; add ?orgs=1 to also list the graphs of the organisations the caller belongs to, each with orgId, orgName and the caller's role. The graph routes themselves are described in graph data.
6.10 Related: /v1/keys/vault#
PUT /v1/keys/vault and GET /v1/keys/vault (Session) store and return an opaque, client-encrypted key blob used by the first-party apps for end-to-end encrypted sync. Despite the name, they are not API keys and an HTTP integration does not need them.