Info
Welcome to iHopr Api Documentation.
Authentication
Authentication endpoint allows you to perform login and register related opertaions like login using email and password, verify 2-step code, verify otp based code, register new user to ptoject etc.
Login API
Login API to log user into the project and get required access token and other user details.
If project_type is "None", then call Get Access Token to exchange code with access token
Example request:
curl -X POST "https://platform.ihopr.com/api/v1/login" \
-H "Content-Type: application/json" \
-d '{"client_id":"CLIENT_ID","client_secret":"CLIENT_SECRET","email":"test@technosip.com","password":"123456","code_challenge":"numquam"}'
const url = new URL("https://platform.ihopr.com/api/v1/login");
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
}
let body = {
"client_id": "CLIENT_ID",
"client_secret": "CLIENT_SECRET",
"email": "test@technosip.com",
"password": "123456",
"code_challenge": "numquam"
}
fetch(url, {
method: "POST",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
Example response (200):
{
"status": "success",
"message": "Auth Code sent successfully",
"code": "ce7d20740ed380b2de84d434af383142",
"project_type": "none"
}
Example response (200):
{
"status": "success",
"message": "Two Step Authentication code sent successfully.",
"two_step_auth_token": "1444cab87e78abcda80ef6b01158fc556175921247158c7fe0be153fe301f6f5bb96c7",
"project_type": "two-step"
}
Example response (200):
{
"status": "success",
"message": "OTP code sent successfully.",
"otp_token": "0736e145a6d53308afbbaec0b5b642fa743132fff00c84380ee5d694002172c6c58c08",
"project_type": "otp"
}
HTTP Request
POST api/v1/login
Body Parameters
Parameter | Type | Status | Description |
---|---|---|---|
client_id | string | required | client_id of project. |
client_secret | string | required | client_secret of project. |
string | required | Email id of user. | |
password | string | optional | If its OTP based authentication than its not required, else its required param. |
code_challenge | string | optional | optional used for SPA, JS, Native Mobile Apps Login API |
Register API
Register API to create new user in project
If project_type is "None", then call Get Access Token to exchange code with access token
Example request:
curl -X POST "https://platform.ihopr.com/api/v1/signup" \
-H "Content-Type: application/json" \
-d '{"client_id":"CLIENT_ID","client_secret":"CLIENT_SECRET","email":"test@technosip.com","password":"123456","first_name":"FName","last_name":"LName","mobile_number":11223344,"meta":"{\"address\":\"NJ\"}","code_challenge":"delectus"}'
const url = new URL("https://platform.ihopr.com/api/v1/signup");
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
}
let body = {
"client_id": "CLIENT_ID",
"client_secret": "CLIENT_SECRET",
"email": "test@technosip.com",
"password": "123456",
"first_name": "FName",
"last_name": "LName",
"mobile_number": 11223344,
"meta": "{\"address\":\"NJ\"}",
"code_challenge": "delectus"
}
fetch(url, {
method: "POST",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
Example response (200):
{
"status": "success",
"message": "Auth Code sent successfully",
"code": "50a3a19954473bf55d9ebd3b41be027b",
"project_type": "none"
}
Example response (200):
{
"status": "success",
"message": "OTP code sent successfully.",
"otp_token": "ce8075e5e770e21686ae5c1fb0d081de29880111fa4bf364b35d5807160304dbe0500a",
"project_type": "otp"
}
Example response (200):
{
"status": "success",
"message": "Two Step Authentication code sent successfully.",
"two_step_auth_token": "72aeade72fc5f26e3fd16027ddee938d870717402d628dc832309fa73190538550942b",
"project_type": "two-step"
}
HTTP Request
POST api/v1/signup
Body Parameters
Parameter | Type | Status | Description |
---|---|---|---|
client_id | string | required | client_id of project. |
client_secret | string | required | client_secret of project. |
string | required | Email id of user. | |
password | string | optional | If its OTP based authentication than its not required, else its required param. |
first_name | string | required | First Name of user. |
last_name | string | required | Last Name of user. |
mobile_number | integer | required | Mobile Number of user. |
meta | string | optional | Other Meta information. |
code_challenge | string | optional | optional used for SPA, JS, Native Mobile Apps Signup API |
Validate OTP Code.
API Endpoint to validate OTP code and return code which will be used to get Access Token
Call Get Access Token to exchange code with access token
Example request:
curl -X POST "https://platform.ihopr.com/api/v1/otp-code" \
-H "Content-Type: application/json" \
-d '{"otp_code":0,"otp_token":"OTP_TOKEN"}'
const url = new URL("https://platform.ihopr.com/api/v1/otp-code");
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
}
let body = {
"otp_code": 0,
"otp_token": "OTP_TOKEN"
}
fetch(url, {
method: "POST",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
Example response (200):
{
"status": "success",
"code": "bbd79f1ab5eb8ff87fc27e9dcfffda2c"
}
HTTP Request
POST api/v1/otp-code
Body Parameters
Parameter | Type | Status | Description |
---|---|---|---|
otp_code | integer | required | OTP Code received in email. |
otp_token | string | required | OTP Token return from login endpoint. |
Validate Two Step Auth Code.
API Endpoint to validate Two Step Auth code for successful login and return code which will be used to get Access Token
Call Get Access Token to exchange code with access token
Example request:
curl -X POST "https://platform.ihopr.com/api/v1/two-step-auth-code" \
-H "Content-Type: application/json" \
-d '{"two_step_auth_code":0,"two_step_auth_token":"TWO_STEP_AUTH_TOKEN"}'
const url = new URL("https://platform.ihopr.com/api/v1/two-step-auth-code");
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
}
let body = {
"two_step_auth_code": 0,
"two_step_auth_token": "TWO_STEP_AUTH_TOKEN"
}
fetch(url, {
method: "POST",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
Example response (200):
{
"status": "success",
"code": "9804ef560e8d1b09405505322ae709fd"
}
HTTP Request
POST api/v1/two-step-auth-code
Body Parameters
Parameter | Type | Status | Description |
---|---|---|---|
two_step_auth_code | integer | required | Two Step Auth Code received in email. |
two_step_auth_token | string | required | Two Step Auth Token returned from login endpoint. |
Reset Password - Send Code
API Endpoint to send Reset Password code, so that you can reset password in next step.
Example request:
curl -X POST "https://platform.ihopr.com/api/v1/send-reset-password-code" \
-H "Content-Type: application/json" \
-d '{"client_id":"CLIENT_ID","client_secret":"CLIENT_SECRET","email":"test@technosip.com"}'
const url = new URL("https://platform.ihopr.com/api/v1/send-reset-password-code");
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
}
let body = {
"client_id": "CLIENT_ID",
"client_secret": "CLIENT_SECRET",
"email": "test@technosip.com"
}
fetch(url, {
method: "POST",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
Example response (200):
{
"status": "success",
"message": "Reset Password code sent successfully.",
"reset_password_token": "3329ef1e1a717d29a19d6de5cc0d93d46786679fe3e23bfb824ec276509f466b57e92a0"
}
HTTP Request
POST api/v1/send-reset-password-code
Body Parameters
Parameter | Type | Status | Description |
---|---|---|---|
client_id | string | required | client_id of project. |
client_secret | string | required | client_secret of project. |
string | required | Email id of user for you want to reset password. |
Reset Password
API Endpoint to Reset Password.
Example request:
curl -X POST "https://platform.ihopr.com/api/v1/reset-password" \
-H "Content-Type: application/json" \
-d '{"reset_password_code":0,"reset_password_token":"RESET_PASSWORD_TOKEN","password":"NEW_PASSWORD"}'
const url = new URL("https://platform.ihopr.com/api/v1/reset-password");
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
}
let body = {
"reset_password_code": 0,
"reset_password_token": "RESET_PASSWORD_TOKEN",
"password": "NEW_PASSWORD"
}
fetch(url, {
method: "POST",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
Example response (200):
{
"status": "success"
}
HTTP Request
POST api/v1/reset-password
Body Parameters
Parameter | Type | Status | Description |
---|---|---|---|
reset_password_code | integer | required | Reset Password code received in Email. |
reset_password_token | string | required | Reset Password token received from last API call. |
password | string | required | New Password to be updated in database. |
Get Access Token
API Endpoint to Get Access Token from code
Example request:
curl -X POST "https://platform.ihopr.com/api/v1/api-tauth-token" \
-H "Content-Type: application/json" \
-d '{"client_id":"CLIENT_ID","client_secret":"CLIENT_SECRET","code":"CODE","code_verifier":"est"}'
const url = new URL("https://platform.ihopr.com/api/v1/api-tauth-token");
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
}
let body = {
"client_id": "CLIENT_ID",
"client_secret": "CLIENT_SECRET",
"code": "CODE",
"code_verifier": "est"
}
fetch(url, {
method: "POST",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
Example response (200):
{
"status": "success",
"access_token": "637672de9290ca6a5a2a571f33255d0320d4c324f76808b6a3611f3f1baa263914dadc9eafd7f",
"refresh_token": "96f1cab8460082eea04d3c2961300296de716fef550b5f5548e898a5c99849e6173e4994a5bdb",
"expires_at": "2023-03-17 12:43:58",
"user": {
"id": 6,
"user_id": "8d0aae04d621f4246df96b9de511c744",
"first_name": "test",
"last_name": "name",
"email": "test@technosip.com",
"mobile_number": "(123) 456-78",
"meta": null,
"role": "user",
"provider": "",
"created_at": "2022-11-17T15:37:56.000000Z"
}
}
HTTP Request
POST api/v1/api-tauth-token
Body Parameters
Parameter | Type | Status | Description |
---|---|---|---|
client_id | string | required | client_id of project. |
client_secret | string | required | client_secret of project. |
code | string | required | code received in previous request. |
code_verifier | string | optional | optional used for SPA, JS, Native Mobile Apps Login API. |
User
User endpoint allows you to get logged in User information using access_token or update user details .
Get User
User API to get logged in user information.
Example request:
curl -X GET -G "https://platform.ihopr.com/api/v1/user" \
-H "Authorization: Bearer {token}"
const url = new URL("https://platform.ihopr.com/api/v1/user");
let headers = {
"Authorization": "Bearer {token}",
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
Example response (200):
{
"status": "success",
"user": {
"id": 6,
"user_id": "8d0aae04d621f4246df96b9de511c744",
"first_name": "test",
"last_name": "name",
"email": "test@technosip.com",
"mobile_number": "(123) 456-78",
"meta": null,
"role": "user",
"created_at": "2022-11-17T15:37:56.000000Z"
}
}
HTTP Request
GET api/v1/user
Update User
Update User API to update user information.
Example request:
curl -X PUT "https://platform.ihopr.com/api/v1/user/update" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {token}" \
-d '{"first_name":"A","last_name":"B","password":"123456","mobile_number":"1122334455","role":"admin"}'
const url = new URL("https://platform.ihopr.com/api/v1/user/update");
let headers = {
"Content-Type": "application/json",
"Authorization": "Bearer {token}",
"Accept": "application/json",
}
let body = {
"first_name": "A",
"last_name": "B",
"password": "123456",
"mobile_number": "1122334455",
"role": "admin"
}
fetch(url, {
method: "PUT",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
Example response (200):
{
"status": "success",
"user": {
"id": 6,
"user_id": "8d0aae04d621f4246df96b9de511c744",
"first_name": "New Fname",
"last_name": "New LName",
"email": "test@technosip.com",
"mobile_number": "1122334455",
"meta": null,
"role": "admin",
"created_at": "2022-11-17T15:37:56.000000Z"
},
"updated": {
"first_name": "New Fname",
"last_name": "New LName",
"role": "admin",
"updated_at": "2022-11-18 10:10:49"
}
}
HTTP Request
PUT api/v1/user/update
Body Parameters
Parameter | Type | Status | Description |
---|---|---|---|
first_name | string | optional | First Name that you want to update. |
last_name | string | optional | Last Name that you want to update. |
password | string | optional | Password that you want to update. |
mobile_number | string | optional | Mobile Number that you want to update. |
role | string | optional | User Role that you want to update. |
Update User Role
Update User API to update user role.
Example request:
curl -X PUT "https://platform.ihopr.com/api/v1/user/update/role" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {token}" \
-d '{"role":"Admin"}'
const url = new URL("https://platform.ihopr.com/api/v1/user/update/role");
let headers = {
"Content-Type": "application/json",
"Authorization": "Bearer {token}",
"Accept": "application/json",
}
let body = {
"role": "Admin"
}
fetch(url, {
method: "PUT",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
Example response (200):
{
"status": "success",
"user": {
"id": 6,
"user_id": "8d0aae04d621f4246df96b9de511c744",
"first_name": "New Fname",
"last_name": "New LName",
"email": "test@technosip.com",
"mobile_number": "1122334455",
"meta": null,
"role": "Dev",
"created_at": "2022-11-17T15:37:56.000000Z"
},
"updated": {
"role": "Dev",
"updated_at": "2022-11-18 10:13:48"
}
}
HTTP Request
PUT api/v1/user/update/role
Body Parameters
Parameter | Type | Status | Description |
---|---|---|---|
role | string | optional | User Role. |