Employees API

Employees

This object represents an employee of your business that interacts with customers and has sales associated with them.

Scopes

employees.read employees.write

Core principles

Smartbills employees are customer-facing employees that generate sales. You can associate receipts with employees. This enables in-depth analytics about your employees and helps us generate detailed reports about how your customers engage with your employees.

Create an employee

Create a new employee. Requires scope employees.write

POST https://api.smartbills.io/v1/employees

Request Body

Requires body of type EmployeeCreateRequest

ParameterDescriptionTypeRequired
firstNameFirst name of the employeestringrequired
lastNameLast name of the employeestring
localeLocale of the employeestring
emailEmail of the employeestring
birthdateBirthdate of the employeedate
EmployeeCreateRequest
{
	"firstName": "John",
	"lastName": "Doe",
	"email": "[email protected]",
	"locale": "en-CA",
	"birthDate": "1990-01-01"
}

Response

Returns a SBEmployee

SBEmployee
{
	"id": 1,
	"firstName": "John",
	"lastName": "Doe",
	"email": "[email protected]",
	"locale": "en-CA",
	"birthDate": "1990-01-01",
	"createdAt": "2023-01-01",
	"updatedAt": null
}

Code example

import { SBClient, SBEmployee, EmployeeCreateRequest } from "@smartbills/sdk"
 
const client = new SBClient();
const request = {
	"firstName": "John",
	"lastName": "Doe",
	"email": "[email protected]",
	"locale": "en-CA",
	"birthDate": "1990-01-01"
};
 
const employee = await client.employees.create(request);

Retrieve an employee

Retrieve an employee by ID. Requires scope employees.read

GET https://api.smartbills.io/v1/employees/:id

Path parameters

ParameterDescriptionTypeRequired
idID of the employee to retrievelongrequired

Response

Returns a SBEmployee

SBEmployee
{
	"id": 1,
	"firstName": "John",
	"lastName": "Doe",
	"email": "[email protected]",
	"locale": "en-CA",
	"birthDate": "1990-01-01",
	"createdAt": "2023-01-01",
	"updatedAt": "2023-01-06"
}

Code example

import { SBClient, SBEmployee } from "@smartbills/sdk"
 
const client = new SBClient();
const employee = await client.employees.getByIdAsync(1);

Update an employee

Update information about an employee. Requires scope employees.write

PUT https://api.smartbills.io/v1/employees/:id

Path parameters

ParameterDescriptionTypeRequired
idID of the employee to updatelongrequired

Body parameters

Requires a body of type EmployeeUpdateRequest

ParameterDescriptionTypeRequired
firstNameFirst name of the employeestringrequired
lastNameLast name of the employeestringrequired
emailEmail of the employeestringrequired
localeLocale of the employeestringrequired
birthdateBirthdate of the employeedate
EmployeeUpdateRequest
{
    "firstName": "John",
    "lastName": "Doe",
    "email": "[email protected]",
	"locale": "en-CA",
	"birthDate": "1990-01-01"
}

Response

Returns a SBEmployee

SBEmployee
{
	"id": 1,
    "firstName": "John",
    "lastName": "Doe",
    "email": "[email protected]",
	"locale": "en-CA",
	"birthDate": "1990-01-01",
	"createdAt": "2023-01-01",
	"updatedAt": "2023-01-06"
}

Code example

import { SBClient, SBEmployee, EmployeeUpdateRequest } from "@smartbills/sdk"
	
const client = new SBClient();
const request = {
	"firstName": "John",
	"lastName": "Doe",
	"email": "[email protected]",
	"locale": "en-CA",
	"birthDate": "1990-01-01"
};
const employee = await client.employees.updateAsync(1, request);

Delete an employee

Delete an employee. Requires scope employees.write

DELETE https://api.smartbills.io/v1/employees/:id

Path parameters

ParameterDescriptionTypeRequired
idID of the employee to deletelongrequired

Response

Returns a SBEmployee

SBEmployee
{
	"id": 1,
    "firstName": "John",
    "lastName": "Doe",
    "email": "[email protected]",
	"locale": "en-CA",
	"birthDate": "1990-01-01",
	"createdAt": "2023-01-01",
	"updatedAt": "2023-01-06"
}

Code example

import { SBClient, SBEmployee } from "@smartbills/sdk"
	
const client = new SBClient();
const employee = await client.employees.deleteAsync(1);

List employees

Retrieve a list of employees. Requires