User Password

Change password and reset password.

Change password

POST ‎https://<domain>/<api prefix>/<version>/user/profile/change-password/

This API endpoint is for changing user password

Headers

NameTypeDescription

apikey*

string

apikey

Authorization*

string

Bearer access-token

Request Body

NameTypeDescription

old_password*

string

old password

new_password*

string

new password

confirm_password*

string

confirm password

HTTP/1.1 200 OK
Content-Type: application/json

Body:
{
    "status_code": 200,
    "errors": {},
    "data": {}
}

Sample code

Node

var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://<domain>/<api prefix>/<version>/user/profile/change-password/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access-token>',
  },
  formData: {
    'old_password': '<old_password>',
    'new_password': '<new_password>',
    'confirm_password': '<confirm_password>',
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

PHP

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://<domain>/<api prefix>/<version>/user/profile/change-password/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => array('old_password' => '<old_password>','new_password' => '<new_password>','confirm_password' => '<confirm_password>'),
  CURLOPT_HTTPHEADER => array(
    "apikey: <apikey>",
    "Authorization: Bearer <access-token>"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Error Responses

Status Code

Error Type

Field

Description

401

Authentication Error

Your old password was entered incorrectly. Please enter it again.

400

Validation Error

confirm_password

The two password fields didn't match.

400

Validation Error

password

Your password can't be too similar to your other personal information.

Your password must contain at least 8 characters.

Your password can't be a commonly used password.

Your password can't be entirely numeric.

Your password must contain at least one capital letter, small letter, number and special character.

Forgot password request

POST ‎https://<domain>/<api prefix>/<version>/user/forgot-password/

This API endpoint is to reset the user password. Users can request with the registered email or username. Users will get a link with token and user key in an email. This token, user key, and a new password can send to the forget password submit API endpoint to change the current password or directly use the link to change the password.

Headers

NameTypeDescription

apikey*

string

apikey

Request Body

NameTypeDescription

email*

string

email or username

HTTP/1.1 200 OK
Content-Type: application/json

Body:
{
    "status_code": 200,
    "errors": {},
    "data": {}
}

Sample code

Node

ar request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://<domain>/<api prefix>/<version>/user/forgot-password/',
  'headers': {
    'apikey': '<apikey>',
  },
  formData: {
    'email': '<email or username>'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

PHP

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://<domain>/<api prefix>/<version>/user/forgot-password/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => array('email' => '<email or username>'),
  CURLOPT_HTTPHEADER => array(
    "apikey: <apikey>"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Error Responses

Status Code

Error Type

Description

401

Authentication Error

There is multiple users are registered with the specified E-Mail address.Please enter the username

401

Authentication Error

This username or email does not exist in the system.

Forgot password submit

POST ‎https://<domain>/<api prefix>/<version>/user/forgot-password-submit/‎‎

This endpoint is to reset the user password. User will get a link with token and user key in an email after success response from forgot password request API endpoint. Once use the link to change the password else send the token, user key, and a new password to this API endpoint to change the current user password.

Headers

NameTypeDescription

apikey*

string

apikey

Request Body

NameTypeDescription

user*

string

user key from link

token*

string

token from link

new_password*

string

new password

HTTP/1.1 200 OK
Content-Type: application/json

Body:
{
    "status_code": 200,
    "errors": {},
    "data": {}
}

Sample code

Node

var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://<domain>/<api prefix>/<version>/user/forgot-password-submit/',
  'headers': {
    'apikey': '<apikey>'
  },
  formData: {
    'token': '<token_from_link>',
    'new_password': '<new_password>',
    'user': '<user_key_from_link>'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

PHP

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://<domain>/<api prefix>/<version>/user/forgot-password-submit/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => array('user' => '<user_key_from_link>','token' => '<token>','new_password' => '<new_password>'),
  CURLOPT_HTTPHEADER => array(
    "apikey: <apikey>"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;	

Error Responses

Status Code

Error Type

Field

Description

400

Validation Error

token

The token is invalid. Enter the correct token that send to your email.

400

Validation Error

password

Your password can't be too similar to your other personal information.

Your password must contain at least 8 characters.

Your password can't be a commonly used password.

Your password can't be entirely numeric.

Your password must contain at least one capital letter, small letter, number and special character.

400

Validation Error

user

This field is required.

Last updated