Keystone Developers
Open Keystone
API reference

Auth API

Sign in

13 endpoints.

POST/api/v1/auth/code

Send Sign In Code

Send a code to sign in with, by email or to an account's proven phone, and when another may be asked for. The same answer whether or not an account has it; a phone's send that failed is refused, and one too soon (for the destination, or past the requesting IP's hourly limit) is 429 ``cooldown_active`` with ``retry_in_seconds``.

Authentication

X-Recaptcha-Token header.

Parameters

NameInTypeDescription
X-Recaptcha-Key-Typeheaderstring | null

Request bodyrequired

application/jsonSignInCodeRequest
FieldTypeDescription
emailstring (email) | null
phonestring | null

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/auth/code/verify

Sign In With Code

Sign in by the code sent to an email or an account's phone, which proves the phone. 400 INVALID_OTP otherwise.

Authentication

X-Recaptcha-Token header.

Parameters

NameInTypeDescription
X-Recaptcha-Key-Typeheaderstring | null

Request bodyrequired

application/jsonSignInWithCodeRequest
FieldTypeDescription
emailstring (email) | null
phonestring | null
coderequiredstring

Responses

200Successful Response
application/jsonToken

Token, expanded above.

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

Error bodies: ErrorBody. See Errors.

POST/api/v1/auth/forgot-password

Forgot Password

Authentication

X-Recaptcha-Token header.

Parameters

NameInTypeDescription
X-Recaptcha-Key-Typeheaderstring | null

Request bodyrequired

application/jsonForgotPasswordRequest
FieldTypeDescription
emailrequiredstring (email)

Responses

200Successful Response
application/jsonany
  • 4XXRefused: `code` says why
  • 5XXFailed: `code` says why

Error bodies: ErrorBody. See Errors.

POST/api/v1/auth/login

Login

OAuth2 compatible token login, get an access token for future requests.

Authentication

X-Recaptcha-Token header.

Parameters

NameInTypeDescription
X-Recaptcha-Key-Typeheaderstring | null

Request bodyrequired

application/x-www-form-urlencodedBody_login_api_v1_auth_login_post
FieldTypeDescription
grant_typestring | null
usernamerequiredstring
passwordrequiredstring (password)
scopestringdefault ""
client_idstring | null
client_secretstring | null

Responses

200Successful Response
application/jsonToken

Token, expanded above.

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

Error bodies: ErrorBody. See Errors.

POST/api/v1/auth/logout

Logout

Authentication

Authorization: Bearer <token>.

Request bodyrequired

application/jsonLogoutRequest
FieldTypeDescription
refresh_tokenrequiredstring

Responses

200Successful Response
application/jsonany
  • 4XXRefused: `code` says why
  • 5XXFailed: `code` says why

Error bodies: ErrorBody. See Errors.

POST/api/v1/auth/refresh

Refresh Token

Rotate refresh token.

Authentication

No credential.

Request bodyrequired

application/jsonRefreshTokenRequest
FieldTypeDescription
refresh_tokenrequiredstring

Responses

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

Error bodies: ErrorBody. See Errors.

POST/api/v1/auth/resend-verification

Resend Verification

Authentication

X-Recaptcha-Token header.

Parameters

NameInTypeDescription
X-Recaptcha-Key-Typeheaderstring | null

Request bodyrequired

application/jsonResendVerificationRequest
FieldTypeDescription
emailrequiredstring

Responses

200Successful Response
application/jsonany
  • 4XXRefused: `code` says why
  • 5XXFailed: `code` says why

Error bodies: ErrorBody. See Errors.

POST/api/v1/auth/reset-password

Reset Password

Authentication

X-Recaptcha-Token header.

Parameters

NameInTypeDescription
X-Recaptcha-Key-Typeheaderstring | null

Request bodyrequired

application/jsonResetPasswordRequest
FieldTypeDescription
tokenstring | null
emailstring (email) | null
otpstring | null
new_passwordrequiredstring

Responses

200Successful Response
application/jsonany
  • 4XXRefused: `code` says why
  • 5XXFailed: `code` says why

Error bodies: ErrorBody. See Errors.

POST/api/v1/auth/signup

Create User

Create a new user (201) from the email alone; an email that already has an account, verified or not, is 400.

Authentication

X-Recaptcha-Token header.

Parameters

NameInTypeDescription
X-Recaptcha-Key-Typeheaderstring | null

Request bodyrequired

application/jsonUserCreate
FieldTypeDescription
emailrequiredstring (email)
first_namestring | null
last_namestring | null
is_activeboolean | nulldefault true
passwordstring | null
invite_idstring | null

Responses

201Successful 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.

POST/api/v1/auth/social

Social Login

Social Login (Google). Verifies ID Token, finds/creates user, issues JWTs.

Authentication

No credential.

Request bodyrequired

application/jsonSocialLoginRequest
FieldTypeDescription
providerrequiredstring
tokenrequiredstring

Responses

200Successful Response
application/jsonToken

Token, expanded above.

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

Error bodies: ErrorBody. See Errors.

POST/api/v1/auth/token/exchange

Exchange Token

A copy of the caller's own access token bound to one service (``aud``), which that service alone accepts: this service and sor refuse it. It lives at most 15 minutes and never past the token presented, and carries the person's name and avatar as they stand now (``name``: first and last name, else email; ``avatar_url`` only when they have one). 400 UNSUPPORTED_AUDIENCE for any service but ``workflow-engine``; 401 for a missing, expired or invalid token, a bound copy included.

Authentication

Authorization: Bearer <token>.

Request bodyrequired

application/jsonTokenExchangeRequest
FieldTypeDescription
audiencerequiredstring

Responses

200Successful Response
application/jsonBoundAccessToken
FieldTypeDescription
access_tokenrequiredstring
expires_inrequiredinteger
  • 4XXRefused: `code` says why
  • 5XXFailed: `code` says why

Error bodies: ErrorBody. See Errors.

GET/api/v1/auth/verify-email

Verify Email Token

Authentication

No credential.

Parameters

NameInTypeDescription
tokenrequiredquerystring

Responses

200Successful Response
application/jsonany
  • 4XXRefused: `code` says why
  • 5XXFailed: `code` says why

Error bodies: ErrorBody. See Errors.

POST/api/v1/auth/verify-email

Verify Email Otp

Verify by the emailed six-digit code and sign the user in. 409 ALREADY_VERIFIED for a verified account, 401 ACCOUNT_INACTIVE for an inactive one, 400 INVALID_OTP otherwise.

Authentication

X-Recaptcha-Token header.

Parameters

NameInTypeDescription
X-Recaptcha-Key-Typeheaderstring | null

Request bodyrequired

application/jsonVerifyEmailOtpRequest
FieldTypeDescription
emailrequiredstring (email)
otprequiredstring

Responses

200Successful Response
application/jsonToken

Token, expanded above.

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

Error bodies: ErrorBody. See Errors.