Skip to Content
Otoko Identity

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

CallWhat it does
GET /internal/v1/identities?email=Find a person of the app by email.
POST /internal/v1/identitiesMake an account.
GET /internal/v1/identities/{id}Read one.
DELETE /internal/v1/identities/{id}Delete one.
PUT /internal/v1/identities/{id}/enabledTurn one on or off.
PUT /internal/v1/identities/{id}/languageSet their language.
PUT /internal/v1/identities/{id}/passwordSet their password.
PUT /internal/v1/identities/{id}/rolesReplace their roles, when the backend owns the app's roles.
PUT /internal/v1/identities/rolesReplace the roles of many people at once.
PUT /internal/v1/identities/{id}/required-actionsReplace their required actions.
DELETE /internal/v1/identities/{id}/required-actions/{action}Mark one done.
POST /internal/v1/action-codes/redemptionSwap a required action's code for who it's for.
POST /internal/v1/identities/{id}/session-endsSign them out everywhere.
POST /internal/v1/identities/{id}/codeEmail them a one-time code.
POST /internal/v1/identities/{id}/code-checksCheck a code. A right one verifies the email.
POST /internal/v1/unknown-addresses/code-failuresCount a wrong code for an address the app has nobody with, so it reaches the same limit as a real one.
POST /internal/v1/identities/{id}/password-emailEmail them a set-password link.
GET /internal/v1/emails/{email_id}Whether a code or set-password email went.
POST /internal/v1/sessions/passwordSign in with a password. See Sessions.
POST /internal/v1/sessions/password-checksCheck a password without signing in.
POST /internal/v1/sessions/passkey-challengesA challenge for any passkey of this site.
POST /internal/v1/sessions/passkey-assertionsCheck a passkey's answer, and sign in.
POST /internal/v1/sessions/refreshesSwap a refresh token for a new pair.
POST /internal/v1/sessions/sign-outsEnd the session behind a refresh token.
GET /internal/v1/passkeysA person's own passkeys, with their access token in X-Access-Token.
POST /internal/v1/passkeys/registration/codeEmail a code for them to prove it's them.
POST /internal/v1/passkeys/registrationProve it's them, and get a challenge to make a passkey with.
POST /internal/v1/passkeysAdd the passkey their device just made.
GET, PUT, DELETE /internal/v1/passkeys/{id}Read, rename or remove one of their passkeys.
POST /internal/v1/invitationsInvite someone. See Invitations.
GET /internal/v1/invitations/{id}Read an invitation.
POST /internal/v1/invitations/{id}/emailsSend it again.
DELETE /internal/v1/invitations/{id}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-challenges gives WebAuthn's options and a challenge_token, which works once, for five minutes. The device's answer goes to POST /internal/v1/sessions/passkey-assertions with 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 401 invalid_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.

CallWhat it does
POST /internal/v1/invitationsEmails 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 /internal/v1/invitations/{id}Reads it: pending, accepted, revoked or expired.
POST /internal/v1/invitations/{id}/emailsSends it again, with an optional dispatch_id.
DELETE /internal/v1/invitations/{id}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_name or last_name answers 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.
  • roles only from whoever owns the app's roles: your backend when it owns them, the Users & roles tab when the console does. Otherwise it answers 409 roles_owned_by_admin or roles_owned_by_backend, so an app with no backend gives roles from the console.
  • Send an Idempotency-Key on 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.