Users Management
Get Users
For retriving user objects. This is divided into two:
Get all users
GET
api/users
Description:
Returns a list of users for the authenticated company.
Request Headers:
Authorization
Bearer Token
The token used for authenticating the request.
Request Body:
This is optional and only needed for a B2B2B Scenario.
company_id
Integer (Optional)
The ID of the target company if fetching users of another company in a B2B2B scenario.
Response:
Get a specific user:
GET
api/users/{id}
Description:
Returns a list of users for the authenticated company.
Request Headers:
Authorization
Bearer Token
The token used for authenticating the request.
Request Parameters:
id
Integer
The ID of the user to deactivate.
Request Body:
This is optional and only needed for a B2B2B Scenario.
company_id
Integer (Optional)
The ID of the target company if user is for another company in a B2B2B scenario.
Response:
Create a New User
POST
api/users
Description:
This endpoint allows for the creation of a new user in a specific company. It supports B2B2B scenarios where a third-party company (e.g., Flair HR) can create users for their customers' companies.
Request Headers
Authorization
Bearer token for API access
string
Yes
Content-Type
Must be set to application/json
string
Yes
Request Parameters
Body Parameters
company_id
ID of the company for which the user is being created. Optional if the user is for the initiating company.
integer
No
-
123
first_name
First name of the user
string
Yes
-
Samson
last_name
Last name of the user
string
Yes
-
Olu
personal_email
Personal email of the user
string
Yes
-
samson.olu@vincentco.com
domain_name
Domain name associated with the user's email
string
Yes
-
vincentco.com
user_types
User type within the company
string
Yes
-
Employee
title
Job title of the user
string
No
-
Software Engineer
base_salary
Base salary of the user
numeric
No
-
85000
department
Department where the user works
string
No
-
IT
allowances
Allowances for the user
numeric
No
-
5000
office_location
Office location of the user
string
No
-
Lagos
start_date
Start date of the user in YYYY-MM-DD
format
date
Yes
-
2024-09-01
manager_email
Email of the user's manager. If provided, the manager must exist in the specified company.
string
No
-
manager@vincentco.com
Name of the user's bank. Required if account_number
is provided.
string
No
-
Guaranty Trust Bank
account_number
User's bank account number. Required if bank_name
is provided.
string
No
-
0167865207
roles
Roles assigned to the user. Defaults to user
if not provided.
array
No
["user"]
["admin", "user"]
is_active
Whether the user should be immediately activated (true
) or not (false
).
boolean
No
false
true
notify
Flag to send notification
Boolean
Optional
false
true
Response
Use Cases
Example 1: Creating a New User
Request:
Body:
Response:
Example 2: Creating a New User Without Activation
Request:
Body:
Response:
Example 3: Creating a New User for the Initiating Company (Non-B2B2B Scenario)
Request:
Body:
Response:
Scenario Details
Non-B2B2B Scenario: In this example, the user is being created for the company that is initiating the API call, and no
company_id
is provided in the request. This means the new user will be associated with the initiating company.No Immediate Activation: The user is not immediately activated (
is_active
is set tofalse
). They will need to complete onboarding through the provided token.Onboarding: Since the user is not activated, an onboarding token is generated, and an invitation email will be sent to the user's personal email to complete the onboarding process.
Domain and User Type Checks: The domain name and user type are validated against the initiating company's existing records.
This example showcases a straightforward use case where a company uses the API to create a user within its own system, without interacting with another company's data (non-B2B2B scenario).
Update a User's Profile
PUT
api/users/{id}
Description
This API endpoint is used to update an existing user's details within a company. The request can optionally specify a target company ID for B2B2B scenarios.
Request Headers
Authorization
Bearer Token
The token used for authenticating the request.
Request Parameters
id
Integer
The ID of the user to be updated.
Request Body
company_id
Integer (Optional)
The ID of the target company if updating for another company in a B2B2B scenario.
first_name
String (Optional)
The user's first name.
last_name
String (Optional)
The user's last name.
domain_name
String (Optional)
The domain name associated with the user's email address.
user_types
String (Optional)
The user type, e.g., 'Admin', 'Employee'.
title
String (Optional)
The user's job title.
base_salary
Numeric (Optional)
The user's base salary.
department
String (Optional)
The department where the user works.
allowances
Numeric (Optional)
The user's allowances.
personal_email
String (Optional)
The user's personal email address.
office_location
String (Optional)
The user's office location.
start_date
Date (Optional)
The user's start date.
manager_email
String (Optional)
The email address of the user's manager.
documents
Array of Files (Optional)
Array of documents to upload for the user.
password
String (Optional)
The user's password. Must be at least 12 characters long, with uppercase and special characters.
password_confirmation
tring (Optional)
Match the password
bank_name
String (Optional)
The user's bank name.
account_number
String (Optional)
The user's bank account number.
notify
Boolean: true (Optional)
Flag to send notification
Example Request Body
Response
Deactivate a User
PATCH
api/users/{id}/deactivate
Description:
This API endpoint deactivates a user within a company by updating the is_active
status.
Request Headers:
Authorization
Bearer Token
The token used for authenticating the request.
Request Parameters:
id
Integer
The ID of the user to deactivate.
Request Body:
This is optional and only needed for a B2B2B Scenario.
company_id
Integer (Optional)
The ID of the target company if deactivating user of another company in a B2B2B scenario.
Response:
Activate a User
PATCH
api/users/{id}/activate
Description:
This API endpoint activates a user within a company by updating the is_active
status and setting the onboarding as completed.
Request Headers:
Authorization
Bearer Token
The token used for authenticating the request.
Request Parameters:
id
Integer
The ID of the user to activate.
Request Body:
This is optional and only needed for a B2B2B Scenario.
company_id
Integer (Optional)
The ID of the target company if activating user of another company in a B2B2B scenario.
notify
Boolean (Optional:true)
Flag to send notification
Response:
Delete a User
DELETE
api/users/{id}
Description:
This API endpoint deletes a user within a company. It deactivates the user, removes associated roles, and deletes related onboarding documents.
Request Headers:
Authorization
Bearer Token
The token used for authenticating the request.
Request Parameters:
This is optional and only needed for a B2B2B Scenario.
id
Integer
The ID of the user to delete.
Request Body:
company_id
Integer (Optional)
The ID of the target company if deleting user of another company in a B2B2B scenario.
Response:
Bulk Create Users
POST
api/users/bulk-create
Description
Allows bulk creation of users for a specific company by uploading a CSV file.
Request Headers
Authorization
Bearer {token}
Content-Type
multipart/form-data
Parameters
Query Parameters
company_id
int
No
ID of the target company. Defaults to the authenticated company.
Form Data
users_csv
file
Yes
CSV file containing user data.
Responses
Bulk Update Users
POST
api/users/bulk-update
Description
Allows bulk updates to existing users in a company by uploading a CSV file.
Headers
Authorization
Bearer {token}
Content-Type
multipart/form-data
Parameters
Query Parameters
company_id
int
No
ID of the target company. Defaults to the authenticated company.
Form Data
users_csv
file
Yes
CSV file containing user update data.
Responses
Suspend User
POST
api/users/{id}/suspend
Description
Suspend a user for a specified duration or indefinitely.
Headers
Authorization
Bearer {token}
Parameters
Query Parameters
company_id
int
No
ID of the target company. Defaults to the authenticated company.
Request Body
suspension_duration_type
string
Yes
Type of suspension (minutes
, hours
, date
, indefinite
).
suspension_duration_value
integer
No
Value for minutes
or hours
duration type.
suspension_end_at
string
No
Date for date
duration type (YYYY-MM-DD HH:mm:ss
).
clear_roles
boolean
No
Whether to remove all roles for the user during suspension.
suspension_reason
string
No
Reason for the suspension.
Responses
Unsuspend User
POST
api/users/{id}/unsuspend
Description
Unsuspend a user either immediately or at a specified future time.
Headers
Authorization
Bearer {token}
Parameters
Query Parameters
company_id
int
No
ID of the target company. Defaults to the authenticated company.
Request Body
unsuspend_option
string
Yes
Option to unsuspend (immediately
, future
).
new_unsuspension_time
string
No
Future unsuspension time (YYYY-MM-DD HH:mm:ss
).
Responses
Download Templates
Download Import Template
GET
api/users/import-template
Description
Download the CSV template for user import.
Responses:
Download Update Template
GET
api/users/update-template
Description
Download the CSV template for user update.
Responses
Last updated