User

A user is the entity used for authentication.

Request email verification

Used to request a verification email. Should only be used if the user missed the email sent after registration.

POST /users/me/request-email-verification

Response and request are both empty

HTTP Response codeJSON data
200 OKSuccess, empty body
Error codesDescription
invalid_requestEmail already verified

Update password

Example request for PATCH /users/me

{
  "oldPassword": "myoldpassword1337",
  "newPassword": "mynewpassword1337"
}

Example response for PATCH /users/me

{
  "id": 1234,
  "email": "[email protected]"
}

PATCH users/me

Update information about a specific user.

Request parameterTypeDescription
oldPasswordStringThe old password the user wants to change
newPasswordStringThe new password the user wants to use
HTTP Response codeJSON data
200 OKSuccess, user response as shown to the right
400 Bad requestError interpreting the request.
401 UnauthorizedError, access token missing.
Error codesDescription
wrong_passwordThe provided oldPassword doesn't match the existing password.
invalid_requestError in the request body.

Verify Email

Example request for POST /users/me/verify-email

{
  "code": "123654"
}

POST /users/me/verify-email

Request parameterTypeDescription
codeString6 digit code supplied by email
HTTP Response codeJSON data
200 OKSuccess
400 Bad requestError
404 Not foundError
Error codesDescription
invalid_verification_codeInvalid code.
verification_attempts_exceededInvalid code has been posted more than 5 times.

Request password reset

Starts the password reset flow for given email.

Example request for POST /users/request-password-reset

{
  "email": "[email protected]",
  "partnerId": "5f51bfe2-d08a-4b43-9d5c-405fd2f2ede6"
}

POST users/request-password-reset

Update information about a specific user.

Request parameterTypeDescription
emailStringEmail of the user for whom the password should change.
partnerIdUUIDpartnerId for partner associated with the user.
HTTP Response codeJSON data
200 OKSuccess
400 Bad requestError
Error codesDescription
invalid_requestError in the request body.

Validate security code

Validate security code sent via email when reset password has been requested.

Example request for POST /users/validate-security-code

{
  "email": "[email protected]",
  "partnerId": "5f51bfe2-d08a-4b43-9d5c-405fd2f2ede6",
  "code": "123456"
}

Example response from the above request

{
  "id": 1234,
  "time": 123559953254,
  "token": "secret-token-used-for-reset-password"
}

POST /users/validate-security-code

Validate security code sent by email and provide response used for resetting password (see next step).

Request parameterTypeDescription
emailString
partnerIdUUIDPartner ID.
codeStringSecurity code provided in email.
HTTP Response codeJSON data
200 OKSuccess
400 Bad requestError
404 Not foundError user or security code is not found.
Error codesDescription
security_code_not_foundUser or security code is not found.
invalid_security_codeSecurity code is invalid.
security_code_attempts_exceededMax attempts exceeded.

Reset password

Sets new password for the user.

Example request for POST /users/reset-password

{
  "id": 1,
  "token": "1234567890asdfghjk",
  "time": 123456789,
  "password": "mynewpassword"
}

POST /users/reset-password

Request parameterTypeDescription
idIntegerID of the user who will get new password.
tokenStringToken for checking validity of the request.
timeIntegerTime of the request.
passwordStringNew password.
HTTP Response codeJSON data
200 OKSuccess
400 Bad requestError interpreting the request.
404 Not foundError user is not found.
Error codesDescription
invalid_password_reset_tokenThe provided token is not valid.
user_not_foundUser with given id does not exist.

Reset offline token

Example of JWT payload

{
  "email": "[email protected]"
}

Example of a request

{
  "email": "[email protected]",
  "partnerId": "5f51bfe2-d08a-4b43-9d5c-405fd2f2ede6"
}

Example of a response

{
  "offlineToken": "new-offline-token"
}

Endpoint to reset the offline token for a user. Old one will be invalidated, and a new one will be issued.

This endpoint requires partner authentication.

POST /users/reset-offline-token

Authentication

To authenticate request we will use public / private key from trusted email validation.

JWT payload will be different. The payload must contain the email equal to the request body email, see example to the right.

The JWT token should be sent as a Bearer token in the Authorization header like this
Authorization: Bearer <jwt_token>

Request parameterTypeDescription
emailStringEmail of the user
partnerIdUUIDPartner ID
HTTP Response codeJSON data
200 OKSuccess
400 Bad requestError interpreting the request.
401 UnauthorizedError access not granted.
404 Not foundError user is not found.
Error codesDescription
missing_argumentRequest param missing.
user_not_foundUser with given email does not exist.
invalid_partner_tokenPartner token not provided or invalid.