Staff API

For access, paging, filters and getting only changes, see API basics.

These endpoints cover staff/employee management: looking up employees, specialisations and departments, and the basic employee lifecycle – create, update, add a login, discharge.

1. Employee Search

Endpoint

GET /api/employee/search

Purpose

Returns a paginated list of employees (staff), optionally including related entities such as specialisations, roles, photo, and country. Used to list/browse staff, e.g. on the Employees page.

Example Request

curl 'https://{{domain}}/api/employee/search?limit=50&offset=0&paginate=true&join%5B%5D=specialisations&join%5B%5D=specialisations.role&join%5B%5D=photo&join%5B%5D=country&translate=true&discharged=false' \
  -H 'accept: application/json' \
  -H 'authorization: <TOKEN>' \
  -H 'content-type: application/x-www-form-urlencoded; charset=UTF-8'

Query Parameters Used

Parameter

Meaning

limit=50, offset=0, paginate=true

Standard paging.

join[]=specialisations

Expand the employee’s job specialisations (position assignments).

join[]=specialisations.role

For each specialisation, expand the department/role it belongs to.

join[]=photo

Expand the employee’s profile photo file object.

join[]=country

Expand the employee’s country object.

translate=true

Translate specialisation/role names into the request locale.

discharged=false

Only return currently active employees (excludes discharged staff).


2. Specialisation Search

Endpoint

GET /api/specialisation/search

Purpose

Returns the list of specialisations (job positions, e.g. “Waiter”, “Administrator”) that can be assigned to an employee. Each specialisation belongs to a department (role). Used to populate the position dropdown when creating or editing an employee.

Example Request

curl 'https://{{domain}}/api/specialisation/search?limit=50&offset=0&paginate=true&join%5B%5D=role' \
  -H 'accept: application/json' \
  -H 'authorization: <TOKEN>' \
  -H 'content-type: application/x-www-form-urlencoded; charset=UTF-8'

Query Parameters Used

Parameter

Meaning

limit=50, offset=0, paginate=true

Standard paging.

join[]=role

Expand the department this specialisation belongs to.


3. Department Search

Endpoint

GET /api/role/search

Purpose

Returns the list of departments. Internally the entity is called role and is stored as a nested set (root / left / right), but in the UI this is the “Departments” page under Staff. A specialisation’s role field points here.

Example Request

curl 'https://{{domain}}/api/role/search?limit=50&offset=0&paginate=true' \
  -H 'accept: application/json' \
  -H 'authorization: <TOKEN>' \
  -H 'content-type: application/x-www-form-urlencoded; charset=UTF-8'

Query Parameters Used

Parameter

Meaning

limit=50, offset=0, paginate=true

Standard paging.


4. Create Employee

Endpoint

POST /api/employee/create

Purpose

Creates a new employee record. This is the first step of onboarding – the record is created without a login; add one afterwards with Check Username Availability + Create Employee Login below. A default specialisation is assigned automatically by the system.

Example Request

curl 'https://{{domain}}/api/employee/create' \
  -H 'accept: application/json' \
  -H 'authorization: <TOKEN>' \
  -H 'content-type: application/x-www-form-urlencoded; charset=UTF-8' \
  --data-raw 'firstName=DocTest&lastName=Example&dateOfRecruitment=2026-09-14&includeToTable=false'

Form Fields Used

Field

Meaning

firstName, lastName

The employee’s name.

dateOfRecruitment

Start date, format YYYY-MM-DD.

includeToTable

Whether the employee shows up in the tabel/timesheet by default.

Example Response

187

The response is just the new employee’s id – use it as id / person in the endpoints below.


5. Update Employee

Endpoint

POST /api/employee/update

Purpose

Updates fields on an existing employee record. Send the id plus only the fields you want to change – any employee field can be updated this way (phone, email, address, contract data, etc.).

Example Request

curl 'https://{{domain}}/api/employee/update' \
  -H 'accept: application/json' \
  -H 'authorization: <TOKEN>' \
  -H 'content-type: application/x-www-form-urlencoded; charset=UTF-8' \
  --data-raw 'id=187&phone=%2B37060000000&email=doctest%40example.com'

Form Fields Used

Field

Meaning

id

Id of the employee to update.

phone, email, …

Any other employee field – only the fields you send are changed.

Example Response

{"status": 1, "message": "info.updated", "data": 187, "total": null, "length": null}

6. Check Username Availability

Endpoint

POST /api/unique_name/check

Purpose

Checks whether a value is already taken for a given field on a given resource. Call this before creating a login, to confirm the desired username is free.

Example Request

curl 'https://{{domain}}/api/unique_name/check' \
  -H 'accept: application/json' \
  -H 'authorization: <TOKEN>' \
  -H 'content-type: application/x-www-form-urlencoded; charset=UTF-8' \
  --data-raw 'input=doctest187&resource=user&fieldName=username&'

