Back to top

Vanguard API

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 Authentication
POST/login

Example URI

POST https://your-vanguard-website.com/api/login
Request
HideShow
Headers
Content-Type: application/json
Accept: 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"
  ]
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "token": "asdfasfdasdfasdfa"
}
Response  401
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "Invalid credentials."
}
Response  422
HideShow
Headers
Content-Type: application/json
Body
{
  "username": [
    "The username field is required."
  ],
  "password": [
    "The password field is required."
  ]
}
Response  500
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "Could not create token."
}

Social Authentication

Social Network Auth
POST/login/social

If user that is being authenticated does not exist his account will be automatically created (if registration is enabled) before token is being issued.

Example URI

POST https://your-vanguard-website.com/api/login/social
Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Body
{
  "network": "facebook",
  "social_token": "asdf8ua9yadf7ya8d7fasdfyafd7as7fdas"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "network": {
      "type": "string",
      "description": "Network name according to the networks enabled by [application configuration](https://docs.vanguardapp.io/configuration.html#social-authentication)."
    },
    "social_token": {
      "type": "string",
      "description": "Token obtained from social network you want to authenticate with."
    }
  },
  "required": [
    "network",
    "social_token"
  ]
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "token": "1231231"
}
Response  403
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "Your account is banned by administrators."
}
Response  403
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "Only users who already created an account can log in."
}
Response  500
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "Could not connect to specified social network."
}

Logout

Logout and Token Invalidation
POST/logout

Sending an request to logout endpoint with a valid API token will also invalidate that token.

Example URI

POST https://your-vanguard-website.com/api/logout
Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Response  200
HideShow
Headers
Content-Type: application/json
Body
+ Attributes (Response Success)
Response  401
HideShow
Headers
Content-Type: text/html
Body
+ Attributes (Response 401)

Registration

Register User
POST/register

Example URI

POST https://your-vanguard-website.com/api/register
Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Body
{
  "username": "johndoe",
  "email": "[email protected]",
  "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"
  ]
}
Response  201
HideShow
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."
    }
  }
}
Response  404
HideShow
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"
  ]
}
Response  422
HideShow
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 Email
POST/registration/verify-email/{token}

Example URI

POST https://your-vanguard-website.com/api/registration/verify-email/4SfyJptHEqaHbcNtoeCblXzMyJ8apROAnJ82o0EuEcRI9QH7ca8VefzCLVaL
URI Parameters
HideShow
token
string (required) Example: 4SfyJptHEqaHbcNtoeCblXzMyJ8apROAnJ82o0EuEcRI9QH7ca8VefzCLVaL

Email confirmation token.

Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "success": true
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "success": {
      "type": "boolean"
    }
  }
}
Response  400
HideShow
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"
    }
  }
}
Response  404
HideShow
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 Email
POST/password

Example URI

POST https://your-vanguard-website.com/api/password
Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Body
{
  "email": "[email protected]"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "email": {
      "type": "string",
      "description": "User's email address."
    }
  },
  "required": [
    "email"
  ]
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "success": true
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "success": {
      "type": "boolean"
    }
  }
}
Response  422
HideShow
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 Password
POST/password

Example URI

POST https://your-vanguard-website.com/api/password
Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Body
{
  "token": "4SfyJptHEqaHbcNtoeCblXzMyJ8apROAnJ82o0EuEcRI9QH7ca8VefzCLVaL",
  "email": "[email protected]",
  "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"
  ]
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "success": true
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "success": {
      "type": "boolean"
    }
  }
}
Response  400
HideShow
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"
    }
  }
}
Response  422
HideShow
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 Stats
GET/stats

When currently authenticated user is administrator (has Admin role).

Example URI

GET https://your-vanguard-website.com/api/stats
Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Response  200
HideShow
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": "[email protected]",
      "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"
    }
  }
}
Response  401
HideShow
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 Stats
GET/stats

When currently authenticated user is not and administrator. Response will contain number of activities per day for last two weeks.

Example URI

GET https://your-vanguard-website.com/api/stats
Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Response  200
HideShow
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"
    }
  }
}
Response  401
HideShow
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 Profile
GET/me{?include}

