Your backend's calls
The routes under /internal/v1 your backend calls with the app's API key.
Your backend calls Otoko Identity under /internal/v1, at the Issuer, with the app's API key as a bearer token in the Authorization header. A call only ever reaches people of the app the key belongs to. A server of yours with no backend role, such as a script that invites people, calls the same way.
Every route
| Call | What it does |
|---|---|
GET / | Find a person of the app by email. |
POST / | Make an account. |
GET / | Read one. |
DELETE / | Delete one. |
PUT / | Turn one on or off. |
PUT / | Set their language. |
PUT / | Set their password. |
PUT / | Replace their roles, when the backend owns the app's roles. |
PUT / | Replace the roles of many people at once. |
PUT / | Replace their required actions. |
DELETE / | Mark one done. |
POST / | Swap a required action's code for who it's for. |
POST / | Sign them out everywhere. |
POST / | Email them a one-time code. |
POST / | Check a code. A right one verifies the email. |
POST / | Count a wrong code for an address the app has nobody with, so it reaches the same limit as a real one. |
POST / | Email them a set-password link. |
GET / | Whether a code or set-password email went. |
POST / | Sign in with a password. See Sessions. |
POST / | Check a password without signing in. |
POST / | A challenge for any passkey of this site. |
POST / | Check a passkey's answer, and sign in. |
POST / | Swap a refresh token for a new pair. |
POST / | End the session behind a refresh token. |
GET / | A person's own passkeys, with their access token in X-Access-Token. |
POST / | Email a code for them to prove it's them. |
POST / | Prove it's them, and get a challenge to make a passkey with. |
POST / | Add the passkey their device just made. |
GET, PUT, DELETE / | Read, rename or remove one of their passkeys. |
POST / | Invite someone. See Invitations. |
GET / | Read an invitation. |
POST / | Send it again. |
DELETE / | Revoke it. |
Note
Older names still answer, and are deprecated: sessions/refresh, sessions/logout, sessions/check-password, sessions/passkey/start and sessions/passkey/finish, identities/{id}/end-sessions and identities/{id}/code/verify. Use the names above.
Identities
An identity is one person in one app: the same email in two apps is two accounts. Key your own user on its sub, the identity's id, never on the email. A backend that makes accounts itself, such as its own sign-up or its sso-accounts route, uses POST /internal/v1/identities.
Sessions
How a backend signs people in and out with no browser pages, as a mobile app does.
- Your backend signs a person in with their password at
POST /internal/v1/sessions/password. Each sign-in still asks your sign-in check, then your required actions, and then gives tokens and a refresh token. - With a passkey,
POST /internal/v1/sessions/passkey-challengesgives WebAuthn's options and achallenge_token, which works once, for five minutes. The device's answer goes toPOST /internal/v1/sessions/passkey-assertionswith that value, and signs in the same way as a password. Whatever was wrong with the passkey or the value, the answer is the same 401invalid_credentials. - Your backend signs a person out at
POST /internal/v1/sessions/sign-outs, which ends their session.
Invitations
Invite someone from the app's Users & roles tab, or from your backend with the API key. Who runs invitations is the app's account flows.
| Call | What it does |
|---|---|
POST / | Emails an invitation to email, with optional roles, a context_name saying what it is to within the app, and a dispatch_id. Answers 201. |
GET / | Reads it: pending, accepted, revoked or expired. |
POST / | Sends it again, with an optional dispatch_id. |
DELETE / | Revokes it. Answers 204. |
- An invitation takes the email only. The person types their own first name, last name and password when they accept, and a body that sends
first_nameorlast_nameanswers 422. - The link's token starts
oiv_. A second invitation to the same address replaces the open one, and an address with an account in the app answers 409. rolesonly from whoever owns the app's roles: your backend when it owns them, the Users & roles tab when the console does. Otherwise it answers 409roles_owned_by_adminorroles_owned_by_backend, so an app with no backend gives roles from the console.- Send an
Idempotency-Keyon a create, a random UUID reused on a retry, and the retry gets the first 201 and sends nothing more. - An app with an open invitation can't be deleted: revoke it first.