Keystone Developers
Open Keystone
API reference

Auth internal API

Users

11 endpoints.

GET/api/v1/internal/users

List Users

Authentication

X-Internal-Api-Key header.

Parameters

NameInTypeDescription
role_idrequiredqueryinteger

Filter by Heimdal role_id

exclude_guestsqueryboolean

Leave out guests (an email on GUEST_EMAIL_DOMAIN)

default false
limitqueryintegerdefault 100
offsetqueryintegerdefault 0

Responses

200Successful Response
application/jsonInternalUserListResponse
FieldTypeDescription
usersrequiredInternalUserRecord[]
InternalUserRecord[] fields
FieldTypeDescription
user_idrequiredstring (uuid)
emailrequiredstring (email)
first_namestring | null
last_namestring | null
phonestring | null
role_idrequiredinteger
is_activerequiredboolean
email_verifiedrequiredboolean
created_atrequiredstring (date-time)
updated_atrequiredstring (date-time)
pending_emailstring | null
pending_phonestring | null
  • 4XXRefused: `code` says why
  • 5XXFailed: `code` says why

Error bodies: ErrorBody. See Errors.

PATCH/api/v1/internal/users/{user_id}

Update User

sor's update of an account. A new email or phone is held as ``pending_email`` / ``pending_phone`` and sent a code (``contact/confirm`` takes it). ``invite_accept`` leaves email and phone alone.

Authentication

X-Internal-Api-Key header.

Parameters

NameInTypeDescription
user_idrequiredpathstring (uuid)

Request bodyrequired

application/jsonInternalUserUpdateRequest
FieldTypeDescription
first_namestring | null
last_namestring | null
phonestring | null
emailstring (email) | null
role_idinteger | null
is_activeboolean | null
invite_acceptbooleandefault false

Responses

200Successful Response
application/jsonInternalUserRecord

InternalUserRecord, expanded above.

  • 4XXRefused: `code` says why
  • 5XXFailed: `code` says why

Error bodies: ErrorBody. See Errors.

POST/api/v1/internal/users/{user_id}/contact/code

Send Contact Code