Example URI

GET https://your-vanguard-website.com/api/me?include=role
URI Parameters
HideShow
include
string (optional) Example: role

List of comma separated entities to include inside the response. Available entities are: role, country

Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "id": 123,
  "first_name": "John",
  "last_name": "Doe",
  "username": "johndoe",
  "email": "[email protected]",
  "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."
    }
  }
}
Response  401
HideShow
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 Details
PATCH/me/details

You can provide even just one attribute that you want to update.

Example URI

PATCH https://your-vanguard-website.com/api/me/details
Request
HideShow
Headers
Content-Type: application/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
{
  "$schema": "http://json-schema.org/draft-04/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."
    }
  }
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "id": 123,
  "first_name": "John",
  "last_name": "Doe",
  "username": "johndoe",
  "email": "[email protected]",
  "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."
    }
  }
}
Response  401
HideShow
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"
  ]
}
Response  422
HideShow
Headers
Content-Type: application/json
Body
{
    "birthday": [
        "The birthday is not a valid date.",
    ]
}

Upload Avatar

Upload Avatar
PUT/me/avatar

Example URI

PUT https://your-vanguard-website.com/api/me/avatar
Request
HideShow
Headers
Content-Type: image/jpeg
Accept: application/json
Authorization: Bearer <api token here>
Body
<raw_binary_image>
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "id": 123,
  "first_name": "John",
  "last_name": "Doe",
  "username": "johndoe",
  "email": "[email protected]",
  "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."
    }
  }
}
Response  401
HideShow
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"
  ]
}
Response  422
HideShow
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 Source
PUT/me/avatar/external

Example URI

PUT https://your-vanguard-website.com/api/me/avatar/external
Request
HideShow
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"
  ]
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "id": 123,
  "first_name": "John",
  "last_name": "Doe",
  "username": "johndoe",
  "email": "[email protected]",
  "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."
    }
  }
}
Response  401
HideShow
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"
  ]
}
Response  422
HideShow
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 Sessions
GET/me/sessions

Example URI

GET https://your-vanguard-website.com/api/me/sessions
Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Response  200
HideShow
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."
    }
  }
}
Response  401
HideShow
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"
  ]
}
Response  404
HideShow
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"
  ]
}
Response  422
HideShow
Headers
Content-Type: application/json
Body
{
  "url": [
    "The url field is required.",
    "The url format is invalid."
  ]
}

Two-Factor Authentication

Enable
PUT/me/2fa

Example URI

PUT https://your-vanguard-website.com/api/me/2fa
Request
HideShow
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"
  ]
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "id": 123,
  "first_name": "John",
  "last_name": "Doe",
  "username": "johndoe",
  "email": "[email protected]",
  "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."
    }
  }
}
Response  401
HideShow
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"
  ]
}
Response  403
HideShow
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"
  ]
}
Response  404
HideShow
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"
  ]
}
Response  422
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "2FA is already enabled for this user."
}

Disable
DELETE/me/2fa

Example URI

DELETE https://your-vanguard-website.com/api/me/2fa
Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "id": 123,
  "first_name": "John",
  "last_name": "Doe",
  "username": "johndoe",
  "email": "[email protected]",
  "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."
    }
  }
}
Response  401
HideShow
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"
  ]
}
Response  403
HideShow
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"
  ]
}
Response  404
HideShow
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"
  ]
}
Response  422
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "2FA is not enabled for this user."
}

Users

User Collection

Paginate All Users
GET/users{?page,per_page,search,status,include}

Example URI

GET https://your-vanguard-website.com/api/users?page=&per_page=&search=&status=&include=country
URI Parameters
HideShow
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: country

List of comma separated entities to include inside the response. Available entities are: role, country

Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "data": [
    {
      "id": 123,
      "first_name": "John",
      "last_name": "Doe",
      "username": "johndoe",
      "email": "[email protected]",
      "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."
        }
      }
    }
  }
}
Response  401
HideShow
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"
  ]
}
Response  403
HideShow
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 User
POST/users

Example URI

