Skip to content

User Password Reset API

This API allows users to request a password reset email and reset their password using a token-based mechanism.

1. Send Password Reset Email

Endpoint: api/v1/accounts/send-reset-password-email/
Method: POST
Permissions: AllowAny

This endpoint sends a password reset email to the user with a link containing a unique token to reset their password.

Request Payload

{
  "email": "user@example.com"
}

2. Reset User Password

Endpoint: api/v1/accounts/reset-password/<UUID>/<token>/
Method: PATCH
Permissions: AllowAny

This endpoint allows users to reset their password using the UID and token sent in the password reset email.

Request Payload

{
  "password": "new_secure_password123",
  "confirm_password": "new_secure_password123"
}

Response Payload (Success)

{
  "msg": "Password reset successfully!"
}

Response Payload (Error)

{
  "error": "Invalid or expired token"
}

Explanation:

  1. Request Payload: The data the user needs to send in the body of their request.
  2. It is shown in a JSON code block.
  3. It specifies the fields required for the request (e.g., email, OTP, password).

  4. Response Payload: The expected data the API will return upon success or failure.

  5. These examples are also formatted in a JSON code block.
  6. They show the success or error message, which helps the user understand what to expect.

Final Notes:

  • Status Codes: Include HTTP status codes in the responses if you need to further clarify the API behavior. For instance, HTTP 201 Created for successful creation and HTTP 400 Bad Request for errors.
  • Clarify Error Handling: If your API includes specific error codes or messages, ensure these are included in the documentation for better clarity.

This format can be followed for both APIs (AccountActivation and UserPasswordResetView) to provide clear, structured documentation for developers using or integrating the APIs.