Users, roles and access log¶
TL;DR
/usersis for operators (roleadmin) signed in with the session cookie: an API token is 401, anyone else 403forbidden. There is no self-signup route.- Library roles are
viewer < contributor < admin < creator, granted to users and groups; an operator iscreatorof every library. /libraries/{owner}/{repo}/grantsand/transfermanage who holds a role.- Every creation, grant, revocation, transfer and removal of a library goes to the access log.
Endpoints¶
| Method | Path | Purpose | Caller |
|---|---|---|---|
GET |
/users |
list accounts | operator, session cookie |
POST |
/users |
create an account | operator, session cookie |
POST |
/users/{id}/disable |
lock an account out | operator, session cookie |
POST |
/users/{id}/enable |
let it sign in again | operator, session cookie |
PUT |
/users/{id}/password |
set a new password | operator, session cookie |
GET |
/users/tokens |
every account's API tokens | operator, session cookie |
GET |
/libraries/{owner}/{repo}/grants |
who holds a role | admin on the library |
PUT |
/libraries/{owner}/{repo}/grants |
give or replace a role | admin on the library1 |
DELETE |
/libraries/{owner}/{repo}/grants/{kind}/{subject} |
take a role away | admin on the library1 |
POST |
/libraries/{owner}/{repo}/transfer |
hand the library over | creator or operator |
GET |
/libraries/{owner}/{repo}/access-log |
a library's access log | admin on the library |
GET |
/access-log |
every library's access log | operator, session cookie |
Users¶
Users (ACL-06) are the local accounts, managed by an operator: an account with role admin. The
first admin is one.
There is no self-signup route. An account is made by:
- the setup (the first admin only)
exactdocs user create- a first sign-in through an identity provider
POST /users
Operator session only
Every /users route needs the session cookie of an operator. An API token is 401 (a stolen
token cannot create accounts), and a signed-in account that is not an admin gets 403
forbidden. Library roles are separate: see Library roles.
GET /users¶
Lists a page of the accounts, oldest first.
| Field | Meaning |
|---|---|
id, username, role, created_at, disabled |
the account |
provider |
null for a local account |
groups |
the provider's, as of the latest sign-in or revalidation |
last_active_at |
the hour of the latest activity, see below |
token_count |
API tokens that have not expired |
| Parameter | Meaning |
|---|---|
q |
text |
role, disabled |
filters |
provider |
repeat for several; password for a local account,else the provider the account was created through |
sort |
created_at, username, role, last_active_at or token_count |
- No identity provider may be named
password. last_active_atis the hour (UTC, minutes always zero: kept to the hour on purpose) of the account's latest activity,nulluntil there is any. Activity is:- a sign-in (a password, an identity provider)
- a request authenticated as the account: its session cookie, an API token, a provider's ID token over MCP, Cloudflare Access
- It is written at most once per hour per account, by the request that was reading the account anyway, best effort (a failed write is logged and the request goes on). Activity before the upgrade is not known.
token_countis counted in one query for the whole list.
GET /users/tokens¶
Lists every account's API tokens for an operator to tidy up.
- The fields of
GET /tokensplusowner_idandowner(the username), never the secret or its hash. - Expired tokens not yet purged are included.
- Newest first.
- Filters:
q(the token's name),owner_id,expiredandunused(trueorfalse). sortby the token fields orowner.cursororoffsetlike every list.

POST /users¶
Body {"username", "password", "role"?}; role user (default) or admin. Answers 201 with the
account.
- A taken name (compared case-insensitively) is 409
username_taken. - A name holding
@address:(the sign-in throttle's own key separator) is 422invalid_username.
Disable, enable and reset¶
| Route | Effect |
|---|---|
POST /users/{id}/disable |
locks the account out at once: sessions deleted, API tokens revoked |
POST /users/{id}/enable |
lets it sign in again with its password; revoked tokens stay revoked |
PUT /users/{id}/password |
{"password"}: new password, every session ended,tokens revoked, throttle cleared |
- A disabled account's sign-in gets the same 401
invalid_credentialsas a wrong password. A session or token that slipped through is refused on use. - Disabling the last enabled admin is 409
last_operator. PUT /users/{id}/passwordclears the username's sign-in throttle count and remembered addresses, likeexactdocs admin reset-password.- It answers
{"account", "throttle"}, wherethrottleiscleared,busyorfailed. The password changed in every case. - An account of an identity provider has no password: 409
external_account.
- It answers
- An unknown id is 404
unknown_account.
Library roles¶
Library roles (ACL-02) are viewer < contributor < admin < creator on each library, granted to
users and to groups.
- An account's role is the highest it holds.
- An operator (role
admin) iscreatorof every library. - The one who adds a library is its creator.
Every library route asks for one role:
| Role | Adds |
|---|---|
viewer |
reads and searches: GETs, search, outline, jobs, the schedule |
contributor |
imports: POST .../versions, .../versions/reimport,.../sync, PUT .../tags |
admin |
configures: PATCH and PUT .../settings, .../default-version,.../retrieval, .../auto-sync; removes versions |
creator |
deletes the library |
- Below the role the answer is 403
forbidden, the same over MCP (a tool errorforbidden: ...). GET /libraries, the searches across libraries andresolve-library-idlist only libraries the caller holds a role on.
Grants¶
GET /libraries/{owner}/{repo}/grants lists a page of who holds a role: users by username, then
groups. Filters q, kind, role, sort.
Response
{
"grants": [{"kind", "subject", "role"}],
"next_cursor", "total",
"caller_role", // the caller's own role, admin or creator
"creator" // the creator's username whatever the filters, null when there is none
}
PUTwith{"kind": "user"|"group", "subject", "role": "viewer"|"contributor"|"admin"}gives or replaces a role and answers the grants.DELETE /libraries/{owner}/{repo}/grants/{user|group}/{subject}takes one away.- All three need
adminon the library, andcreatorto give, change or remove anadmin. - The creator's own role is never changed there (422
invalid_grant).
Transfer¶
POST /libraries/{owner}/{repo}/transfer with {"username"} hands the library over. It answers
the grants.
- That user becomes its creator, and the creator before stays an
admin. - Only the
creator(or an operator) may. - The user who is already the creator is a 422
invalid_grant.
Notes¶
- The web UI's Sharing page of a library (
/libraries/{owner}/{repo}/sharing) uses these routes. - Group names are matched exactly (letter case included) against the groups the identity provider reports.
- A username nobody has is 404
unknown_account, a missing grant 404unknown_grant. - Libraries that existed before roles have no creator: operators manage them and share them.
Access log¶
The access log (ACL-05) records every creation, grant (a new role, or another one than before), revocation, ownership transfer and removal of a library, with who made it and when.
| Route | Reads | Caller |
|---|---|---|
GET /libraries/{owner}/{repo}/access-log |
a library's log, newest first | admin on the library |
GET /access-log |
every library's log, removed ones included; also filters with library |
operator session cookie2 |
On a library's log, operators see every event recorded under the library's ID; anyone else only those since it was last removed.
Response
{
"events": [{"id", "library", "at", "actor", "change", "kind",
"subject", "role", "previous_role"}],
"next_cursor", "total"
}
changeislibrary_created,granted,revoked,ownership_transferredorlibrary_deleted.actoris a username, null when the instance made the change.roleis the role given, or taken away forrevoked.
Sorting and filters¶
Both logs (#514) take sort: at, library or change, - for descending. The default is
-at, newest first. Ties go by the order the events were recorded in, in the same direction.
These filters compose with each other and with offset and the cursor:
| Filter | Keeps |
|---|---|
change (repeated) |
only those changes |
actor |
changes made by that person, see below |
subject |
changes about that user or group, see below |
at_after / at_before |
events at or after / before that time |
actornames a person as the log shows them: a username (any case), or the account ID the log shows for an account that no longer exists. Changes the instance made (actornull) never match.subjectnames a user or group as the log shows them: a username (any case), the account ID of an account that no longer exists, or a group name (exact case,group_prefixincluded).- A user and a group with the same name both match (
kindtells them apart). - A
library_deletedevent is about nobody and never matches.
- A user and a group with the same name both match (
at_afterandat_beforeare ISO 8601; no offset means UTC. The last 7 days areat_after=<now − 7 days>.
Cursors and sort
A cursor is made for one sort: sending it with another is a 422 invalid_cursor. Cursors
from before this change, which held the event ID alone, are refused the same way; start again
from the first page. An unknown sort field is a 422 invalid_sort.
What gets recorded¶
- A transfer records:
- one
grantedentry per creator before (nowadmin,previous_rolecreator) - then one
ownership_transferredentry whose subject is the new creator (rolecreator,previous_rolethe role they held, if any), with the caller as actor
- one
- Giving someone the role they already hold records nothing.
- Changes made before the upgrade that added the log are not in it.