Skip to content

Latest commit

 

History

History
105 lines (81 loc) · 2.39 KB

public.md

File metadata and controls

105 lines (81 loc) · 2.39 KB

Public API Endpoints

Register User

  • Endpoint: /register
  • Method: POST
  • Description: Create a new user account by providing valid registration details.
  • Parameters:
    • email: Your email address
    • password: Your password

Request

curl -X POST -H "Content-Type: application/json" -d '{"email": "[email protected]", "password": "strongPassword1"}' http://127.0.0.1:3000/register

Response

{
  "uuid": "6a7b8c9d-1234-5678-90ab-cdef12345678",
  "message": "User registered successfully. Please check your email for activation."
}

Login User

  • Endpoint: /login
  • Method: POST
  • Description: Authenticate an existing user by providing valid login credentials.
  • Parameters:
    • email: Your email address
    • password: Your password

Request

curl -X POST -H "Content-Type: application/json" -d '{"email": "[email protected]", "password": "strongPassword1"}' http://127.0.0.1:3000/register

Response

{
  "uuid": "6a7b8c9d-1234-5678-90ab-cdef12345678",
  "firstName": "John",
  "lastName": "Doe",
  "username": "johndoe123",
  "email": "[email protected]",
  "role": "user",
  "subscriptionStatus": "free",
  "requestCount": 0,
  "creditCount": 0,
  "lastRequestDate": "2024-02-03T08:29:57.919Z",
  "isConfirmed": true,
  "createdAt": "2024-02-03T08:29:58.052Z",
  "updatedAt": "2024-02-03T08:30:11.702Z"
}

Forgot Password

  • Endpoint: /forgot-password
  • Method: POST
  • Description: Initiate the process of resetting the user's password by sending a reset link to their email.
  • Parameters:
    • email: Your email address

Request

curl -X POST -H "Content-Type: application/json" -d '{"email": "[email protected]"}' http://127.0.0.1:3000/forgot-password

Response:

{
  "message": "Password reset email sent successfully."
}

Reset Password

  • Endpoint: /reset-password/:token
  • Method: POST
  • Description: Reset the user's password using the reset token sent via email.
  • Parameters:
    • token: Reset token received via email
    • password: Your new password

Request

curl -X POST -H "Content-Type: application/json" -d '{"password": "strongPassword1"}' http://127.0.0.1:3000/reset-password/3c857304-3ca3-48d1-b1e7-6d5a41230106

Response:

{
  "message": "Password reset successful."
}