Form Fields Used

Field

Meaning

input

The value being checked for uniqueness – here, the desired username.

resource=user

The table/resource the value is checked against.

fieldName=username

The column being checked for uniqueness.

Example Response

{"data": {"unique": true, "suggestion": "doctest187"}}

Field

Meaning

data.unique

true if input is free for that resource/fieldName.

data.suggestion

A free alternative, in case unique is false.


7. Create Employee Login

Endpoint

POST /api/user/create

Purpose

Creates a login (user account) for an existing employee, linking a username/password to the employee record. Run the username-availability check above first.

Example Request

curl 'https://{{domain}}/api/user/create' \
  -H 'accept: application/json' \
  -H 'authorization: <TOKEN>' \
  -H 'content-type: application/x-www-form-urlencoded; charset=UTF-8' \
  --data-raw 'person=186&username=56&password=56'

Form Fields Used

Field

Meaning

person

Id of the employee record (from Employee Search / Create Employee) to attach the login to.

username

Desired username – should already be confirmed free via /api/unique_name/check.

password

Password for the new login.

Example Response

{"status": 1, "message": "info.created", "data": 186, "total": null, "length": null}

Field

Meaning

status

1 on success.

message

“info.created” on success.

data

Id of the created login record.


8. Discharge Employee

Endpoint

POST /api/employee/discharge

Purpose

Ends an employee’s employment. This also removes their login and any access card – it is not just a flag flip, so treat it as the final step, not a reversible toggle.

Example Request

curl 'https://{{domain}}/api/employee/discharge' \
  -H 'accept: application/json' \
  -H 'authorization: <TOKEN>' \
  -H 'content-type: application/x-www-form-urlencoded; charset=UTF-8' \
  --data-raw 'id=187&dateOfDischarge=2026-09-14'

Form Fields Used

Field

Meaning

id

Id of the employee to discharge.

dateOfDischarge

Effective discharge date, format YYYY-MM-DD.

assignee

(optional) Id of another employee to reassign this employee’s open work to.

Example Response

{"status": 1, "message": "info.updated", "data": null, "total": null, "length": null}

Employees for reporting

Sales point to employees in several fields: order.manager (who serves the order), and createdBy of orders, lines and payment records (who created them; for payments, the cashier). These all use the same person IDs as GET /api/employee/search. For access, paging and filters, see API basics.

GET /api/employee/search?select[]=name&select[]=firstName&select[]=lastName&select[]=isDischarged&select[]=dateOfDischarge&paginate=true&limit=500

Employees who have left have isDischarged: true and keep their ID, so their past sales still link to them. To list only current employees, add isDischarged=0.

Work time

Work shifts, which shift each employee works on which weekday, the work schedule by day and the entrance records. Sales by employee are in the orders: manager is the employee who served the order (see Orders API).

Shifts

GET /api/workshift/search

Fields: name, start and end (local time, for example 06:00:00), shiftDuration (working time in seconds, without breaks) and type (regular, remote_work or workation).

Shifts of each employee by weekday

GET /api/employee_workshift/search?limit=1000

The weekly plan of all employees: 14 rows for each employee, one per weekday for odd and for even weeks. Fields: employee, weekday (1 is Monday, 7 is Sunday), oddWeek (the row is for odd or even weeks) and workshift (empty on days off). This list cannot be filtered by employee: filter the rows on your side by employee.id.

Work schedule by day

Example request

curl -g -G 'https://{company}.smarton.app/api/employee_schedule_entry/search' \
  -H 'Authorization: <token>' \
  --data-urlencode 'paginate=true' \
  --data-urlencode 'limit=500' \
  --data-urlencode 'employee.id=6' \
  --data-urlencode 'date=>=2026-10-01T00:00:00Z&<2026-11-01T00:00:00Z' \
  --data-urlencode 'sort[date]=asc'

One row for each employee and day. The schedule is made in advance, so rows also exist for future days.

FieldMeaning
date, employee_idThe day (local date) and the employee.
isWorkingA working day.
start, endStart and end of work in the local time of the shift. The values end in Z but are not converted to UTC: a shift from 06:00 shows 06:00:00Z.
workDurationWorking time of the day in seconds, from the shift or as changed in the schedule.
overtimeDuration, nightDurationOvertime and night work in seconds.
onPremisesDurationTime the employee actually spent on the premises in seconds, from the entrance records.
isChangedTimeThe day was changed by hand.
commentsComments.

Entrance records

GET /api/entrance_log/search?created=>=2026-10-01T00:00:00Z%26<2026-11-01T00:00:00Z&sort[created]=asc

Each pass through a door with a card or other identifier: created (date and time), doorName, isEntranceDoor (entrance or exit), admit (the person was let in), personId and personName.

Work time with an API key

Work time is not available with an API key. Use a login (API basics → Access, way 1).