POST https://your-vanguard-website.com/api/users
Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Body
{
  "email": "[email protected]",
  "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"
  ]
}
Response  201
HideShow
Headers
Content-Type: application/json
Body
{
  "id": 123,
  "first_name": "John",
  "last_name": "Doe",
  "username": "johndoe",
  "email": "[email protected]",
  "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."
    }
  }
}
Response  401
HideShow
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"
  ]
}
Response  403
HideShow
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"
  ]
}
Response  422
HideShow
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 Details
GET/users/{?include}

Example URI

GET https://your-vanguard-website.com/api/users/?include=country
URI Parameters
HideShow
include
string (optional) Example: country

List of comma separated entities to include inside the response. Available entities are: role, country

Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "id": 123,
  "first_name": "John",
  "last_name": "Doe",
  "username": "johndoe",
  "email": "[email protected]",
  "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."
    }
  }
}
Response  401
HideShow
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"
  ]
}
Response  403
HideShow
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"
  ]
}
Response  404
HideShow
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
PUT/users/{id}

You don’t need to send all request attributes. You can just send those attributes that you want to update.

Example URI

PUT https://your-vanguard-website.com/api/users/123
URI Parameters
HideShow
id
number (required) Example: 123

Unique user identifier.

Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Body
{
  "email": "[email protected]",
  "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"
    }
  }
}
Response  201
HideShow
Headers
Content-Type: application/json
Body
{
  "id": 123,
  "first_name": "John",
  "last_name": "Doe",
  "username": "johndoe",
  "email": "[email protected]",
  "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."
    }
  }
}
Response  401
HideShow
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"
  ]
}
Response  403
HideShow
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"
  ]
}
Response  404
HideShow
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"
  ]
}
Response  422
HideShow
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."
    ],

}

Delete
DELETE/users/{id}

Example URI

DELETE https://your-vanguard-website.com/api/users/123
URI Parameters
HideShow
id
number (required) Example: 123

Unique user identifier.

Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "success": true
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "success": {
      "type": "boolean"
    }
  }
}
Response  401
HideShow
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"
  ]
}
Response  403
HideShow
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"
  ]
}
Response  404
HideShow
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 Avatar
PUT/users/avatar

Example URI

PUT https://your-vanguard-website.com/api/users/avatar
Request
HideShow
Headers
Content-Type: image/jpeg
Accept: application/json
Authorization: Bearer <api token here>
Body
<raw_binary_image>
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "id": 123,
  "first_name": "John",
  "last_name": "Doe",
  "username": "johndoe",
  "email": "[email protected]",
  "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."
    }
  }
}
Response  401
HideShow
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"
  ]
}
Response  403
HideShow
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"
  ]
}
Response  404
HideShow
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"
  ]
}
Response  422
HideShow
Headers
Content-Type: application/json
Body
{
  "file": [
    "The file is required.",
    "The file must be an image."
  ]
}

Update Avatar from External Source
PUT/users/avatar/external

Example URI

PUT https://your-vanguard-website.com/api/users/avatar/external
Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "id": 123,
  "first_name": "John",
  "last_name": "Doe",
  "username": "johndoe",
  "email": "[email protected]",
  "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."
    }
  }
}
Response  401
HideShow
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"
  ]
}
Response  403
HideShow
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"
  ]
}
Response  404
HideShow
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"
  ]
}
Response  422
HideShow
Headers
Content-Type: application/json
Body
{
  "url": [
    "The url field is required.",
    "The url format is invalid."
  ]
}

Remove Avatar
DELETE/users/avatar

Example URI

DELETE https://your-vanguard-website.com/api/users/avatar
Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "id": 123,
  "first_name": "John",
  "last_name": "Doe",
  "username": "johndoe",
  "email": "[email protected]",
  "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."
    }
  }
}
Response  401
HideShow
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"
  ]
}
Response  403
HideShow
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"
  ]
}
Response  404
HideShow
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 Authentication
PUT/users/2fa

Example URI