Send again the code to the account's pending email or phone. 404 NO_PENDING_CHANGE when none waits; 429 ``cooldown_active`` with ``retry_in_seconds`` too soon or past the account's (or ``client_ip``'s) hourly limit.

Authentication

X-Internal-Api-Key header.

Parameters

NameInTypeDescription
user_idrequiredpathstring (uuid)

Request bodyrequired

application/jsonInternalContactCodeRequest
FieldTypeDescription
channelrequiredenumone of "email", "phone"
client_ipstring | null

Responses

200Successful Response
application/jsonInternalCodeSentResponse
FieldTypeDescription
resend_in_secondsrequiredinteger
  • 4XXRefused: `code` says why
  • 5XXFailed: `code` says why

Error bodies: ErrorBody. See Errors.

POST/api/v1/internal/users/{user_id}/contact/confirm

Confirm Contact

The code the pending email or phone received, entered where sor took it (the person, or the admin who changed it, told it by them): the address becomes the account's and signs in from now on. 400 INVALID_OTP, 404 NO_PENDING_CHANGE, 409 taken meanwhile, 429 TOO_MANY_CODE_ATTEMPTS.

Authentication

X-Internal-Api-Key header.

Parameters

NameInTypeDescription
user_idrequiredpathstring (uuid)

Request bodyrequired

application/jsonInternalContactConfirmRequest
FieldTypeDescription
channelrequiredenumone of "email", "phone"
coderequiredstringmin length 1 · max length 12

Responses

200Successful Response
application/jsonInternalUserRecord

InternalUserRecord, expanded above.

  • 4XXRefused: `code` says why
  • 5XXFailed: `code` says why

Error bodies: ErrorBody. See Errors.

DELETE/api/v1/internal/users/{user_id}/guest

Delete Guest

Delete a guest whose business went to the account it signed in to, with its sessions and codes. Any other account is a 404.

Authentication

X-Internal-Api-Key header.

Parameters

NameInTypeDescription
user_idrequiredpathstring (uuid)

Responses

204Successful Response
  • 4XXRefused: `code` says why
  • 5XXFailed: `code` says why

Error bodies: ErrorBody. See Errors.

POST/api/v1/internal/users/{user_id}/guest-claim/code

Send Guest Claim Code

Email the person behind a guest a code: one to make the guest theirs, or to sign in to the account that has the email already (`existing`). 409 when the email is another guest's; 429 ``cooldown_active`` past the guest's hourly limit, or the visitor's (``client_ip``, when sor gives it).

Authentication

X-Internal-Api-Key header.

Parameters

NameInTypeDescription
user_idrequiredpathstring (uuid)

Request bodyrequired

application/jsonInternalGuestClaimCodeSendRequest
FieldTypeDescription
emailrequiredstring (email)
client_ipstring | null

Responses

200Successful Response
application/jsonInternalGuestClaimCodeResponse
FieldTypeDescription
existingrequiredboolean
  • 4XXRefused: `code` says why
  • 5XXFailed: `code` says why

Error bodies: ErrorBody. See Errors.

POST/api/v1/internal/users/{user_id}/guest-claim/verify

Verify Guest Claim

The guest's code is right: the account is theirs now, and signed in afresh; or, the code was the sign-in code of the account that has the email, that account (`user`, not the guest) signed in. 400 INVALID_OTP otherwise.

Authentication

X-Internal-Api-Key header.

Parameters

NameInTypeDescription
user_idrequiredpathstring (uuid)

Request bodyrequired

application/jsonInternalGuestClaimVerifyRequest
FieldTypeDescription
emailrequiredstring (email)
coderequiredstringmax length 12

Responses

200Successful Response
application/jsonInternalGuestClaimVerifyResponse
FieldTypeDescription
userrequiredInternalUserRecord
InternalUserRecord fields

InternalUserRecord, expanded above.

access_tokenrequiredstring
refresh_tokenrequiredstring
token_typerequiredstring
  • 4XXRefused: `code` says why
  • 5XXFailed: `code` says why

Error bodies: ErrorBody. See Errors.

POST/api/v1/internal/users/{user_id}/guest-session

Issue Guest Session

A session for a guest (the account opened for a business no one has signed up for yet). Any other account is a 404: the internal key never signs in a person.

Authentication

X-Internal-Api-Key header.

Parameters

NameInTypeDescription
user_idrequiredpathstring (uuid)

Responses

200Successful Response
application/jsonInternalGuestSessionResponse
FieldTypeDescription
access_tokenrequiredstring
refresh_tokenrequiredstring
token_typerequiredstring
  • 4XXRefused: `code` says why
  • 5XXFailed: `code` says why

Error bodies: ErrorBody. See Errors.

PUT/api/v1/internal/users/{user_id}/password

Set Password

Give the account a password to sign in with, beside its codes.

Authentication

X-Internal-Api-Key header.

Parameters

NameInTypeDescription
user_idrequiredpathstring (uuid)

Request bodyrequired

application/jsonInternalPasswordRequest
FieldTypeDescription
passwordrequiredstringmax length 200

Responses

204Successful Response
  • 4XXRefused: `code` says why
  • 5XXFailed: `code` says why

Error bodies: ErrorBody. See Errors.

POST/api/v1/internal/users/lookup

Lookup Users

Authentication

X-Internal-Api-Key header.

Request bodyrequired

application/jsonInternalUserLookupRequest
FieldTypeDescription
user_idsstring (uuid)[]default []
string (uuid)[] fields
emailsstring (email)[]default []
string (email)[] fields

Responses

200Successful Response
application/jsonInternalUserLookupResponse
FieldTypeDescription
usersrequiredInternalUserRecord[]
InternalUserRecord[] fields

InternalUserRecord, expanded above.

  • 4XXRefused: `code` says why
  • 5XXFailed: `code` says why

Error bodies: ErrorBody. See Errors.

POST/api/v1/internal/users/provision

Provision User

Authentication

X-Internal-Api-Key header.

Request bodyrequired

application/jsonInternalProvisionUserRequest
FieldTypeDescription
emailrequiredstring (email)
first_namerequiredstring
last_namerequiredstring
phonestring | null
role_idintegerdefault 400
send_password_resetbooleandefault true

Responses

200User updated successfully
application/jsonInternalProvisionUserResponse
FieldTypeDescription
user_idrequiredstring (uuid)
emailrequiredstring (email)
first_namestring | null
last_namestring | null
phonestring | null
role_idrequiredinteger
createdrequiredboolean
password_reset_sentrequiredboolean
201Successful Response
application/jsonInternalProvisionUserResponse

InternalProvisionUserResponse, expanded above.

  • 4XXRefused: `code` says why
  • 5XXFailed: `code` says why

Error bodies: ErrorBody. See Errors.