Customers¶
Register¶
The API returns 201 status code on successful registration.
Endpoint: /client/v1/register
Method: POST
Additional Headers
Parameter | Description |
---|---|
X-Client-IP | IP Address of the customer. |
X-Client-UA | User Agent of client application. For mobile apps this should be
Application Version
|
X-Client-Fingerprint | The unique identifier for device (Device ID). |
Parameters
Parameter | Description |
---|---|
Email address of the customer. | |
password | Password |
confirm_password | Password Confirmation |
email_verification_url | Enter the endpoint for creating a email verification url, you should
provide :token variable in this url. This is going to be replaced
by email verification token generated by backend. The customer will
be redirect to this page for verification.
eg. https://www.example.com/users/verify-email/:token will be
https://www.example.com/users/verify-email/bacdefghi
|
Example HTTP Request
POST /client/v1/register HTTP/1.1
X-Client-ID: your-client-id
X-Client-Secret: your-client-secret
X-Client-IP: user-ip-address
X-Client-UA: user-agent
X-Client-Fingerprint: unique-device-fingerprint
Content-Type: application/x-www-form-urlencoded
email=test%40test.com
&password=Password%40741
&confirm_password=Password%40741
&email_verification_url=https%3A%2F%2Fwww.example.com%2Fusers%2Fverify-email%2F%3Atoken
Response
{
"code": 201,
"message": "Success",
"token": "63pS1fe84r940yHocou6I7......"
}
Response Description
Parameter | Description |
---|---|
token | The login token for customer. |
Example Failed Response
{
"code": 400,
"type": "invalid_request_error",
"message": "Invalid request",
"errors": [
{
"param": "email",
"code": "unique",
"message": "Email address is already registered."
}
]
}
Login¶
The API returns 200 status code on successful login and 401 for login failure due to incorrect credentials.
Endpoint: /client/v1/login
Method: POST
Additional Headers
Parameter | Description |
---|---|
X-Client-IP | IP Address of the customer. |
X-Client-UA | User Agent of client application. For mobile apps this should be
Application Version
|
X-Client-Fingerprint | The unique identifier for device (Device ID). |
Parameters
Parameter | Description |
---|---|
Email address of the customer. | |
password | Password |
Example HTTP Request
POST /client/v1/login HTTP/1.1
X-Client-ID: your-client-id
X-Client-Secret: your-client-secret
X-Client-IP: user-ip-address
X-Client-UA: user-agent
X-Client-Fingerprint: unique-device-fingerprint
Content-Type: application/x-www-form-urlencoded
email=test%40test.com
&password=Password%40741
Response
{
"code": 200,
"message": "Success",
"token": "63pS1fe84r940yHocou6I7......"
}
Response Description
Parameter | Description |
---|---|
token | The login token for customer. |
Example Failed Response
{
"code": 401,
"type": "authentication_error",
"message": "Incorrect email address or password"
}
Forgot Password¶
Endpoint: /client/v1/forgot-password
Method: POST
Parameters
Parameter | Description |
---|---|
Email address of the customer. | |
reset_password_url | Enter the endpoint for creating a reset password url, you should
provide :token variable in this url. This is going to be replaced
by reset password token generated by backend. The customer will
be redirect to this page for resetting password.
eg. https://www.example.com/reset-password/:token will be
https://www.example.com/reset-password/bacdefghi
|
Example HTTP Request
POST /client/v1/forgot-password HTTP/1.1
X-Client-ID: your-client-id
X-Client-Secret: your-client-secret
Content-Type: application/x-www-form-urlencoded
email=test%40test.com
&reset_password_url=https%3A%2F%2Fwww.example.com%2Freset-password%2F%3Atoken
Response
{
"code": 200,
"message": "Success",
"recipient": "te***@test.com"
}
Response Description
Parameter | Description |
---|---|
recipient | The masked email address of customer account. |
Example Failed Response
{
"code": 400,
"type": "invalid_request_error",
"message": "Invalid request",
"errors": [
{
"param": "email",
"code": "not_found",
"message": "Customer account not found."
}
]
}
Reset Password¶
Endpoint: /client/v1/reset-password
Method: POST
Parameters
Parameter | Description |
---|---|
token | Request token |
password | Password |
confirm_password | Password Confirmation |
Example HTTP Request
POST /client/v1/reset-password HTTP/1.1
X-Client-ID: your-client-id
X-Client-Secret: your-client-secret
Content-Type: application/x-www-form-urlencoded
token=bacdefghi
&password=Password%40741
&confirm_password=Password%40741
Response
{
"code": 200,
"message": "Success"
}
Example Failed Responses
{
"code": 400,
"type": "invalid_request_error",
"message": "Invalid request",
"errors": [
{
"param": "confirm_password",
"code": "_invalidConfirmPassword",
"message": "New password and confirm password are not same."
}
]
}
{
"code": 400,
"type": "invalid_request_error",
"message": "Invalid request",
"errors": [
{
"param": "confirm_password",
"code": "_invalidConfirmPassword",
"message": "New password and confirm password are not same."
}
]
}