PUT https://your-vanguard-website.com/api/users/2fa
Request
HideShow
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"
  ]
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "id": 123,
  "first_name": "John",
  "last_name": "Doe",
  "username": "johndoe",
  "email": "[email protected]",
  "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."
    }
  }
}
Response  401
HideShow
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"
  ]
}
Response  403
HideShow
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"
  ]
}
Response  404
HideShow
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"
  ]
}
Response  422
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "2FA is already enabled for this user."
}

Disable Two-Factor Authentication
DELETE/users/2fa

Example URI

DELETE https://your-vanguard-website.com/api/users/2fa
Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "id": 123,
  "first_name": "John",
  "last_name": "Doe",
  "username": "johndoe",
  "email": "[email protected]",
  "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."
    }
  }
}
Response  401
HideShow
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"
  ]
}
Response  403
HideShow
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"
  ]
}
Response  404
HideShow
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"
  ]
}
Response  422
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "2FA is not enabled for this user."
}

Paginate Activities For User
GET/users/activity{?page,per_page,search}

Example URI

GET https://your-vanguard-website.com/api/users/activity?page=&per_page=&search=
URI Parameters
HideShow
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.

Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Response  200
HideShow
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."
        }
      }
    }
  }
}
Response  401
HideShow
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"
  ]
}
Response  403
HideShow
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"
  ]
}
Response  404
HideShow
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 Sessions
GET/users/sessions

Example URI

GET https://your-vanguard-website.com/api/users/sessions
Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Response  200
HideShow
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"
}
Response  401
HideShow
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"
  ]
}
Response  403
HideShow
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"
  ]
}
Response  404
HideShow
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 Info
GET/sessions/{id}

Example URI

GET https://your-vanguard-website.com/api/sessions/uFfF2KPoq7XZAOPLhen5ayOArawyzGitjoFIdogV
URI Parameters
HideShow
id
string (required) Example: uFfF2KPoq7XZAOPLhen5ayOArawyzGitjoFIdogV

Unique session identifier.

Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Response  200
HideShow
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."
    }
  }
}
Response  401
HideShow
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"
  ]
}
Response  403
HideShow
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"
  ]
}
Response  404
HideShow
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"
  ]
}

Invalidate
DELETE/sessions/{id}

Example URI

DELETE https://your-vanguard-website.com/api/sessions/uFfF2KPoq7XZAOPLhen5ayOArawyzGitjoFIdogV
URI Parameters
HideShow
id
string (required) Example: uFfF2KPoq7XZAOPLhen5ayOArawyzGitjoFIdogV

Unique session identifier.

Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "success": true
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "success": {
      "type": "boolean"
    }
  }
}
Response  401
HideShow
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"
  ]
}
Response  403
HideShow
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"
  ]
}
Response  404
HideShow
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 Activities
GET/activity{?include,page,per_page,search}

Example URI

GET https://your-vanguard-website.com/api/activity?include=user&page=&per_page=&search=
URI Parameters
HideShow
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: user

List of comma separated entities to include inside the response. Available entities are:

  • user
Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Response  200
HideShow
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."
        }
      }
    }
  }
}
Response  401
HideShow
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"
  ]
}
Response  403
HideShow
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 Roles
GET/roles{?include}

Example URI

GET https://your-vanguard-website.com/api/roles?include=permissions
URI Parameters
HideShow
include
string (optional) Example: permissions

List of comma separated entities to include inside the response. Available entities are: permissions

Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Response  200
HideShow
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"
}
Response  401
HideShow
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"
  ]
}
Response  403
HideShow
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 Role
POST/roles

Example URI

POST https://your-vanguard-website.com/api/roles
Request
HideShow
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"
  ]
}
Response  200
HideShow
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"
}
Response  401
HideShow
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"
  ]
}
Response  403
HideShow
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"
  ]
}
Response  422
HideShow
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 Details
GET/roles/?{include}

Example URI

GET https://your-vanguard-website.com/api/roles/?permissions
URI Parameters
HideShow
include
string (optional) Example: permissions

List of comma separated entities to include inside the response. Available entities are: permissions

Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Response  200
HideShow
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"
  ]
}
Response  401
HideShow
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"
  ]
}
Response  403
HideShow
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"
  ]
}
Response  404
HideShow
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
PATCH/roles/{id}

