Customer accounts and orgs
Every team that uses Nod is a customer with an account, the way it would be on any hosted identity service. The account owns its realms and manages only them. Operator access is for running Nod itself, never for owning a realm. An account is also an org: people with roles who manage it with their own sign-in.
This isn't the same as organizations. Those are your customers' companies inside one of your realms. An account is you, the owner of realms.
Signing up yourself (self-serve, nodauth.com)
A developer signs up at the accounts realm (email codes; at nodauth.com, Sign up), and then, with their own token for the accounts API (the console's sign-in, or nod login), needs nobody at Lunaor:
| Call | Who | What it does |
|---|---|---|
POST /accounts/v1/orgs {"name"} | a person with a proved email address | 201 {"id", "name", "role": "owner", "plan"}: a team (an org) they own at once. At most 5 each (409 limit_reached); more by invitation |
POST /accounts/v1/orgs/{org}/realms {"name", "slug"?} | the org's owners and admins | 201 {"id", "display_name", "issuer", "created_ms"}: a tenant, a realm the org owns, id <slug>-<6 random> (the slug from slug or the name), email codes on. At most the plan's tenants (409 limit_reached) |
GET /accounts/v1/orgs/{org}/usage | any member | the plan, tenants {used, limit, can_add}, and mau {total, limit, over, complete, window_days, realms: [{id, mau}]}: monthly active users, the distinct people with a successful sign-in in the last 30 days |
Then they manage the tenant at its management API with the same token, by their org role (below): register an app (POST <tenant issuer>/api/v1/clients, deployers and up), see its users, add connections and APIs. Plans are in crates/server/plans.json (proposed prices, test mode); the operator sets an org's (nod account plan <org> pro), and Ducat's paid-plan webhook will once selling is on. Monthly active users are counted and shown, never used to refuse a sign-in.
Getting an account
The operator runs nod account invite --name "Acme" and hands you the one-use invite (valid a week). You redeem it yourself, so only you ever see the key:
curl -X POST https://auth.harpora.example/accounts/v1/accounts -H 'content-type: application/json' \
-d '{"invite":"hai_…"}'
# → {"account":{"id":"acct-…","name":"Acme"},"client_id":"acct-…","client_secret":"…","token_endpoint":…,"resource":…}
The client_id and client_secret are the account's key: a machine client of the accounts realm, for automation. Keep the secret like any other.
Realms
With the key's token (client_credentials, resource=<accounts issuer>/accounts):
| Call | What it does |
|---|---|
GET /accounts/v1/account (account:read) | {"id", "name", "created_ms", "realms": [{"id", "display_name", "issuer", "created_ms"}]} |
POST /accounts/v1/realms {"id","display_name"} (realms:write) | 201: a new realm the account owns (at most 20; 409 limit_reached past that), with its management credentials under credentials |
POST /accounts/v1/realms/{id}/credentials (realms:write) | 201 {"client_id", "client_secret", "token_endpoint", "resource", "scope"}: new management credentials for a realm it owns |
These three take the account's key only; an org's people use the orgs API below.
Management credentials are a machine client of that realm, granted its management API. So they manage that realm and nothing else. A realm the account doesn't own reads as no realm (404).
People and roles
An org's members are people of the accounts realm, matched by their verified email (email:ana@acme.example) or their id (sub:…). A verified email counts only when the person proved it (an emailed link or code, or a connection trusted for that domain), never when an administrator marked it verified: otherwise a realm's administrator could mark an owner's address on another account and hold the owner's role (see the nod guide's "Only addresses people proved count"). The same goes for auto-join and accepting an invitation. Each has one role:
| Role | In the org's realms' management APIs | In the org |
|---|---|---|
member | reads (every :read scope, and fga:check) | sees the org: members, realms, nod policy, delegations |
deployer | reads, and changes apps (clients:write) | grants delegations of deploy |
admin | everything but the realm's own settings (realm:admin) | grants delegations of access and spend |
owner | everything | changes members, the nod policy, delegations of any class but owners |
A person holding several memberships (by email and by id) has the highest. The account's key acts as an owner of its own org.
The orgs API
At <accounts issuer>/accounts/v1, called with the person's own token (below) or the account's key. A token with act (an agent's), a DPoP-bound token, or an approval is refused (401). An org you aren't in is 404, as if it didn't exist.
| Call | Who | Answer |
|---|---|---|
GET /orgs | anyone | {"orgs": [{"id", "name", "role"}], "invitations": [{"id", "name", "role"}]}: the orgs you're in, with your role, and those inviting you |
GET /orgs/{org} | a member | {"id", "name", "role", "members": [{"who", "role"}], "realms": [{"id", "display_name", "issuer", "created_ms"}], "nod_policy", "delegations": [...]} |
PUT /orgs/{org}/members/{who} {"role"} | an owner | {"id", "members"}; invites someone new (their entry has invited_ms) or changes a role. who is email:<address> or sub:<id>. An invited person holds no role, and the org sees nothing of theirs, until they accept |
POST /orgs/{org}/accept | the person invited | {"id", "name", "role"}: they accept, by their id or their address verified in the accounts realm; 404 when nothing waits for them |
DELETE /orgs/{org}/members/{who} | an owner | {"id", "members"} |
PUT /orgs/{org}/nod-policy {"policy"} | an owner | {"id", "nod_policy"}; anyone or roles (Nod) |
POST /orgs/{org}/delegations | the class's role | 201, the delegation (Nod) |
DELETE /orgs/{org}/delegations/{id} | its grantor or an owner | 204 |
GET /orgs/{org}/approvals?after=&limit= | a member | {"approvals": [...], "next"}: the org's nods approved, refused (outcome) and escalated, newest first, with who acted (by, by_name, policy, approved_in, approvals for two owners), whom it asked (asked) and the chain that asked (agent, platform, client) |
GET /orgs/{org}/signins | an owner or admin | {"today": {"succeeded", "failed"}, "yesterday": {…}, "realms", "partial"}: sign-ins in the realms the org owns, per UTC day, from their security logs (at most 2000 sign-in events read a realm; partial when there were more since yesterday began). The console's first screen shows them. |
GET /orgs/{org}/agents | a member | {"agents": [{"client_id", "name", "person", "username", "role", "mine", …}], "all"}: owners and admins see every member's agents, others their own |
POST /orgs/{org}/agents {"name"} | a person | 201, an agent of your own, its client_secret shown once (as POST <issuer>/agents) |
DELETE /orgs/{org}/agents/{id} | its person or an owner | 204 |
A role that isn't high enough is 403 insufficient_scope. Demoting or removing the last owner is refused (400).
The org always keeps at least one owner. Owners manage members:
curl -X PUT -H "authorization: Bearer $T" -H 'content-type: application/json' \
https://auth.harpora.example/accounts/v1/orgs/acct-…/members/email:ana@acme.example -d '{"role":"admin"}'
curl -X DELETE -H "authorization: Bearer $T" https://auth.harpora.example/accounts/v1/orgs/acct-…/members/email:ana@acme.example
Membership is read at each call, so taking someone out of the org ends their access at their next call.
An API of a realm can ask for the caller's org in its access tokens (nod_account, by the same membership rule): see APIs.
Domains
An owner claims the org's domains and proves each by DNS, as Clerk and WorkOS do:
POST /orgs/{org}/domains{"domain": "acme.example"}answers the TXT record to publish:_nod-challenge.acme.exampleholdingnod-verify=<token>(the same record again for a domain already claimed).- Publish it, then
POST /orgs/{org}/domains/acme.example/verify. Nod looks the record up at that moment: verified (loggedorg.domain_verified), or 409 saying what's missing. Leave the record in place; it's checked only then. - A domain is verified for one org at most: once it is, no other org can claim it until it's given up (
DELETE /orgs/{org}/domains/{domain}, logged; refused while it's the org's owner domain).
Auto-join: PUT /orgs/{org}/auto-join {"role": "member"} (or deployer, admin; "" turns it off; never owner, who is always added by name). Then anyone with a proved address at a verified domain holds that role without being added, read at each request; removing the domain or turning auto-join off ends it at once.
Owner domain: PUT /orgs/{org}/owner-domain {"domain": "acme.example"} (see the nod guide) needs the domain to be one of the org's verified domains: claim and verify it first, or it's refused (400, saying so). GET /orgs/{org} shows owner_domain_verified. An org that set its owner domain before this rule keeps it and keeps working; owner_domain_verified: false shows, and the org console's view_org adds a policy_flags entry so an owner verifies it. The operator's nod account owner-domain <org> <domain> is allowed without verification (to bootstrap an org), prints a warning and logs org.owner_domain in the org's realms as set without verification. A verified domain that is the owner domain can't be removed.
Log retention: PUT /orgs/{org}/log-retention {"days": 90} (owner only; 30, 90, 180 or 365, default 30; anything else is refused). It applies to the security log of every realm the org owns (nod account log-retention <org> 90, or the org console's tool org_log_retention_set; GET /orgs/{org} shows log_retention_days). Logged as org.log_retention. The hourly janitor prunes each realm by its owner org's setting, so a lower number takes effect at the next run, never at once.
Signing in as yourself
The org's people use their own token, never the account's key. From a terminal:
nod login --issuer https://auth.harpora.example --client <the accounts realm's CLI client>
# open the link it prints, sign in with your own account, approve
T=$(cat ~/.config/nod/console-token)
curl -H "authorization: Bearer $T" https://auth.harpora.example/accounts/v1/orgs # your orgs and your role
nod login runs the device flow (RFC 8628) against the issuer with resource=<issuer>/accounts (RFC 8707), so the token is the accounts API's. It needs no store and no secret: the client is a public client of the accounts realm with the device flow on. The token goes to ~/.config/nod/console-token (mode 600; --out for another file) and lives 15 minutes: run it again for a new one. Any device-flow client can do the same by posting resource to <issuer>/device_authorization.
The same token works at the management API of every realm your org owns (<that realm's issuer>/api/v1/…), as far as your role allows. The org console shows the same in a browser: /orgs, then an org's members, realms, nod policy and delegations, where owners add, change and remove members, set the nod policy, and grant and revoke delegations.
Operators can do the same from the server's command line: nod account member <acct> email:x admin, account rm-member <acct> email:x, account nod-policy <acct> anyone|roles, and account surface-classes <acct> spend,delete (which classes a platform's frame may approve: in-app nods).
Nods
An org also decides who may approve its agents' sensitive actions: anyone in it, or by role, with delegations and two owners for the most dangerous ones. See Nod: approvals for agents.