User API

The User API is a collection of endpoints that allow users to interact with the authentication system and manage their profile.

Authentication

The User API uses Sanctum for authentication. You can use the following endpoints to authenticate:

  • POST /login
  • POST /register
  • PUT /update-user-details
  • POST /send-otp-for-password-reset
  • POST /reset-password
  • POST /change-password

Login

The login endpoint is used to authenticate a user. You can use the following endpoints to login:

  • POST /login


    curl --location 'base_url/login' \
        --header 'api-key: api_key' \
        --form 'username="[email protected]"' \
        --form 'password="password"'
    

Register

The register endpoint is used to register a new user. You can use the following endpoints to register:

  • POST /register


    curl --location 'base_url/register' \
        --header 'Accept: application/json' \
        --header 'api-key: api_key' \
        --form 'name="Your Name"' \
        --form 'email="[email protected]"' \
        --form 'mobile="1234567890"' \
        --form 'password="password"' \
        --form 'confirm_password="password"'
    

Update User Details

The update user details endpoint is used to update the user details. You can use the following endpoints to update user details:

  • PUT /update-user-details


    curl --location 'base_url/update-user-details' \
        --header 'Accept: application/json' \
        --header 'api-key: api_key' \
        --header 'Authorization: Bearer *******************************' \
        --form 'name="Test"'
    

Send OTP for Password Reset

The send OTP for password reset endpoint is used to send an OTP to the user's email for password reset. You can use the following endpoints to send OTP for password reset:

  • POST /send-otp-for-password-reset


    curl --location 'base_url/send-otp-for-password-reset' \
        --header 'Accept: application/json' \
        --header 'api-key: api_key' \
        --header 'Authorization: Bearer ***************************************' \
        --form 'email="[email protected]"'
    

Reset Password

The reset password endpoint is used to reset the user's password. You can use the following endpoints to reset password:

  • POST /reset-password


    curl --location 'base_url/reset-password' \
        --header 'Accept: application/json' \
        --header 'api-key: api_key' \
        --header 'Authorization: Bearer ******************************************' \
        --form 'email="[email protected]"' \
        --form 'password="password"' \
        --form 'otp="******"'
    

Change Password

The change password endpoint is used to change the user's password. You can use the following endpoints to change password:

  • POST /change-password


    curl --location 'base_url/change-password' \
        --header 'Accept: application/json' \
        --header 'api-key: api_key' \
        --header 'Authorization: Bearer *****************************************' \
        --form 'email="[email protected]"' \
        --form 'old_password="password"' \
        --form 'password="password"'
    

On this Page

On this Page