Keystone Developers
Open Keystone
API reference

Auth API

Users

9 endpoints.

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

Update User Role

Update another user's role. Restricted to Admin User.

Authentication

Authorization: Bearer <token>.

Parameters

NameInTypeDescription
user_idrequiredpathstring (uuid)

Request bodyrequired

application/jsonUserRoleUpdate
FieldTypeDescription
role_idrequiredinteger

Responses

200Successful Response
application/jsonUserResponse
FieldTypeDescription
emailrequiredstring (email)
first_namestring | null
last_namestring | null
is_activeboolean | nulldefault true
idrequiredstring (uuid)
role_idrequiredinteger
created_atrequiredstring (date-time)
updated_atrequiredstring (date-time)
phonestring | null
phone_verified_atstring (date-time) | null
pending_emailstring | null
pending_phonestring | null
avatar_urlstring | null
  • 4XXRefused: `code` says why
  • 5XXFailed: `code` says why

Error bodies: ErrorBody. See Errors.

GET/api/v1/users/current_user

Read Current User

Get current user.

Authentication

Authorization: Bearer <token>.

Responses

200Successful Response
application/jsonUserResponse

UserResponse, expanded above.

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

Error bodies: ErrorBody. See Errors.

PUT/api/v1/users/current_user

Update Current User

Update own profile. With sign-in by code on, a new email is held as ``pending_email`` and sent a code (``/current_user/email/confirm`` takes it); the current one stands until then.

Authentication

Authorization: Bearer <token>.

Request bodyrequired

application/jsonUserUpdate
FieldTypeDescription
first_namestring | null
last_namestring | null
emailstring (email) | null
phonestring | null
passwordstring | null
old_passwordstring | null

Responses

200Successful Response
application/jsonUserResponse

UserResponse, expanded above.

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

Error bodies: ErrorBody. See Errors.

POST/api/v1/users/current_user/avatar

Upload Current User Avatar

Upload own profile avatar (multipart/form-data).

Authentication

Authorization: Bearer <token>.

Request bodyrequired

multipart/form-dataBody_upload_current_user_avatar_api_v1_users_current_user_avatar_post
FieldTypeDescription
filerequiredstring (binary)

Responses

200Successful Response
application/jsonUserResponse

UserResponse, expanded above.

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

Error bodies: ErrorBody. See Errors.

DELETE/api/v1/users/current_user/avatar

Delete Current User Avatar

Remove own profile avatar.

Authentication

Authorization: Bearer <token>.

Responses

200Successful Response
application/jsonUserResponse

UserResponse, expanded above.

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

Error bodies: ErrorBody. See Errors.

POST/api/v1/users/current_user/email/code

Send Current User Email Code

Take a new email: it is held as ``pending_email`` and sent a code; the current email stands until the code is confirmed. Sent again when asked again. 409 when another account has it; 429 ``cooldown_active`` with ``retry_in_seconds`` too soon, or past the user's or the IP's hourly limit.

Authentication

Authorization: Bearer <token>.

Request bodyrequired

application/jsonEmailCodeRequest
FieldTypeDescription
emailrequiredstring (email)

Responses

200Successful Response
application/jsonCodeSent
FieldTypeDescription
messagestringdefault "ok"
resend_in_secondsrequiredinteger
  • 4XXRefused: `code` says why
  • 5XXFailed: `code` says why

Error bodies: ErrorBody. See Errors.

POST/api/v1/users/current_user/email/confirm

Confirm Current User Email

The pending email's code is right: it is the account's email from now on. 400 INVALID_OTP otherwise; 404 NO_PENDING_CHANGE when no email waits.

Authentication

Authorization: Bearer <token>.

Request bodyrequired

application/jsonCodeConfirmRequest
FieldTypeDescription
coderequiredstringmin length 1 · max length 12

Responses

200Successful Response
application/jsonUserResponse

UserResponse, expanded above.

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

Error bodies: ErrorBody. See Errors.

POST/api/v1/users/current_user/phone/code

Send Current User Phone Code

Text a code to the phone to add or confirm as one's own. 409 when another account has proven it; 429 ``cooldown_active`` with ``retry_in_seconds`` too soon after the last, or past the user's or the IP's hourly limit.

Authentication

Authorization: Bearer <token>.

Request bodyrequired

application/jsonPhoneCodeRequest
FieldTypeDescription
phonerequiredstringmin length 1 · max length 32

Responses

200Successful Response
application/jsonCodeSent

CodeSent, expanded above.

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

Error bodies: ErrorBody. See Errors.

POST/api/v1/users/current_user/phone/confirm

Confirm Current User Phone

The phone's code is right: the phone is one's own, to sign in with. 400 INVALID_OTP otherwise.

Authentication

Authorization: Bearer <token>.

Request bodyrequired

application/jsonPhoneConfirmRequest
FieldTypeDescription
phonerequiredstringmin length 1 · max length 32
coderequiredstringmin length 1 · max length 12

Responses

200Successful Response
application/jsonUserResponse

UserResponse, expanded above.

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

Error bodies: ErrorBody. See Errors.