Vanguard
Welcome to Vanguard JSON API documentation. It covers all endpoints that you can use to build your mobile, desktop or web applications around Vanguard, from simple username/password authentication to user management.
HTTP Status Code Summary ¶
HTTP Status Codes
200 - OK Everything worked as expected.
201 - Created Resource is created successfully
400 - Bad Request The request was unacceptable, often due to missing a required parameter.
401 - Unauthorized No valid API key provided.
403 - Forbidden Accessing the resource is forbidden for this user.
404 - Not Found The requested resource doesn’t exist.
422 - Unprocessable Entity Required fields are missing or cannot be processed.
500, 502, 503, 504 - Server Errors Something went wrong on Vanguard’s end.
Authentication And Registration ¶
Authentication ¶
Standard AuthenticationPOST/login
Example URI
Headers
Content-Type: application/json
Body
{
"username": "milos",
"password": "123123"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"username": {
"type": "string",
"description": "Username to be used for authentication"
},
"password": {
"type": "string",
"description": "Password to be used for authentication"
}
},
"required": [
"username",
"password"
]
}
200
Headers
Content-Type: application/json
Body
{
"token": "asdfasfdasdfasdfa"
}
401
Headers
Content-Type: application/json
Body
{
"error": "Invalid credentials."
}
422
Headers
Content-Type: application/json
Body
{
"username": [
"The username field is required."
],
"password": [
"The password field is required."
]
}
500
Headers
Content-Type: application/json
Body
{
"error": "Could not create token."
}
Logout ¶
Logout and Token InvalidationPOST/logout
Sending an request to logout endpoint with a valid API token will also invalidate that token.
Example URI
Headers
Content-Type: aplication/json
Accept: application/json
Authorization: Bearer <api token here>
200
Headers
Content-Type: application/json
Body
+ Attributes (Response Success)
401
Headers
Content-Type: text/html
Body
+ Attributes (Response 401)
Registration ¶
Register UserPOST/register
Example URI
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Body
{
"username": "johndoe",
"email": "john.doe@gmail.com",
"password": "123123",
"password_confirmation": "123123",
"g-recaptcha-response": "asdfjn123jnjqpoasdnv934q243r",
"tos": true
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"username": {
"type": "string",
"description": "Unique user's username."
},
"email": {
"type": "string",
"description": "User's email."
},
"password": {
"type": "string",
"description": "Users password."
},
"password_confirmation": {
"type": "string",
"description": "Password confirmation."
},
"g-recaptcha-response": {
"type": "string",
"description": "Google re-captcha response if re-captcah is required according to the application settings."
},
"tos": {
"type": "boolean",
"description": "Indicates if Terms of Service are accepted (if ToS is enabled inside application settings)."
}
},
"required": [
"email",
"password",
"password_confirmation"
]
}
201
Headers
Content-Type: application/json
Body
{
"requires_email_confirmation": true
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"requires_email_confirmation": {
"type": "boolean",
"description": "A flag which indicates if email confirmation is required. If it is set to true that means that user has received a verification email."
}
}
}
404
Headers
Content-Type: application/json
Body
{
"error": "Resource not found."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Resource not found."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
422
Headers
Content-Type: application/json
Body
{
"email": [
"The email field is required.",
"The email must be a valid email address.",
"The email has already been taken."
],
"username": [
"The username field is required.",
"The username has already been taken."
],
"password": [
"The password field is required.",
"The password confirmation does not match."
],
"g-recaptcha-response": [
"The g-recaptcha-response field is required.",
"reCAPTCHA value is invalid."
],
"tos": [
"You have to accept Terms of Service.",
]
}
Verify EmailPOST/registration/verify-email/{token}
Example URI
- token
string
(required) Example: 4SfyJptHEqaHbcNtoeCblXzMyJ8apROAnJ82o0EuEcRI9QH7ca8VefzCLVaLEmail confirmation token.
Headers
Content-Type: application/json
Accept: application/json
200
Headers
Content-Type: application/json
Body
{
"success": true
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"success": {
"type": "boolean"
}
}
}
400
Headers
Content-Type: application/json
Body
{
"error": "Invalid confirmation token."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string"
}
}
}
404
Headers
Content-Type: application/json
Body
{
"error": "Resource not found."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Resource not found."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
Password Reset ¶
Request Password Reset EmailPOST/password/remind
Example URI
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Body
{
"email": "john@doe.com"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"email": {
"type": "string",
"description": "User's email address."
}
},
"required": [
"email"
]
}
200
Headers
Content-Type: application/json
Body
{
"success": true
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"success": {
"type": "boolean"
}
}
}
422
Headers
Content-Type: application/json
Body
{
"email": [
"The email field is required.",
"The email must be a valid email address.",
"The selected email is invalid."
]
}
Reset PasswordPOST/password/reset
Example URI
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Body
{
"token": "4SfyJptHEqaHbcNtoeCblXzMyJ8apROAnJ82o0EuEcRI9QH7ca8VefzCLVaL",
"email": "john@doe.com",
"password": "123123",
"password_confirmation": "123123"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"token": {
"type": "string",
"description": "Password reset token received via email."
},
"email": {
"type": "string",
"description": "User's email address."
},
"password": {
"type": "string",
"description": "New password."
},
"password_confirmation": {
"type": "string",
"description": "New password confirmation."
}
},
"required": [
"token",
"email",
"password",
"password_confirmation"
]
}
200
Headers
Content-Type: application/json
Body
{
"success": true
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"success": {
"type": "boolean"
}
}
}
400
Headers
Content-Type: application/json
Body
{
"error": "This password reset token is invalid."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string"
}
}
}
422
Headers
Content-Type: application/json
Body
{
"token": [
"The token field is required.",
],
"email": [
"The email field is required.",
"The email must be a valid email address."
],
"password": [
"The password field is required.",
"The password confirmation does not match."
],
}
Stats ¶
Get Stats ¶
Admin StatsGET/stats
When currently authenticated user is administrator (has Admin role).
Example URI
Headers
Content-Type: aplication/json
Accept: application/json
Authorization: Bearer <api token here>
200
Headers
Content-Type: application/json
Body
{
"users_per_month": {
"January": 0,
"February": 0,
"March": 1,
"April": 0,
"May": 0,
"June": 0,
"July": 0,
"August": 2,
"September": 0,
"October": 0,
"November": 0,
"December": 0
},
"users_per_status": {
"total": 3,
"new": 2,
"banned": 0,
"unconfirmed": 1
},
"latest_registrations": [
{
"id": 123,
"first_name": "John",
"last_name": "Doe",
"username": "johndoe",
"email": "john.doe@gmail.com",
"phone": "+381641234567",
"avatar": "http://yourwebsite.com/users/milos-avatar.jpg",
"address": "Some random street, 123, Serbia",
"country_id": 688,
"role_id": 1,
"status": "Active",
"birthday": "1989-01-03",
"last_login": "2017-04-27 16:47:59",
"two_factor_country_code": 381,
"two_factor_phone": "6412345678",
"two_factor_options": {
"option1": 4,
"option2": "option value"
},
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
},
"..."
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"users_per_month": {
"type": "object",
"properties": {
"January": {
"type": "number"
},
"February": {
"type": "number"
},
"March": {
"type": "number"
},
"April": {
"type": "number"
},
"May": {
"type": "number"
},
"June": {
"type": "number"
},
"July": {
"type": "number"
},
"August": {
"type": "number"
},
"September": {
"type": "number"
},
"October": {
"type": "number"
},
"November": {
"type": "number"
},
"December": {
"type": "number"
}
}
},
"users_per_status": {
"type": "object",
"properties": {
"total": {
"type": "number"
},
"new": {
"type": "number"
},
"banned": {
"type": "number"
},
"unconfirmed": {
"type": "number"
}
}
},
"latest_registrations": {
"type": "array"
}
}
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
Non-Admin StatsGET/stats
When currently authenticated user is not and administrator. Response will contain number of activities per day for last two weeks.
Example URI
Headers
Content-Type: aplication/json
Accept: application/json
Authorization: Bearer <api token here>
200
Headers
Content-Type: application/json
Body
{
"2017-08-07": 0,
"2017-08-08": 0,
"2017-08-09": 0,
"2017-08-10": 0,
"2017-08-11": 0,
"2017-08-12": 0,
"2017-08-13": 0,
"2017-08-14": 0,
"2017-08-15": 0,
"2017-08-16": 6,
"2017-08-17": 2,
"2017-08-18": 4,
"2017-08-19": 2,
"2017-08-20": 0
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"2017-08-07": {
"type": "number"
},
"2017-08-08": {
"type": "number"
},
"2017-08-09": {
"type": "number"
},
"2017-08-10": {
"type": "number"
},
"2017-08-11": {
"type": "number"
},
"2017-08-12": {
"type": "number"
},
"2017-08-13": {
"type": "number"
},
"2017-08-14": {
"type": "number"
},
"2017-08-15": {
"type": "number"
},
"2017-08-16": {
"type": "number"
},
"2017-08-17": {
"type": "number"
},
"2017-08-18": {
"type": "number"
},
"2017-08-19": {
"type": "number"
},
"2017-08-20": {
"type": "number"
}
}
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
Profile ¶
Get Profile ¶
Get ProfileGET/me{?include}
Example URI
- include
string
(optional) Example: roleList of comma separated entities to include inside the response. Available entities are: role, country
Headers
Content-Type: aplication/json
Accept: application/json
Authorization: Bearer <api token here>
200
Headers
Content-Type: application/json
Body
{
"id": 123,
"first_name": "John",
"last_name": "Doe",
"username": "johndoe",
"email": "john.doe@gmail.com",
"phone": "+381641234567",
"avatar": "http://yourwebsite.com/users/milos-avatar.jpg",
"address": "Some random street, 123, Serbia",
"country_id": 688,
"role_id": 1,
"status": "Active",
"birthday": "1989-01-03",
"last_login": "2017-04-27 16:47:59",
"two_factor_country_code": 381,
"two_factor_phone": "6412345678",
"two_factor_options": {
"option1": 4,
"option2": "option value"
},
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "Unique user's identifier."
},
"first_name": {
"type": "string",
"description": "User's first name."
},
"last_name": {
"type": "string",
"description": "User's last name."
},
"username": {
"type": "string",
"description": "Unique user's username."
},
"email": {
"type": "string",
"description": "User's email."
},
"phone": {
"type": "string",
"description": "User's phone number."
},
"avatar": {
"type": "string",
"description": "URL of user's avatar image."
},
"address": {
"type": "string",
"description": "User's full address"
},
"country_id": {
"type": "number",
"description": "Country unique identifier."
},
"role_id": {
"type": "number",
"description": "Role unique identifier."
},
"status": {
"type": "string",
"enum": [
"Active",
"Unconfirmed",
"Banned"
],
"description": "User's status."
},
"birthday": {
"type": "string",
"description": "User's birth date."
},
"last_login": {
"type": "string",
"description": "User's last login timestamp."
},
"two_factor_country_code": {
"type": "number",
"description": "Country code used for 2FA"
},
"two_factor_phone": {
"type": "string",
"description": "Phone number used for 2FA"
},
"two_factor_options": {
"type": "object",
"properties": {
"option1": {
"type": "number"
},
"option2": {
"type": "string"
}
},
"description": "Additional 2FA options set during 2FA authentication."
},
"created_at": {
"type": "string",
"description": "Timestamp when user is created at."
},
"updated_at": {
"type": "string",
"description": "Timestamp when user is updated at."
}
}
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
Update Profile ¶
Update DetailsPATCH/me/details
You can provide even just one attribute that you want to update.
Example URI
Headers
Content-Type: aplication/json
Accept: application/json
Authorization: Bearer <api token here>
Body
{
"first_name": "Milos",
"last_name": "Stojanovic",
"birthday": "1990-10-18",
"phone": "+381641234567",
"address": "Some street 123, Nis, Serbia",
"country_id": 688
}
Schema
{
"type": "object",
"properties": {
"first_name": {
"type": "string",
"description": "User's first name."
},
"last_name": {
"type": "string",
"description": "User's last name."
},
"birthday": {
"type": "string",
"description": "User's birth date in Y-m-d format."
},
"phone": {
"type": "string",
"description": "Phone number."
},
"address": {
"type": "string",
"description": "Full address."
},
"country_id": {
"type": "number",
"description": "Unique id of desired country."
}
},
"$schema": "http://json-schema.org/draft-04/schema#"
}
200
Headers
Content-Type: application/json
Body
{
"id": 123,
"first_name": "John",
"last_name": "Doe",
"username": "johndoe",
"email": "john.doe@gmail.com",
"phone": "+381641234567",
"avatar": "http://yourwebsite.com/users/milos-avatar.jpg",
"address": "Some random street, 123, Serbia",
"country_id": 688,
"role_id": 1,
"status": "Active",
"birthday": "1989-01-03",
"last_login": "2017-04-27 16:47:59",
"two_factor_country_code": 381,
"two_factor_phone": "6412345678",
"two_factor_options": {
"option1": 4,
"option2": "option value"
},
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "Unique user's identifier."
},
"first_name": {
"type": "string",
"description": "User's first name."
},
"last_name": {
"type": "string",
"description": "User's last name."
},
"username": {
"type": "string",
"description": "Unique user's username."
},
"email": {
"type": "string",
"description": "User's email."
},
"phone": {
"type": "string",
"description": "User's phone number."
},
"avatar": {
"type": "string",
"description": "URL of user's avatar image."
},
"address": {
"type": "string",
"description": "User's full address"
},
"country_id": {
"type": "number",
"description": "Country unique identifier."
},
"role_id": {
"type": "number",
"description": "Role unique identifier."
},
"status": {
"type": "string",
"enum": [
"Active",
"Unconfirmed",
"Banned"
],
"description": "User's status."
},
"birthday": {
"type": "string",
"description": "User's birth date."
},
"last_login": {
"type": "string",
"description": "User's last login timestamp."
},
"two_factor_country_code": {
"type": "number",
"description": "Country code used for 2FA"
},
"two_factor_phone": {
"type": "string",
"description": "Phone number used for 2FA"
},
"two_factor_options": {
"type": "object",
"properties": {
"option1": {
"type": "number"
},
"option2": {
"type": "string"
}
},
"description": "Additional 2FA options set during 2FA authentication."
},
"created_at": {
"type": "string",
"description": "Timestamp when user is created at."
},
"updated_at": {
"type": "string",
"description": "Timestamp when user is updated at."
}
}
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
422
Headers
Content-Type: application/json
Body
{
"email": [
"The email field is required.",
"The email must be a valid email address."
],
"password": [
"The password field is required.",
"The password confirmation does not match."
],
}
Update Auth CredentialsPATCH/me/details/auth
Example URI
Headers
Content-Type: aplication/json
Accept: application/json
Authorization: Bearer <api token here>
Body
{
"email": "john@doe.com",
"username": "john.doe",
"password": "123123",
"password_confirmation": "123123"
}
Schema
{
"type": "object",
"properties": {
"email": {
"type": "string",
"description": "User's email address."
},
"username": {
"type": "string",
"description": "User's username."
},
"password": {
"type": "string",
"description": "New password, if you want to update it."
},
"password_confirmation": {
"type": "string",
"description": "New password confirmation."
}
},
"required": [
"email"
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
200
Headers
Content-Type: application/json
Body
{
"id": 123,
"first_name": "John",
"last_name": "Doe",
"username": "johndoe",
"email": "john.doe@gmail.com",
"phone": "+381641234567",
"avatar": "http://yourwebsite.com/users/milos-avatar.jpg",
"address": "Some random street, 123, Serbia",
"country_id": 688,
"role_id": 1,
"status": "Active",
"birthday": "1989-01-03",
"last_login": "2017-04-27 16:47:59",
"two_factor_country_code": 381,
"two_factor_phone": "6412345678",
"two_factor_options": {
"option1": 4,
"option2": "option value"
},
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "Unique user's identifier."
},
"first_name": {
"type": "string",
"description": "User's first name."
},
"last_name": {
"type": "string",
"description": "User's last name."
},
"username": {
"type": "string",
"description": "Unique user's username."
},
"email": {
"type": "string",
"description": "User's email."
},
"phone": {
"type": "string",
"description": "User's phone number."
},
"avatar": {
"type": "string",
"description": "URL of user's avatar image."
},
"address": {
"type": "string",
"description": "User's full address"
},
"country_id": {
"type": "number",
"description": "Country unique identifier."
},
"role_id": {
"type": "number",
"description": "Role unique identifier."
},
"status": {
"type": "string",
"enum": [
"Active",
"Unconfirmed",
"Banned"
],
"description": "User's status."
},
"birthday": {
"type": "string",
"description": "User's birth date."
},
"last_login": {
"type": "string",
"description": "User's last login timestamp."
},
"two_factor_country_code": {
"type": "number",
"description": "Country code used for 2FA"
},
"two_factor_phone": {
"type": "string",
"description": "Phone number used for 2FA"
},
"two_factor_options": {
"type": "object",
"properties": {
"option1": {
"type": "number"
},
"option2": {
"type": "string"
}
},
"description": "Additional 2FA options set during 2FA authentication."
},
"created_at": {
"type": "string",
"description": "Timestamp when user is created at."
},
"updated_at": {
"type": "string",
"description": "Timestamp when user is updated at."
}
}
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
422
Headers
Content-Type: application/json
Body
{
"email": [
"The email field is required.",
"The email must be a valid email address.",
"The email has already been taken."
],
"username": [
"The username has already been taken."
],
"password": [
"The password field is required.",
"The password confirmation does not match.",
"The password must be at least :min characters."
]
}
Upload Avatar ¶
Upload AvatarPUT/me/avatar
Example URI
Headers
Content-Type: image/jpeg
Accept: application/json
Authorization: Bearer <api token here>
Body
<raw_binary_image>
200
Headers
Content-Type: application/json
Body
{
"id": 123,
"first_name": "John",
"last_name": "Doe",
"username": "johndoe",
"email": "john.doe@gmail.com",
"phone": "+381641234567",
"avatar": "http://yourwebsite.com/users/milos-avatar.jpg",
"address": "Some random street, 123, Serbia",
"country_id": 688,
"role_id": 1,
"status": "Active",
"birthday": "1989-01-03",
"last_login": "2017-04-27 16:47:59",
"two_factor_country_code": 381,
"two_factor_phone": "6412345678",
"two_factor_options": {
"option1": 4,
"option2": "option value"
},
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "Unique user's identifier."
},
"first_name": {
"type": "string",
"description": "User's first name."
},
"last_name": {
"type": "string",
"description": "User's last name."
},
"username": {
"type": "string",
"description": "Unique user's username."
},
"email": {
"type": "string",
"description": "User's email."
},
"phone": {
"type": "string",
"description": "User's phone number."
},
"avatar": {
"type": "string",
"description": "URL of user's avatar image."
},
"address": {
"type": "string",
"description": "User's full address"
},
"country_id": {
"type": "number",
"description": "Country unique identifier."
},
"role_id": {
"type": "number",
"description": "Role unique identifier."
},
"status": {
"type": "string",
"enum": [
"Active",
"Unconfirmed",
"Banned"
],
"description": "User's status."
},
"birthday": {
"type": "string",
"description": "User's birth date."
},
"last_login": {
"type": "string",
"description": "User's last login timestamp."
},
"two_factor_country_code": {
"type": "number",
"description": "Country code used for 2FA"
},
"two_factor_phone": {
"type": "string",
"description": "Phone number used for 2FA"
},
"two_factor_options": {
"type": "object",
"properties": {
"option1": {
"type": "number"
},
"option2": {
"type": "string"
}
},
"description": "Additional 2FA options set during 2FA authentication."
},
"created_at": {
"type": "string",
"description": "Timestamp when user is created at."
},
"updated_at": {
"type": "string",
"description": "Timestamp when user is updated at."
}
}
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
422
Headers
Content-Type: application/json
Body
{
"file": [
"The file is required.",
"The file must be an image."
]
}
Update Avatar from External Source ¶
Update Avatar from External SourcePUT/me/avatar/external
Example URI
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Body
{
"url": "https://s.gravatar.com/avatar/20208b38fbb6018920da7d038fbc58dc?s=80"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"url": {
"type": "string",
"description": "URL to an external avatar image."
}
},
"required": [
"url"
]
}
200
Headers
Content-Type: application/json
Body
{
"id": 123,
"first_name": "John",
"last_name": "Doe",
"username": "johndoe",
"email": "john.doe@gmail.com",
"phone": "+381641234567",
"avatar": "http://yourwebsite.com/users/milos-avatar.jpg",
"address": "Some random street, 123, Serbia",
"country_id": 688,
"role_id": 1,
"status": "Active",
"birthday": "1989-01-03",
"last_login": "2017-04-27 16:47:59",
"two_factor_country_code": 381,
"two_factor_phone": "6412345678",
"two_factor_options": {
"option1": 4,
"option2": "option value"
},
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "Unique user's identifier."
},
"first_name": {
"type": "string",
"description": "User's first name."
},
"last_name": {
"type": "string",
"description": "User's last name."
},
"username": {
"type": "string",
"description": "Unique user's username."
},
"email": {
"type": "string",
"description": "User's email."
},
"phone": {
"type": "string",
"description": "User's phone number."
},
"avatar": {
"type": "string",
"description": "URL of user's avatar image."
},
"address": {
"type": "string",
"description": "User's full address"
},
"country_id": {
"type": "number",
"description": "Country unique identifier."
},
"role_id": {
"type": "number",
"description": "Role unique identifier."
},
"status": {
"type": "string",
"enum": [
"Active",
"Unconfirmed",
"Banned"
],
"description": "User's status."
},
"birthday": {
"type": "string",
"description": "User's birth date."
},
"last_login": {
"type": "string",
"description": "User's last login timestamp."
},
"two_factor_country_code": {
"type": "number",
"description": "Country code used for 2FA"
},
"two_factor_phone": {
"type": "string",
"description": "Phone number used for 2FA"
},
"two_factor_options": {
"type": "object",
"properties": {
"option1": {
"type": "number"
},
"option2": {
"type": "string"
}
},
"description": "Additional 2FA options set during 2FA authentication."
},
"created_at": {
"type": "string",
"description": "Timestamp when user is created at."
},
"updated_at": {
"type": "string",
"description": "Timestamp when user is updated at."
}
}
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
422
Headers
Content-Type: application/json
Body
{
"url": [
"The url field is required.",
"The url format is invalid."
]
}
Sessions ¶
Getting active session for currently authenticated user is only possible if database session driver is used. If not, 404 response will be returned.
Get SessionsGET/me/sessions
Example URI
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
200
Headers
Content-Type: application/json
Body
{
"id": "uFfF2KPoq7XZAOPLhen5ayOArawyzGitjoFIdogV",
"user_id": 1,
"ip_address": "123.45.67.890",
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36",
"browser": "Chrome",
"platform": "OS X",
"device": "Macintosh",
"last_activity": "2017-08-18 14:30:09"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Session unique identifier."
},
"user_id": {
"type": [
"number",
"null"
],
"description": "Unique identifier for user who owns the session."
},
"ip_address": {
"type": "string",
"description": "IP address assigned to a session."
},
"user_agent": {
"type": "string",
"description": "Full user agent/browser information."
},
"browser": {
"type": "string",
"description": "Browser name."
},
"platform": {
"type": "string",
"description": "Platform name."
},
"device": {
"type": "string",
"description": "Device name."
},
"last_activity": {
"type": "string",
"description": "Date and time when user last time accessed the website."
}
}
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
404
Headers
Content-Type: application/json
Body
{
"error": "Resource not found."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Resource not found."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
422
Headers
Content-Type: application/json
Body
{
"url": [
"The url field is required.",
"The url format is invalid."
]
}
Two-Factor Authentication ¶
EnablePUT/me/2fa
Example URI
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Body
{
"country_code": 381,
"phone_number": 6412345678
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"country_code": {
"type": "number",
"description": "ISO 3166-1 country code."
},
"phone_number": {
"type": "number",
"description": "Phone number without country code part."
}
},
"required": [
"country_code",
"phone_number"
]
}
200
Headers
Content-Type: application/json
Body
{
"id": 123,
"first_name": "John",
"last_name": "Doe",
"username": "johndoe",
"email": "john.doe@gmail.com",
"phone": "+381641234567",
"avatar": "http://yourwebsite.com/users/milos-avatar.jpg",
"address": "Some random street, 123, Serbia",
"country_id": 688,
"role_id": 1,
"status": "Active",
"birthday": "1989-01-03",
"last_login": "2017-04-27 16:47:59",
"two_factor_country_code": 381,
"two_factor_phone": "6412345678",
"two_factor_options": {
"option1": 4,
"option2": "option value"
},
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "Unique user's identifier."
},
"first_name": {
"type": "string",
"description": "User's first name."
},
"last_name": {
"type": "string",
"description": "User's last name."
},
"username": {
"type": "string",
"description": "Unique user's username."
},
"email": {
"type": "string",
"description": "User's email."
},
"phone": {
"type": "string",
"description": "User's phone number."
},
"avatar": {
"type": "string",
"description": "URL of user's avatar image."
},
"address": {
"type": "string",
"description": "User's full address"
},
"country_id": {
"type": "number",
"description": "Country unique identifier."
},
"role_id": {
"type": "number",
"description": "Role unique identifier."
},
"status": {
"type": "string",
"enum": [
"Active",
"Unconfirmed",
"Banned"
],
"description": "User's status."
},
"birthday": {
"type": "string",
"description": "User's birth date."
},
"last_login": {
"type": "string",
"description": "User's last login timestamp."
},
"two_factor_country_code": {
"type": "number",
"description": "Country code used for 2FA"
},
"two_factor_phone": {
"type": "string",
"description": "Phone number used for 2FA"
},
"two_factor_options": {
"type": "object",
"properties": {
"option1": {
"type": "number"
},
"option2": {
"type": "string"
}
},
"description": "Additional 2FA options set during 2FA authentication."
},
"created_at": {
"type": "string",
"description": "Timestamp when user is created at."
},
"updated_at": {
"type": "string",
"description": "Timestamp when user is updated at."
}
}
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
403
Headers
Content-Type: application/json
Body
{
"error": "Forbidden."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Forbidden."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
404
Headers
Content-Type: application/json
Body
{
"error": "Resource not found."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Resource not found."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
422
Headers
Content-Type: application/json
Body
{
"error": "2FA is already enabled for this user."
}
DisableDELETE/me/2fa
Example URI
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
200
Headers
Content-Type: application/json
Body
{
"id": 123,
"first_name": "John",
"last_name": "Doe",
"username": "johndoe",
"email": "john.doe@gmail.com",
"phone": "+381641234567",
"avatar": "http://yourwebsite.com/users/milos-avatar.jpg",
"address": "Some random street, 123, Serbia",
"country_id": 688,
"role_id": 1,
"status": "Active",
"birthday": "1989-01-03",
"last_login": "2017-04-27 16:47:59",
"two_factor_country_code": "null",
"two_factor_phone": "null",
"two_factor_options": "null",
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "Unique user's identifier."
},
"first_name": {
"type": "string",
"description": "User's first name."
},
"last_name": {
"type": "string",
"description": "User's last name."
},
"username": {
"type": "string",
"description": "Unique user's username."
},
"email": {
"type": "string",
"description": "User's email."
},
"phone": {
"type": "string",
"description": "User's phone number."
},
"avatar": {
"type": "string",
"description": "URL of user's avatar image."
},
"address": {
"type": "string",
"description": "User's full address"
},
"country_id": {
"type": "number",
"description": "Country unique identifier."
},
"role_id": {
"type": "number",
"description": "Role unique identifier."
},
"status": {
"type": "string",
"enum": [
"Active",
"Unconfirmed",
"Banned"
],
"description": "User's status."
},
"birthday": {
"type": "string",
"description": "User's birth date."
},
"last_login": {
"type": "string",
"description": "User's last login timestamp."
},
"two_factor_country_code": {
"type": [
"string",
"null"
],
"description": "Country code used for 2FA"
},
"two_factor_phone": {
"type": "string",
"description": "Phone number used for 2FA"
},
"two_factor_options": {
"type": "string",
"description": "Additional 2FA options set during 2FA authentication."
},
"created_at": {
"type": "string",
"description": "Timestamp when user is created at."
},
"updated_at": {
"type": "string",
"description": "Timestamp when user is updated at."
}
}
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
403
Headers
Content-Type: application/json
Body
{
"error": "Forbidden."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Forbidden."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
404
Headers
Content-Type: application/json
Body
{
"error": "Resource not found."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Resource not found."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
422
Headers
Content-Type: application/json
Body
{
"error": "2FA is not enabled for this user."
}
Users ¶
User Collection ¶
Paginate All UsersGET/users{?page,per_page,search,status,include}
Example URI
- page
number
(optional)Page number we want to view.
- per_page
number
(optional)Number of items per page.
- search
string
(optional)Search tearm that we want to filter users by.
- status
string
(optional)Status that we want to filter users by. Available values are:
-
Active
-
Unconfirmed
-
Banned
-
- include
string
(optional) Example: countryList of comma separated entities to include inside the response. Available entities are: role, country
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
200
Headers
Content-Type: application/json
Body
{
"data": [
{
"id": 123,
"first_name": "John",
"last_name": "Doe",
"username": "johndoe",
"email": "john.doe@gmail.com",
"phone": "+381641234567",
"avatar": "http://yourwebsite.com/users/milos-avatar.jpg",
"address": "Some random street, 123, Serbia",
"country_id": 688,
"role_id": 1,
"status": "Active",
"birthday": "1989-01-03",
"last_login": "2017-04-27 16:47:59",
"two_factor_country_code": 381,
"two_factor_phone": "6412345678",
"two_factor_options": {
"option1": 4,
"option2": "option value"
},
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
},
"..."
],
"meta": {
"total": 100,
"per_page": 20,
"current_page": 1,
"last_page": 5,
"next_page_url": "/api/users?page=2",
"prev_page_url": "null",
"from": 1,
"to": 20
}
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"data": {
"type": "array"
},
"meta": {
"type": "object",
"properties": {
"total": {
"type": "number",
"description": "Total number of items available."
},
"per_page": {
"type": "number",
"description": "Number of items per page."
},
"current_page": {
"type": "number",
"description": "Current page number."
},
"last_page": {
"type": "number",
"description": "Last page available"
},
"next_page_url": {
"type": [
"string",
"null"
],
"description": "URL to next page if available, `null` otherwise."
},
"prev_page_url": {
"type": [
"string",
"null"
],
"description": "URL to previous page if available, `null` otherwise"
},
"from": {
"type": "number",
"description": "Index for first item inside the collection."
},
"to": {
"type": "number",
"description": "Index for last item inside the collection."
}
}
}
}
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
403
Headers
Content-Type: application/json
Body
{
"error": "Forbidden."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Forbidden."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
Create a UserPOST/users
Example URI
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Body
{
"email": "john.doe@gmail.com",
"password": "123123",
"password_confirmation": "123123",
"role_id": 1,
"username": "johndoe",
"first_name": "John",
"last_name": "Doe",
"phone": "+381641234567",
"address": "Some random street, 123, Serbia",
"country_id": 688,
"birthday": "1989-01-03"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"email": {
"type": "string",
"description": "User's email."
},
"password": {
"type": "string",
"description": "Users password."
},
"password_confirmation": {
"type": "string",
"description": "Password confirmation."
},
"role_id": {
"type": "number",
"description": "Role unique identifier."
},
"username": {
"type": "string",
"description": "Unique user's username."
},
"first_name": {
"type": "string",
"description": "User's first name."
},
"last_name": {
"type": "string",
"description": "User's last name."
},
"phone": {
"type": "string",
"description": "User's phone number."
},
"address": {
"type": "string",
"description": "User's full address"
},
"country_id": {
"type": "number",
"description": "Country unique identifier."
},
"birthday": {
"type": "string",
"description": "User's birth date."
}
},
"required": [
"email",
"password",
"password_confirmation",
"role_id"
]
}
201
Headers
Content-Type: application/json
Body
{
"id": 123,
"first_name": "John",
"last_name": "Doe",
"username": "johndoe",
"email": "john.doe@gmail.com",
"phone": "+381641234567",
"avatar": "http://yourwebsite.com/users/milos-avatar.jpg",
"address": "Some random street, 123, Serbia",
"country_id": 688,
"role_id": 1,
"status": "Active",
"birthday": "1989-01-03",
"last_login": "2017-04-27 16:47:59",
"two_factor_country_code": 381,
"two_factor_phone": "6412345678",
"two_factor_options": {
"option1": 4,
"option2": "option value"
},
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "Unique user's identifier."
},
"first_name": {
"type": "string",
"description": "User's first name."
},
"last_name": {
"type": "string",
"description": "User's last name."
},
"username": {
"type": "string",
"description": "Unique user's username."
},
"email": {
"type": "string",
"description": "User's email."
},
"phone": {
"type": "string",
"description": "User's phone number."
},
"avatar": {
"type": "string",
"description": "URL of user's avatar image."
},
"address": {
"type": "string",
"description": "User's full address"
},
"country_id": {
"type": "number",
"description": "Country unique identifier."
},
"role_id": {
"type": "number",
"description": "Role unique identifier."
},
"status": {
"type": "string",
"enum": [
"Active",
"Unconfirmed",
"Banned"
],
"description": "User's status."
},
"birthday": {
"type": "string",
"description": "User's birth date."
},
"last_login": {
"type": "string",
"description": "User's last login timestamp."
},
"two_factor_country_code": {
"type": "number",
"description": "Country code used for 2FA"
},
"two_factor_phone": {
"type": "string",
"description": "Phone number used for 2FA"
},
"two_factor_options": {
"type": "object",
"properties": {
"option1": {
"type": "number"
},
"option2": {
"type": "string"
}
},
"description": "Additional 2FA options set during 2FA authentication."
},
"created_at": {
"type": "string",
"description": "Timestamp when user is created at."
},
"updated_at": {
"type": "string",
"description": "Timestamp when user is updated at."
}
}
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
403
Headers
Content-Type: application/json
Body
{
"error": "Forbidden."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Forbidden."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
422
Headers
Content-Type: application/json
Body
{
"email": [
"The email field is required.",
"The email must be a valid email address.",
"The email has already been taken."
],
"username": [
"The username has already been taken."
],
"password": [
"The password field is required.",
"The password confirmation does not match.",
"The password must be at least :min characters."
],
"birthday": [
"The birthday is not a valid date."
],
"role_id": [
"The role id field is required.",
"The selected role id is invalid."
],
"country_id": [
"The selected country id is invalid."
],
}
Single User ¶
Get DetailsGET/users/{?include}
Example URI
- include
string
(optional) Example: countryList of comma separated entities to include inside the response. Available entities are: role, country
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
200
Headers
Content-Type: application/json
Body
{
"id": 123,
"first_name": "John",
"last_name": "Doe",
"username": "johndoe",
"email": "john.doe@gmail.com",
"phone": "+381641234567",
"avatar": "http://yourwebsite.com/users/milos-avatar.jpg",
"address": "Some random street, 123, Serbia",
"country_id": 688,
"role_id": 1,
"status": "Active",
"birthday": "1989-01-03",
"last_login": "2017-04-27 16:47:59",
"two_factor_country_code": 381,
"two_factor_phone": "6412345678",
"two_factor_options": {
"option1": 4,
"option2": "option value"
},
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "Unique user's identifier."
},
"first_name": {
"type": "string",
"description": "User's first name."
},
"last_name": {
"type": "string",
"description": "User's last name."
},
"username": {
"type": "string",
"description": "Unique user's username."
},
"email": {
"type": "string",
"description": "User's email."
},
"phone": {
"type": "string",
"description": "User's phone number."
},
"avatar": {
"type": "string",
"description": "URL of user's avatar image."
},
"address": {
"type": "string",
"description": "User's full address"
},
"country_id": {
"type": "number",
"description": "Country unique identifier."
},
"role_id": {
"type": "number",
"description": "Role unique identifier."
},
"status": {
"type": "string",
"enum": [
"Active",
"Unconfirmed",
"Banned"
],
"description": "User's status."
},
"birthday": {
"type": "string",
"description": "User's birth date."
},
"last_login": {
"type": "string",
"description": "User's last login timestamp."
},
"two_factor_country_code": {
"type": "number",
"description": "Country code used for 2FA"
},
"two_factor_phone": {
"type": "string",
"description": "Phone number used for 2FA"
},
"two_factor_options": {
"type": "object",
"properties": {
"option1": {
"type": "number"
},
"option2": {
"type": "string"
}
},
"description": "Additional 2FA options set during 2FA authentication."
},
"created_at": {
"type": "string",
"description": "Timestamp when user is created at."
},
"updated_at": {
"type": "string",
"description": "Timestamp when user is updated at."
}
}
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
403
Headers
Content-Type: application/json
Body
{
"error": "Forbidden."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Forbidden."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
404
Headers
Content-Type: application/json
Body
{
"error": "Resource not found."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Resource not found."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
UpdatePUT/users/{id}
You don’t need to send all request attributes. You can just send those attributes that you want to update.
Example URI
- id
number
(required) Example: 123Unique user identifier.
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Body
{
"email": "john.doe@gmail.com",
"password": "123123",
"password_confirmation": "123123",
"role_id": 1,
"username": "johndoe",
"first_name": "John",
"last_name": "Doe",
"phone": "+381641234567",
"address": "Some random street, 123, Serbia",
"country_id": 688,
"birthday": "1989-01-03",
"status": "Active"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"email": {
"type": "string",
"description": "User's email."
},
"password": {
"type": "string",
"description": "Users password."
},
"password_confirmation": {
"type": "string",
"description": "Password confirmation."
},
"role_id": {
"type": "number",
"description": "Role unique identifier."
},
"username": {
"type": "string",
"description": "Unique user's username."
},
"first_name": {
"type": "string",
"description": "User's first name."
},
"last_name": {
"type": "string",
"description": "User's last name."
},
"phone": {
"type": "string",
"description": "User's phone number."
},
"address": {
"type": "string",
"description": "User's full address"
},
"country_id": {
"type": "number",
"description": "Country unique identifier."
},
"birthday": {
"type": "string",
"description": "User's birth date."
},
"status": {
"type": "string",
"enum": [
"Active",
"Unconfirmed",
"Banned"
],
"description": "User status"
}
}
}
201
Headers
Content-Type: application/json
Body
{
"id": 123,
"first_name": "John",
"last_name": "Doe",
"username": "johndoe",
"email": "john.doe@gmail.com",
"phone": "+381641234567",
"avatar": "http://yourwebsite.com/users/milos-avatar.jpg",
"address": "Some random street, 123, Serbia",
"country_id": 688,
"role_id": 1,
"status": "Active",
"birthday": "1989-01-03",
"last_login": "2017-04-27 16:47:59",
"two_factor_country_code": 381,
"two_factor_phone": "6412345678",
"two_factor_options": {
"option1": 4,
"option2": "option value"
},
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "Unique user's identifier."
},
"first_name": {
"type": "string",
"description": "User's first name."
},
"last_name": {
"type": "string",
"description": "User's last name."
},
"username": {
"type": "string",
"description": "Unique user's username."
},
"email": {
"type": "string",
"description": "User's email."
},
"phone": {
"type": "string",
"description": "User's phone number."
},
"avatar": {
"type": "string",
"description": "URL of user's avatar image."
},
"address": {
"type": "string",
"description": "User's full address"
},
"country_id": {
"type": "number",
"description": "Country unique identifier."
},
"role_id": {
"type": "number",
"description": "Role unique identifier."
},
"status": {
"type": "string",
"enum": [
"Active",
"Unconfirmed",
"Banned"
],
"description": "User's status."
},
"birthday": {
"type": "string",
"description": "User's birth date."
},
"last_login": {
"type": "string",
"description": "User's last login timestamp."
},
"two_factor_country_code": {
"type": "number",
"description": "Country code used for 2FA"
},
"two_factor_phone": {
"type": "string",
"description": "Phone number used for 2FA"
},
"two_factor_options": {
"type": "object",
"properties": {
"option1": {
"type": "number"
},
"option2": {
"type": "string"
}
},
"description": "Additional 2FA options set during 2FA authentication."
},
"created_at": {
"type": "string",
"description": "Timestamp when user is created at."
},
"updated_at": {
"type": "string",
"description": "Timestamp when user is updated at."
}
}
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
403
Headers
Content-Type: application/json
Body
{
"error": "Forbidden."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Forbidden."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
404
Headers
Content-Type: application/json
Body
{
"error": "Resource not found."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Resource not found."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
422
Headers
Content-Type: application/json
Body
{
"email": [
"The email must be a valid email address.",
"The email has already been taken."
],
"username": [
"The username has already been taken."
],
"password": [
"The password confirmation does not match.",
"The password must be at least :min characters."
],
"birthday": [
"The birthday is not a valid date."
],
"role_id": [
"The selected role id is invalid."
],
"country_id": [
"The selected country id is invalid."
],
}
DeleteDELETE/users/{id}
Example URI
- id
number
(required) Example: 123Unique user identifier.
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
200
Headers
Content-Type: application/json
Body
{
"success": true
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"success": {
"type": "boolean"
}
}
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
403
Headers
Content-Type: application/json
Body
{
"error": "Forbidden."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Forbidden."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
404
Headers
Content-Type: application/json
Body
{
"error": "Resource not found."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Resource not found."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
Upload AvatarPUT/users/avatar
Example URI
Headers
Content-Type: image/jpeg
Accept: application/json
Authorization: Bearer <api token here>
Body
<raw_binary_image>
200
Headers
Content-Type: application/json
Body
{
"id": 123,
"first_name": "John",
"last_name": "Doe",
"username": "johndoe",
"email": "john.doe@gmail.com",
"phone": "+381641234567",
"avatar": "http://yourwebsite.com/users/milos-avatar.jpg",
"address": "Some random street, 123, Serbia",
"country_id": 688,
"role_id": 1,
"status": "Active",
"birthday": "1989-01-03",
"last_login": "2017-04-27 16:47:59",
"two_factor_country_code": 381,
"two_factor_phone": "6412345678",
"two_factor_options": {
"option1": 4,
"option2": "option value"
},
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "Unique user's identifier."
},
"first_name": {
"type": "string",
"description": "User's first name."
},
"last_name": {
"type": "string",
"description": "User's last name."
},
"username": {
"type": "string",
"description": "Unique user's username."
},
"email": {
"type": "string",
"description": "User's email."
},
"phone": {
"type": "string",
"description": "User's phone number."
},
"avatar": {
"type": "string",
"description": "URL of user's avatar image."
},
"address": {
"type": "string",
"description": "User's full address"
},
"country_id": {
"type": "number",
"description": "Country unique identifier."
},
"role_id": {
"type": "number",
"description": "Role unique identifier."
},
"status": {
"type": "string",
"enum": [
"Active",
"Unconfirmed",
"Banned"
],
"description": "User's status."
},
"birthday": {
"type": "string",
"description": "User's birth date."
},
"last_login": {
"type": "string",
"description": "User's last login timestamp."
},
"two_factor_country_code": {
"type": "number",
"description": "Country code used for 2FA"
},
"two_factor_phone": {
"type": "string",
"description": "Phone number used for 2FA"
},
"two_factor_options": {
"type": "object",
"properties": {
"option1": {
"type": "number"
},
"option2": {
"type": "string"
}
},
"description": "Additional 2FA options set during 2FA authentication."
},
"created_at": {
"type": "string",
"description": "Timestamp when user is created at."
},
"updated_at": {
"type": "string",
"description": "Timestamp when user is updated at."
}
}
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
403
Headers
Content-Type: application/json
Body
{
"error": "Forbidden."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Forbidden."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
404
Headers
Content-Type: application/json
Body
{
"error": "Resource not found."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Resource not found."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
422
Headers
Content-Type: application/json
Body
{
"file": [
"The file is required.",
"The file must be an image."
]
}
Update Avatar from External SourcePUT/users/avatar/external
Example URI
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
200
Headers
Content-Type: application/json
Body
{
"id": 123,
"first_name": "John",
"last_name": "Doe",
"username": "johndoe",
"email": "john.doe@gmail.com",
"phone": "+381641234567",
"avatar": "http://yourwebsite.com/users/milos-avatar.jpg",
"address": "Some random street, 123, Serbia",
"country_id": 688,
"role_id": 1,
"status": "Active",
"birthday": "1989-01-03",
"last_login": "2017-04-27 16:47:59",
"two_factor_country_code": 381,
"two_factor_phone": "6412345678",
"two_factor_options": {
"option1": 4,
"option2": "option value"
},
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "Unique user's identifier."
},
"first_name": {
"type": "string",
"description": "User's first name."
},
"last_name": {
"type": "string",
"description": "User's last name."
},
"username": {
"type": "string",
"description": "Unique user's username."
},
"email": {
"type": "string",
"description": "User's email."
},
"phone": {
"type": "string",
"description": "User's phone number."
},
"avatar": {
"type": "string",
"description": "URL of user's avatar image."
},
"address": {
"type": "string",
"description": "User's full address"
},
"country_id": {
"type": "number",
"description": "Country unique identifier."
},
"role_id": {
"type": "number",
"description": "Role unique identifier."
},
"status": {
"type": "string",
"enum": [
"Active",
"Unconfirmed",
"Banned"
],
"description": "User's status."
},
"birthday": {
"type": "string",
"description": "User's birth date."
},
"last_login": {
"type": "string",
"description": "User's last login timestamp."
},
"two_factor_country_code": {
"type": "number",
"description": "Country code used for 2FA"
},
"two_factor_phone": {
"type": "string",
"description": "Phone number used for 2FA"
},
"two_factor_options": {
"type": "object",
"properties": {
"option1": {
"type": "number"
},
"option2": {
"type": "string"
}
},
"description": "Additional 2FA options set during 2FA authentication."
},
"created_at": {
"type": "string",
"description": "Timestamp when user is created at."
},
"updated_at": {
"type": "string",
"description": "Timestamp when user is updated at."
}
}
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
403
Headers
Content-Type: application/json
Body
{
"error": "Forbidden."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Forbidden."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
404
Headers
Content-Type: application/json
Body
{
"error": "Resource not found."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Resource not found."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
422
Headers
Content-Type: application/json
Body
{
"url": [
"The url field is required.",
"The url format is invalid."
]
}
Remove AvatarDELETE/users/avatar
Example URI
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
200
Headers
Content-Type: application/json
Body
{
"id": 123,
"first_name": "John",
"last_name": "Doe",
"username": "johndoe",
"email": "john.doe@gmail.com",
"phone": "+381641234567",
"avatar": "null",
"address": "Some random street, 123, Serbia",
"country_id": 688,
"role_id": 1,
"status": "Active",
"birthday": "1989-01-03",
"last_login": "2017-04-27 16:47:59",
"two_factor_country_code": 381,
"two_factor_phone": "6412345678",
"two_factor_options": {
"option1": 4,
"option2": "option value"
},
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "Unique user's identifier."
},
"first_name": {
"type": "string",
"description": "User's first name."
},
"last_name": {
"type": "string",
"description": "User's last name."
},
"username": {
"type": "string",
"description": "Unique user's username."
},
"email": {
"type": "string",
"description": "User's email."
},
"phone": {
"type": "string",
"description": "User's phone number."
},
"avatar": {
"type": "string",
"description": "URL of user's avatar image."
},
"address": {
"type": "string",
"description": "User's full address"
},
"country_id": {
"type": "number",
"description": "Country unique identifier."
},
"role_id": {
"type": "number",
"description": "Role unique identifier."
},
"status": {
"type": "string",
"enum": [
"Active",
"Unconfirmed",
"Banned"
],
"description": "User's status."
},
"birthday": {
"type": "string",
"description": "User's birth date."
},
"last_login": {
"type": "string",
"description": "User's last login timestamp."
},
"two_factor_country_code": {
"type": "number",
"description": "Country code used for 2FA"
},
"two_factor_phone": {
"type": "string",
"description": "Phone number used for 2FA"
},
"two_factor_options": {
"type": "object",
"properties": {
"option1": {
"type": "number"
},
"option2": {
"type": "string"
}
},
"description": "Additional 2FA options set during 2FA authentication."
},
"created_at": {
"type": "string",
"description": "Timestamp when user is created at."
},
"updated_at": {
"type": "string",
"description": "Timestamp when user is updated at."
}
}
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
403
Headers
Content-Type: application/json
Body
{
"error": "Forbidden."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Forbidden."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
404
Headers
Content-Type: application/json
Body
{
"error": "Resource not found."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Resource not found."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
Enable Two-Factor AuthenticationPUT/users/2fa
Example URI
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Body
{
"country_code": 381,
"phone_number": 6412345678
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"country_code": {
"type": "number",
"description": "ISO 3166-1 country code."
},
"phone_number": {
"type": "number",
"description": "Phone number without country code part."
}
},
"required": [
"country_code",
"phone_number"
]
}
200
Headers
Content-Type: application/json
Body
{
"id": 123,
"first_name": "John",
"last_name": "Doe",
"username": "johndoe",
"email": "john.doe@gmail.com",
"phone": "+381641234567",
"avatar": "http://yourwebsite.com/users/milos-avatar.jpg",
"address": "Some random street, 123, Serbia",
"country_id": 688,
"role_id": 1,
"status": "Active",
"birthday": "1989-01-03",
"last_login": "2017-04-27 16:47:59",
"two_factor_country_code": 381,
"two_factor_phone": "6412345678",
"two_factor_options": {
"option1": 4,
"option2": "option value"
},
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "Unique user's identifier."
},
"first_name": {
"type": "string",
"description": "User's first name."
},
"last_name": {
"type": "string",
"description": "User's last name."
},
"username": {
"type": "string",
"description": "Unique user's username."
},
"email": {
"type": "string",
"description": "User's email."
},
"phone": {
"type": "string",
"description": "User's phone number."
},
"avatar": {
"type": "string",
"description": "URL of user's avatar image."
},
"address": {
"type": "string",
"description": "User's full address"
},
"country_id": {
"type": "number",
"description": "Country unique identifier."
},
"role_id": {
"type": "number",
"description": "Role unique identifier."
},
"status": {
"type": "string",
"enum": [
"Active",
"Unconfirmed",
"Banned"
],
"description": "User's status."
},
"birthday": {
"type": "string",
"description": "User's birth date."
},
"last_login": {
"type": "string",
"description": "User's last login timestamp."
},
"two_factor_country_code": {
"type": "number",
"description": "Country code used for 2FA"
},
"two_factor_phone": {
"type": "string",
"description": "Phone number used for 2FA"
},
"two_factor_options": {
"type": "object",
"properties": {
"option1": {
"type": "number"
},
"option2": {
"type": "string"
}
},
"description": "Additional 2FA options set during 2FA authentication."
},
"created_at": {
"type": "string",
"description": "Timestamp when user is created at."
},
"updated_at": {
"type": "string",
"description": "Timestamp when user is updated at."
}
}
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
403
Headers
Content-Type: application/json
Body
{
"error": "Forbidden."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Forbidden."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
404
Headers
Content-Type: application/json
Body
{
"error": "Resource not found."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Resource not found."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
422
Headers
Content-Type: application/json
Body
{
"error": "2FA is already enabled for this user."
}
Disable Two-Factor AuthenticationDELETE/users/2fa
Example URI
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
200
Headers
Content-Type: application/json
Body
{
"id": 123,
"first_name": "John",
"last_name": "Doe",
"username": "johndoe",
"email": "john.doe@gmail.com",
"phone": "+381641234567",
"avatar": "http://yourwebsite.com/users/milos-avatar.jpg",
"address": "Some random street, 123, Serbia",
"country_id": 688,
"role_id": 1,
"status": "Active",
"birthday": "1989-01-03",
"last_login": "2017-04-27 16:47:59",
"two_factor_country_code": "null",
"two_factor_phone": "null",
"two_factor_options": "null",
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "Unique user's identifier."
},
"first_name": {
"type": "string",
"description": "User's first name."
},
"last_name": {
"type": "string",
"description": "User's last name."
},
"username": {
"type": "string",
"description": "Unique user's username."
},
"email": {
"type": "string",
"description": "User's email."
},
"phone": {
"type": "string",
"description": "User's phone number."
},
"avatar": {
"type": "string",
"description": "URL of user's avatar image."
},
"address": {
"type": "string",
"description": "User's full address"
},
"country_id": {
"type": "number",
"description": "Country unique identifier."
},
"role_id": {
"type": "number",
"description": "Role unique identifier."
},
"status": {
"type": "string",
"enum": [
"Active",
"Unconfirmed",
"Banned"
],
"description": "User's status."
},
"birthday": {
"type": "string",
"description": "User's birth date."
},
"last_login": {
"type": "string",
"description": "User's last login timestamp."
},
"two_factor_country_code": {
"type": [
"string",
"null"
],
"description": "Country code used for 2FA"
},
"two_factor_phone": {
"type": "string",
"description": "Phone number used for 2FA"
},
"two_factor_options": {
"type": "string",
"description": "Additional 2FA options set during 2FA authentication."
},
"created_at": {
"type": "string",
"description": "Timestamp when user is created at."
},
"updated_at": {
"type": "string",
"description": "Timestamp when user is updated at."
}
}
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
403
Headers
Content-Type: application/json
Body
{
"error": "Forbidden."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Forbidden."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
404
Headers
Content-Type: application/json
Body
{
"error": "Resource not found."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Resource not found."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
422
Headers
Content-Type: application/json
Body
{
"error": "2FA is not enabled for this user."
}
Paginate Activities For UserGET/users/activity{?page,per_page,search}
Example URI
- page
number
(optional)Page number we want to view.
- per_page
number
(optional)Number of items per page.
- search
string
(optional)Search tearm that we want to filter activities by.
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
200
Headers
Content-Type: application/json
Body
{
"data": [
{
"id": 1,
"user_id": 123,
"ip_address": "123.45.67.890",
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36",
"browser": "Chrome",
"platform": "OS X",
"device": "Macintosh",
"description": "Logged in.",
"created_at": "2017-08-16 10:30:22"
},
"..."
],
"meta": {
"total": 100,
"per_page": 20,
"current_page": 1,
"last_page": 5,
"next_page_url": "/api/users?page=2",
"prev_page_url": "null",
"from": 1,
"to": 20
}
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"data": {
"type": "array"
},
"meta": {
"type": "object",
"properties": {
"total": {
"type": "number",
"description": "Total number of items available."
},
"per_page": {
"type": "number",
"description": "Number of items per page."
},
"current_page": {
"type": "number",
"description": "Current page number."
},
"last_page": {
"type": "number",
"description": "Last page available"
},
"next_page_url": {
"type": [
"string",
"null"
],
"description": "URL to next page if available, `null` otherwise."
},
"prev_page_url": {
"type": [
"string",
"null"
],
"description": "URL to previous page if available, `null` otherwise"
},
"from": {
"type": "number",
"description": "Index for first item inside the collection."
},
"to": {
"type": "number",
"description": "Index for last item inside the collection."
}
}
}
}
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
403
Headers
Content-Type: application/json
Body
{
"error": "Forbidden."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Forbidden."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
404
Headers
Content-Type: application/json
Body
{
"error": "Resource not found."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Resource not found."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
Get Active SessionsGET/users/sessions
Example URI
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
200
Headers
Content-Type: application/json
Body
[
{
"id": "uFfF2KPoq7XZAOPLhen5ayOArawyzGitjoFIdogV",
"user_id": 1,
"ip_address": "123.45.67.890",
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36",
"browser": "Chrome",
"platform": "OS X",
"device": "Macintosh",
"last_activity": "2017-08-18 14:30:09"
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "array"
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
403
Headers
Content-Type: application/json
Body
{
"error": "Forbidden."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Forbidden."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
404
Headers
Content-Type: application/json
Body
{
"error": "Resource not found."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Resource not found."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
Sessions ¶
Single Session ¶
Get InfoGET/sessions/{id}
Example URI
- id
string
(required) Example: uFfF2KPoq7XZAOPLhen5ayOArawyzGitjoFIdogVUnique session identifier.
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
200
Headers
Content-Type: application/json
Body
{
"id": "uFfF2KPoq7XZAOPLhen5ayOArawyzGitjoFIdogV",
"user_id": 1,
"ip_address": "123.45.67.890",
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36",
"browser": "Chrome",
"platform": "OS X",
"device": "Macintosh",
"last_activity": "2017-08-18 14:30:09"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Session unique identifier."
},
"user_id": {
"type": [
"number",
"null"
],
"description": "Unique identifier for user who owns the session."
},
"ip_address": {
"type": "string",
"description": "IP address assigned to a session."
},
"user_agent": {
"type": "string",
"description": "Full user agent/browser information."
},
"browser": {
"type": "string",
"description": "Browser name."
},
"platform": {
"type": "string",
"description": "Platform name."
},
"device": {
"type": "string",
"description": "Device name."
},
"last_activity": {
"type": "string",
"description": "Date and time when user last time accessed the website."
}
}
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
403
Headers
Content-Type: application/json
Body
{
"error": "Forbidden."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Forbidden."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
404
Headers
Content-Type: application/json
Body
{
"error": "Resource not found."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Resource not found."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
InvalidateDELETE/sessions/{id}
Example URI
- id
string
(required) Example: uFfF2KPoq7XZAOPLhen5ayOArawyzGitjoFIdogVUnique session identifier.
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
200
Headers
Content-Type: application/json
Body
{
"success": true
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"success": {
"type": "boolean"
}
}
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
403
Headers
Content-Type: application/json
Body
{
"error": "Forbidden."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Forbidden."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
404
Headers
Content-Type: application/json
Body
{
"error": "Resource not found."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Resource not found."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
Activity ¶
Activity Colleciton ¶
Paginate ActivitiesGET/activity{?include,page,per_page,search}
Example URI
- page
number
(optional)Page number we want to view.
- per_page
number
(optional)Number of items per page.
- search
string
(optional)Search tearm that we want to filter activities by.
- include
string
(optional) Example: userList of comma separated entities to include inside the response. Available entities are:
- user
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
200
Headers
Content-Type: application/json
Body
{
"data": [
{
"id": 1,
"user_id": 123,
"ip_address": "123.45.67.890",
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36",
"browser": "Chrome",
"platform": "OS X",
"device": "Macintosh",
"description": "Logged in.",
"created_at": "2017-08-16 10:30:22"
},
"..."
],
"meta": {
"total": 100,
"per_page": 20,
"current_page": 1,
"last_page": 5,
"next_page_url": "/api/users?page=2",
"prev_page_url": "null",
"from": 1,
"to": 20
}
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"data": {
"type": "array"
},
"meta": {
"type": "object",
"properties": {
"total": {
"type": "number",
"description": "Total number of items available."
},
"per_page": {
"type": "number",
"description": "Number of items per page."
},
"current_page": {
"type": "number",
"description": "Current page number."
},
"last_page": {
"type": "number",
"description": "Last page available"
},
"next_page_url": {
"type": [
"string",
"null"
],
"description": "URL to next page if available, `null` otherwise."
},
"prev_page_url": {
"type": [
"string",
"null"
],
"description": "URL to previous page if available, `null` otherwise"
},
"from": {
"type": "number",
"description": "Index for first item inside the collection."
},
"to": {
"type": "number",
"description": "Index for last item inside the collection."
}
}
}
}
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
403
Headers
Content-Type: application/json
Body
{
"error": "Forbidden."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Forbidden."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
Roles ¶
Role Collection ¶
Get All RolesGET/roles{?include}
Example URI
- include
string
(optional) Example: permissionsList of comma separated entities to include inside the response. Available entities are: permissions
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
200
Headers
Content-Type: application/json
Body
[
{
"name": "my_role",
"display_name": "My Role",
"description": "Default system role.",
"id": 1,
"removable": true,
"users_count": 1,
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "array"
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
403
Headers
Content-Type: application/json
Body
{
"error": "Forbidden."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Forbidden."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
Create New RolePOST/roles
Example URI
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Body
{
"name": "my_role",
"display_name": "My Role",
"description": "Default system role."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Unique role name."
},
"display_name": {
"type": "string",
"description": "Human readable role name."
},
"description": {
"type": "string",
"description": "Role description."
}
},
"required": [
"name"
]
}
200
Headers
Content-Type: application/json
Body
[
{
"name": "my_role",
"display_name": "My Role",
"description": "Default system role.",
"id": 1,
"removable": true,
"users_count": 1,
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "array"
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
403
Headers
Content-Type: application/json
Body
{
"error": "Forbidden."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Forbidden."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
422
Headers
Content-Type: application/json
Body
{
"name": [
"The name field is required.",
"The name has already been taken.",
"The name format is invalid."
]
}
Single Role ¶
Get DetailsGET/roles/?{include}
Example URI
- include
string
(optional) Example: permissionsList of comma separated entities to include inside the response. Available entities are: permissions
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
200
Headers
Content-Type: application/json
Body
{
"name": "my_role",
"display_name": "My Role",
"description": "Default system role.",
"id": 1,
"removable": true,
"users_count": 1,
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Unique role name."
},
"display_name": {
"type": "string",
"description": "Human readable role name."
},
"description": {
"type": "string",
"description": "Role description."
},
"id": {
"type": "number",
"description": "Unique identifier."
},
"removable": {
"type": "boolean",
"description": "Flag which indicates if role can be removed."
},
"users_count": {
"type": "number",
"description": "Number of users with this role."
},
"created_at": {
"type": "string",
"description": "Timestamp when role is created at."
},
"updated_at": {
"type": "string",
"description": "Timestamp when role is updated at."
}
},
"required": [
"name"
]
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
403
Headers
Content-Type: application/json
Body
{
"error": "Forbidden."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Forbidden."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
404
Headers
Content-Type: application/json
Body
{
"error": "Resource not found."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Resource not found."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
UpdatePATCH/roles/{id}
You don’t need to send all request attributes. You can just send those attributes that you want to update.
Example URI
- id
number
(required) Example: 1Unique role identifier.
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Body
{
"name": "my_role",
"display_name": "My Role",
"description": "Default system role."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Unique role name."
},
"display_name": {
"type": "string",
"description": "Human readable role name."
},
"description": {
"type": "string",
"description": "Role description."
}
},
"required": [
"name"
]
}
200
Headers
Content-Type: application/json
Body
{
"name": "my_role",
"display_name": "My Role",
"description": "Default system role.",
"id": 1,
"removable": true,
"users_count": 1,
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Unique role name."
},
"display_name": {
"type": "string",
"description": "Human readable role name."
},
"description": {
"type": "string",
"description": "Role description."
},
"id": {
"type": "number",
"description": "Unique identifier."
},
"removable": {
"type": "boolean",
"description": "Flag which indicates if role can be removed."
},
"users_count": {
"type": "number",
"description": "Number of users with this role."
},
"created_at": {
"type": "string",
"description": "Timestamp when role is created at."
},
"updated_at": {
"type": "string",
"description": "Timestamp when role is updated at."
}
},
"required": [
"name"
]
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
403
Headers
Content-Type: application/json
Body
{
"error": "Forbidden."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Forbidden."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
404
Headers
Content-Type: application/json
Body
{
"error": "Resource not found."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Resource not found."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
422
Headers
Content-Type: application/json
Body
{
"name": [
"The name has already been taken.",
"The name format is invalid."
]
}
DeleteDELETE/roles/{id}
Example URI
- id
number
(required) Example: 1Unique role identifier.
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
200
Headers
Content-Type: application/json
Body
{
"success": true
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"success": {
"type": "boolean"
}
}
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
403
Headers
Content-Type: application/json
Body
{
"error": "Forbidden."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Forbidden."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
404
Headers
Content-Type: application/json
Body
{
"error": "Resource not found."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Resource not found."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
Get PermissionsGET/roles/permissions
Example URI
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
200
Headers
Content-Type: application/json
Body
[
{
"name": "users.create",
"display_name": "Create Users",
"description": "Allows user creation.",
"id": 1,
"removable": true,
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
},
"..."
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "array"
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
403
Headers
Content-Type: application/json
Body
{
"error": "Forbidden."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Forbidden."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
404
Headers
Content-Type: application/json
Body
{
"error": "Resource not found."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Resource not found."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
Update PermissionsPUT/roles/permissions
Example URI
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Body
{
"permissions": [
1,
2,
3
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"permissions": {
"type": "array",
"description": "Array of permission IDs that this role should have."
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"name": "users.create",
"display_name": "Create Users",
"description": "Allows user creation.",
"id": 1,
"removable": true,
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
},
"..."
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "array"
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
403
Headers
Content-Type: application/json
Body
{
"error": "Forbidden."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Forbidden."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
404
Headers
Content-Type: application/json
Body
{
"error": "Resource not found."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Resource not found."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
Permissions ¶
Permission Collection ¶
Get All PermissionsGET/permissions
Example URI
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
200
Headers
Content-Type: application/json
Body
[
{
"name": "users.create",
"display_name": "Create Users",
"description": "Allows user creation.",
"id": 1,
"removable": true,
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "array"
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
403
Headers
Content-Type: application/json
Body
{
"error": "Forbidden."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Forbidden."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
Create New PermissionPOST/permissions
Example URI
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Body
{
"name": "users.create",
"display_name": "Create Users",
"description": "Allows user creation."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Unique permission name."
},
"display_name": {
"type": "string",
"description": "Human readable name."
},
"description": {
"type": "string",
"description": "Permission description."
}
},
"required": [
"name"
]
}
200
Headers
Content-Type: application/json
Body
[
{
"name": "users.create",
"display_name": "Create Users",
"description": "Allows user creation.",
"id": 1,
"removable": true,
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "array"
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
403
Headers
Content-Type: application/json
Body
{
"error": "Forbidden."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Forbidden."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
422
Headers
Content-Type: application/json
Body
{
"name": [
"The name field is required.",
"The name has already been taken.",
"The name format is invalid."
]
}
Single Permission ¶
Get DetailsGET/permissions/{id}
Example URI
- id
number
(required) Example: 111Unique permission identifier.
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
200
Headers
Content-Type: application/json
Body
{
"name": "users.create",
"display_name": "Create Users",
"description": "Allows user creation.",
"id": 1,
"removable": true,
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Unique permission name."
},
"display_name": {
"type": "string",
"description": "Human readable name."
},
"description": {
"type": "string",
"description": "Permission description."
},
"id": {
"type": "number",
"description": "Unique identifier."
},
"removable": {
"type": "boolean",
"description": "Flag which indicates if role can be removed."
},
"created_at": {
"type": "string",
"description": "Timestamp when role is created at."
},
"updated_at": {
"type": "string",
"description": "Timestamp when role is updated at."
}
},
"required": [
"name"
]
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
403
Headers
Content-Type: application/json
Body
{
"error": "Forbidden."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Forbidden."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
404
Headers
Content-Type: application/json
Body
{
"error": "Resource not found."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Resource not found."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
UpdatePATCH/permissions/{id}
You don’t need to send all request attributes. You can just send those attributes that you want to update.
Example URI
- id
number
(required) Example: 111Unique permission identifier.
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Body
{
"name": "my_permission",
"display_name": "Create Users",
"description": "Allows user creation."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Unique permission name."
},
"display_name": {
"type": "string",
"description": "Human readable name."
},
"description": {
"type": "string",
"description": "Permission description."
}
},
"required": [
"name"
]
}
200
Headers
Content-Type: application/json
Body
{
"name": "my_permission",
"display_name": "Create Users",
"description": "Allows user creation.",
"id": 1,
"removable": true,
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Unique permission name."
},
"display_name": {
"type": "string",
"description": "Human readable name."
},
"description": {
"type": "string",
"description": "Permission description."
},
"id": {
"type": "number",
"description": "Unique identifier."
},
"removable": {
"type": "boolean",
"description": "Flag which indicates if role can be removed."
},
"created_at": {
"type": "string",
"description": "Timestamp when role is created at."
},
"updated_at": {
"type": "string",
"description": "Timestamp when role is updated at."
}
},
"required": [
"name"
]
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
403
Headers
Content-Type: application/json
Body
{
"error": "Forbidden."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Forbidden."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
404
Headers
Content-Type: application/json
Body
{
"error": "Resource not found."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Resource not found."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
422
Headers
Content-Type: application/json
Body
{
"name": [
"The name has already been taken.",
"The name format is invalid."
]
}
DeleteDELETE/permissions/{id}
Example URI
- id
number
(required) Example: 111Unique permission identifier.
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
200
Headers
Content-Type: application/json
Body
{
"success": true
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"success": {
"type": "boolean"
}
}
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
403
Headers
Content-Type: application/json
Body
{
"error": "Forbidden."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Forbidden."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
404
Headers
Content-Type: application/json
Body
{
"error": "Resource not found."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Resource not found."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
Settings ¶
System Settings ¶
Get SettingsGET/settings
Example URI
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
200
Headers
Content-Type: application/json
Body
{
"remember_me": true,
"notifications_signup_email": true,
"forgot_password": true,
"login_reset_token_lifetime": 30,
"throttle_enabled": true,
"throttle_attempts": 10,
"throttle_lockout_time": 2,
"reg_enabled": false,
"reg_email_confirmation": true,
"2fa": {
"enabled": true
},
"app_name": "Vanguard",
"registration": {
"captcha": {
"enabled": false
}
},
"tos": false
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"remember_me": {
"type": "boolean",
"description": "Is \"Remember me\" feature enabled on login."
},
"notifications_signup_email": {
"type": "boolean",
"description": "Should administrators receive a notification email whenever some user signs up."
},
"forgot_password": {
"type": "boolean",
"description": "Is password reset feature enabled."
},
"login_reset_token_lifetime": {
"type": "number",
"description": "Lifetime of password reset token in minutes."
},
"throttle_enabled": {
"type": "boolean",
"description": "Is authentication throttling enabled."
},
"throttle_attempts": {
"type": "number",
"description": "Maximum number of login attempts before lockout."
},
"throttle_lockout_time": {
"type": "number",
"description": "Authentication throttle lockout time in minutes."
},
"reg_enabled": {
"type": "boolean",
"description": "Is registration enabled or not."
},
"reg_email_confirmation": {
"type": "boolean",
"description": "Should email be confirmed after successful registration."
},
"2fa": {
"type": "object",
"properties": {
"enabled": {
"type": "boolean",
"description": "Is Two-Factor authentication enabled."
}
}
},
"app_name": {
"type": "string",
"description": "Application name."
},
"registration": {
"type": "object",
"properties": {
"captcha": {
"type": "object",
"properties": {
"enabled": {
"type": "boolean",
"description": "Is captcha enabled on registration."
}
}
}
}
},
"tos": {
"type": "boolean",
"description": "Is accepting Terms of Service enabled during registration."
}
}
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
403
Headers
Content-Type: application/json
Body
{
"error": "Forbidden."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Forbidden."
],
"description": "Error message."
}
},
"required": [
"error"
]
}
Countries ¶
System Countries ¶
Get All CountriesGET/countries
Example URI
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
200
Headers
Content-Type: application/json
Body
[
{
"id": 44,
"name": "Bahamas",
"full_name": "Commonwealth of the Bahamas",
"capital": "Nassau",
"citizenship": "Bahamian",
"country_code": 44,
"currency": "Bahamian dollar",
"currency_code": "BSD",
"currency_sub_unit": "cent",
"currency_symbol": "$",
"iso_3166_2": "BS",
"iso_3166_3": "BHS",
"region_code": 19,
"sub_region_code": 29,
"eea": false,
"calling_code": 1,
"flag": "http://vanguard.app/flags/BS.png"
},
"..."
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "array"
}
401
Headers
Content-Type: application/json
Body
{
"error": "Unauthorized."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string",
"enum": [
"Unauthorized."
],
"description": "Error message."
}
},
"required": [
"error"
]
}