You don’t need to send all request attributes. You can just send those attributes that you want to update.

Example URI

PATCH https://your-vanguard-website.com/api/roles/1
URI Parameters
HideShow
id
number (required) Example: 1

Unique role identifier.

Request
HideShow
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"
  ]
}
Response  200
HideShow
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"
  ]
}
Response  401
HideShow
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"
  ]
}
Response  403
HideShow
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"
  ]
}
Response  404
HideShow
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"
  ]
}
Response  422
HideShow
Headers
Content-Type: application/json
Body
{
  "name": [
    "The name has already been taken.",
    "The name format is invalid."
  ]
}

Delete
DELETE/roles/{id}

Example URI

DELETE https://your-vanguard-website.com/api/roles/1
URI Parameters
HideShow
id
number (required) Example: 1

Unique role identifier.

Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "success": true
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "success": {
      "type": "boolean"
    }
  }
}
Response  401
HideShow
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"
  ]
}
Response  403
HideShow
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"
  ]
}
Response  404
HideShow
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 Permissions
GET/roles/permissions

Example URI

GET https://your-vanguard-website.com/api/roles/permissions
Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Response  200
HideShow
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"
}
Response  401
HideShow
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"
  ]
}
Response  403
HideShow
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"
  ]
}
Response  404
HideShow
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 Permissions
PUT/roles/permissions

Example URI

PUT https://your-vanguard-website.com/api/roles/permissions
Request
HideShow
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."
    }
  }
}
Response  200
HideShow
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"
}
Response  401
HideShow
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"
  ]
}
Response  403
HideShow
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"
  ]
}
Response  404
HideShow
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 Permissions
GET/permissions

Example URI

GET https://your-vanguard-website.com/api/permissions
Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Response  200
HideShow
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"
}
Response  401
HideShow
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"
  ]
}
Response  403
HideShow
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 Permission
POST/permissions

Example URI

POST https://your-vanguard-website.com/api/permissions
Request
HideShow
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"
  ]
}
Response  200
HideShow
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"
}
Response  401
HideShow
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"
  ]
}
Response  403
HideShow
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"
  ]
}
Response  422
HideShow
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 Details
GET/permissions/{id}

Example URI

GET https://your-vanguard-website.com/api/permissions/111
URI Parameters
HideShow
id
number (required) Example: 111

Unique permission identifier.

Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Response  200
HideShow
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"
  ]
}
Response  401
HideShow
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"
  ]
}
Response  403
HideShow
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"
  ]
}
Response  404
HideShow
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
PATCH/permissions/{id}

You don’t need to send all request attributes. You can just send those attributes that you want to update.

Example URI

PATCH https://your-vanguard-website.com/api/permissions/111
URI Parameters
HideShow
id
number (required) Example: 111

Unique permission identifier.

Request
HideShow
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"
  ]
}
Response  200
HideShow
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"
  ]
}
Response  401
HideShow
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"
  ]
}
Response  403
HideShow
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"
  ]
}
Response  404
HideShow
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"
  ]
}
Response  422
HideShow
Headers
Content-Type: application/json
Body
{
  "name": [
    "The name has already been taken.",
    "The name format is invalid."
  ]
}

Delete
DELETE/permissions/{id}

Example URI

DELETE https://your-vanguard-website.com/api/permissions/111
URI Parameters
HideShow
id
number (required) Example: 111

Unique permission identifier.

Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "success": true
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "success": {
      "type": "boolean"
    }
  }
}
Response  401
HideShow
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"
  ]
}
Response  403
HideShow
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"
  ]
}
Response  404
HideShow
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 Settings
GET/settings

Example URI

GET https://your-vanguard-website.com/api/settings
Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Response  200
HideShow
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."
    }
  }
}
Response  401
HideShow
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"
  ]
}
Response  403
HideShow
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 Countries
GET/countries

Example URI

GET https://your-vanguard-website.com/api/countries
Request
HideShow
Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer <api token here>
Response  200
HideShow
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"
}
Response  401
HideShow
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"
  ]
}

Generated by aglio on 30 Aug 2017