Skip to main content

User Passwords API

Content

Single user password:

General notes

User passwords are used for resetting passwords. Reset tokens are sent to user's email.

Send password token by user

POST /api/v0/passwords/user

Method for sending password reset token to provided email address.

Request

ParamTypeDescriptionRequirements
emailstringUser login emailRequired
POST /api/v0/passwords/user HTTP/1.1
Content-Type: application/json

{
"email": "john.doe@example.com"
}

Responses

204 NO CONTENT

Email with reset token was sent.

403 FORBIDDEN

There is a time limit before sending new reset token. Forbidden, because time limit not passed yet.

POST /api/v0/passwords/user HTTP/1.1
Content-Type: application/json

{
"type": "Forbidden",
"message": "You can send a new token only after 10 minutes have passed since the previous one.",
"id": "b1e61001-b910-44f2-a31e-9b4133a213ad"
}

404 NOT FOUND

Given email was not found in users

POST /api/v0/passwords/user HTTP/1.1
Content-Type: application/json

{
"type": "NotFound",
"message": "The entered email does not exist in the system.",
"id": "823a99c1-37d1-4edf-9610-0485684fec0f"
}

Send password token by admin

POST /api/v0/passwords/user/{userId}

This method needs permission create on users.

Request

Index behaviourDefinition
Embedded-
POST /api/v0/passwords/user/1

Responses

204 NO CONTENT

Email with reset token was sent.

403 FORBIDDEN

There is a time limit before sending new reset token. Forbidden, because time limit not passed yet.

POST /api/v0/passwords/user HTTP/1.1
Content-Type: application/json

{
"type": "Forbidden",
"message": "You can send a new token only after 10 minutes have passed since the previous one.",
"id": "b1e61001-b910-44f2-a31e-9b4133a213ad"
}

404 NOT FOUND

Given email was not found in users

POST /api/v0/passwords/user HTTP/1.1
Content-Type: application/json

{
"type": "NotFound",
"message": "The entered email does not exist in the system.",
"id": "823a99c1-37d1-4edf-9610-0485684fec0f"
}

Set new password

PUT /api/v0/passwords/user

Method for updating user password.

Request

ParamTypeDescriptionRequirements
emailstringUser login emailRequired
tokenstringGenerated user password reset tokenRequired
new_passwordstringUser new passwordRequired
new_password_confirmationstringUser new password againRequired
PUT /api/v0/passwords/user HTTP/1.1
Content-Type: application/json

{
"email": "john.doe@example.com",
"token": "V1am22VEEJiB4DXChtF0Ds7gdoZz0HPVDHKl0qHz",
"new_password": "PasswordThatIsSafe159",
"new_password_confirmation": "PasswordThatIsSafe159"
}

Responses

204 NO CONTENT

Password was successfully set.

422 UNPROCESSABLE CONTENT

Validation error occurred.

PUT /api/v0/passwords/user HTTP/1.1
Content-Type: application/json

{
"type": "ValidationError",
"message": "Pole musí být delší než 8 znaků.",
"id": "b38b4baf-0c35-4e35-94a6-a56380a65c91",
"errors": [
{
"field": "new_password",
"message": "Pole musí být delší než 8 znaků."
}
]
}

498 INVALID TOKEN

Token has expired

PUT /api/v0/passwords/user HTTP/1.1
Content-Type: application/json

{
"type": "ExpiredToken",
"message": "The specified token has already expired.",
"id": "477b7164-d8c8-41bf-8b99-cd2248f57788"
}