# API Docs
## Login
Details for login api
##
##
####Endpoint
> {warning} Please note that the URI for this endpoint should include api/{$version} before
| Method | URI | Headers |
| : | :- | : |
| POST | `/login` | Default |
### URL Params
```php
None
```
### Data Params
```php
{
"email" : "4513098763",
"via" : "PASSWORD", // PASSWORD / OTP
"password" :"abcdefgh",
"verified" : "1",
"app_version" : "1",
}
```
> {success} Success Response
####Code `200`
####Content
```php
{
"type": 1, //1: E-mail 2: Contact number
"email": "test.user@global.jain",
"country_code": "-",
"mobile": "-",
"email_preview": "t********@g*****.jain",
"message": "Please check your phone for OTP."
}
```
> {danger} Unauthenticated Response
####Code `401`
####Content
```php
{
"message": "This contact does not exist!"
}
```
## Login via Facebook
Details for Login via Facebook api
##
##
####Endpoint
> {warning} Please note that the URI for this endpoint only should not include api/{$version} before
| Method | URI | Headers |
| : | :- | : |
| POST | `/social-login` | Default |
### URL Params
```php
None
```
### Data Params
```php
{
"email":"test@globaljain.com",
"id":"12345",
"provider":"facebook",
"name":"GJ Test"
}
```
> {success} Success Response
####Code `200`
####Content
```php
{
"token": "3|kUpw8msHyXbND275RNIv2KlyBnQE7ltECWRO3Flc",
"user": {
"id": 3,
"name": "GJ Test",
"email": "test@globaljain.com",
"country_code": null,
"mobile": null,
"email_preview": "t***@g*********.com",
"avatar_url": null,
"is_profile_verified": null,
"login_type": 1,
"unread_message_count": null,
"unread_notification_count": null
},
"message": "Logged in succesfully.",
"status": 200
}
```
> {danger} Unauthenticated Response
####Code `403`
####Content
```php
{
"message": "Something went wrong!",
"status": 403
}
```
## Register
Details for Registration api
##
##
####Endpoint
> {warning} Please note that the URI for this endpoint should include api/{$version} before
| Method | URI | Headers |
| : | :- | : |
| POST | `/register` | Default |
### URL Params
```php
None
```
### Data Params
```php
{
"name" : "Test User",
"email" : "4513098763",
"country_code" : "91",
"dharma" : 2, //Dharma ID
"birth_date" : "1999/01/11",
"password" : "abcdefgh",
"password_confirmation" : "abcdefgh"
}
```
> {success} Success Response
####Code `200`
####Content
```php
{
"user": {
"id": 2,
"name": "Test User",
"email": "test.user@global.jain",
"country_code": null,
"mobile": null,
"email_preview": "t********@g*****.jain",
"avatar_url": null,
"is_profile_verified": null,
"login_type": 0, //0: Normal, 1: Social Media
"unread_message_count": null,
"unread_notification_count": null
},
"message": "Check your mobile number for otp and verify."
}
```
> {danger} Unauthenticated Response
####Code `400`
####Content
```php
{
"message": "This contact already exists!"
}
```
## Reset Password
Details for Reset Password api
##
##
####Endpoint
> {warning} Please note that the URI for this endpoint should include api/{$version} before
| Method | URI | Headers |
| : | :- | : |
| POST | `/user/reset/password` | Default |
### URL Params
```php
None
```
### Data Params
```php
{
"current_password" : "abcdefgh",
"new_password" : "12345678",
"confirm_password" : "12345678"
}
```
> {success} Success Response
####Code `200`
####Content
```php
{
"status": 200,
"success": true,
"message": "Password has been updated"
}
```
> {danger} Unauthenticated Response
####Code `400`
####Content
```php
{
"message": "The given data was invalid.",
"errors": {
"new_password": [
"The new password and confirm password must match."
]
}
}
```
## Set Password
Details for Reset Password api
##
##
####Endpoint
> {warning} Please note that the URI for this endpoint should include api/{$version} before
| Method | URI | Headers |
| : | :- | : |
| POST | `/set/password` | Default |
### URL Params
```php
None
```
### Data Params
```php
{
"country_code" : "+91",
"mobile" : "9632587410",
"new_password" : "abcdefgh",
"confirm_password" : "abcdefgha"
}
```
> {success} Success Response
####Code `200`
####Content
```php
{
"status": 200,
"success": true,
"message": "Password has been updated"
}
```
## Email verification
Details for Email verification through OTP api
##
##
####Endpoint
> {warning} Please note that the URI for this endpoint should include api/{$version} before
| Method | URI | Headers |
| : | :- | : |
| POST | `/email-verification` | Default |
### URL Params
```php
None
```
### Data Params
```php
{
"otp": "151545",
"email": "test.user@global.jain"
}
```
> {success} Success Response
####Code `200`
####Content
```php
{
"token": "1|ZqTjAV0RipnxnFiVEdgrGjSxzublx8SEQ12WeRUj",
"user": {
"id": 2,
"name": "Test User",
"email": "test.user@global.jain",
"country_code": null,
"mobile": null,
"email_preview": "t********@g*****.jain",
"avatar_url": null,
"is_profile_verified": null,
"login_type": 0, //0: Normal, 1: Social Media
"unread_message_count": null,
"unread_notification_count": null
},
"message": "OTP code has been verified.",
"success": true
}
```
> {danger} Unauthenticated Response
####Code `403`
####Content
```php
{
"message": "Please provide a valid OTP code.",
"success": false
}
```
## Logout
Details for logout api
##
##
####Endpoint
> {warning} Please note that the URI for this endpoint should include api/{$version} before
| Method | URI | Headers |
| : | :- | : |
| GET | `/user/logout` | Bearer {token} |
### URL Params
```php
None
```
### Data Params
```php
None
```
> {success} Success Response
####Code `200`
####Content
```php
{
"message": "Logged out."
}
```
> {danger} Unauthenticated Response
####Code `404`
####Content
```php
{
"message": "User not found."
}
```
## User Exist
Details for user-exist api
##
##
####Endpoint
> {warning} Please note that the URI for this endpoint should include api/{$version} before
| Method | URI | Headers |
| : | :- | : |
| POST | `/user/exist` | |
### URL Params
```php
None
```
### Data Params
```php
{
"country_code" : "+91"
"mobile" : "9426596321"
}
```
> {success} Success Response
####Code `200`
####Content
```php
{
"status": 200,
"success": true
}
```
## Delete Shravak Account Details
Details of delete shravak profile details
##
##
####Endpoint
> {warning} Please note that the URI for this endpoint should include api/{$version} before
| Method | URI | Headers |
| : | :- | : |
| POST | `user/delete-account` | Bearer {token} |
### URL Params
```php
None
```
### Data Params
```php
None
```
> {success} Success Response
####Code `200`
####Content
```php
{
"message": "Account deleted successfully.",
"status": 200
}
```
> {danger} Unauthenticated Response
####Code `403`
####Content
```php
{
"message": "You can\'t delete this account, Please add or update the sangh admin in which you are associated!",
"status": 403
}
```