^Login

API Roster

The roster actions read and write rostered shifts. get_roster returns the shifts for up to 31 days. add_roster replaces the shifts for the dates and Locations you send, so your software can keep part or all of a Microkeeper roster in step with its own.

Actionsget_roster, add_roster
Business key accessRoster: Read Only to get, Read/Write to add

This guide covers how to:

  1. Get the roster.
  2. Send a roster.

Before you start, make your keys and test your connection: see Microkeeper API. You'll need the Location IDs from API Locations, and the Job and Role IDs from API Jobs and API Roles.


Get the roster with get_roster

Send a date range of up to 31 days:

FieldValue
mk_actionget_roster
mk_data{"start_date":"2026-06-01","end_date":"2026-06-07"}

Response

{
"success": "1",
"authenticated": "1",
"message": "Roster data",
"data": {
"roster": [
{
"date": "2026-06-01",
"LID": "14227",
"ROID": "681",
"JID": "0",
"eusername": "william_smith",
"EID": "53466",
"start": "17:00:00",
"end": "22:00:00",
"break": "00:00:00",
"hide": "0",
"note": "",
"checked": "0"
}
]
}
}

Every shift at an active Location is returned, for all staff:

FieldWhat it is
dateThe day the shift starts, YYYY-MM-DD
LIDThe shift's Location ID
ROIDThe shift's Role ID, or 0
JIDThe shift's Job ID. If the shift has none, the Role's default Job, then the Location's. 0 if none of them has one
eusername, EIDThe employee rostered. An open shift has a blank eusername and EID 0
start, endStart and finish times, HH:MM:SS. A shift past midnight finishes on an earlier time, such as 23:00:00 to 03:00:00
breakThe break time stored with the shift, HH:MM:SS
hide"1" if the shift is hidden from the employee
noteThe shift's note, with double quotes and apostrophes removed
checkedThe employee's answer: "0" not yet, "1" accepted, "2" declined

Shifts are listed by week, then Location, then the day's name in alphabetical order, so Friday comes before Monday. Sort them by date and start in your software if you need them in date order.

Errors

  • Missing field either start_date or end_date
  • start_date must be before or equal to end_date
  • A maximum of 31 days can be selected: split longer ranges into several requests.
  • No roster data between 2026-06-01 and 2026-06-07: there are no shifts in the range.

Send a roster with add_roster

add_roster deletes every shift in the date range at the Locations you list, then adds the shifts you send. Your software is the source of truth for those dates and Locations:

  • Send the whole roster for the range each time. A day in the range with no shifts sent is left empty, so a Monday-to-Sunday range with only Monday-to-Friday shifts clears the weekend.
  • Only the Locations in config.LID change. Other Locations, such as ones your team rosters in Microkeeper, are left as they are.
  • To change or remove a shift, send the range again without it, or with it changed.
  • Each request needs at least one shift, so an empty list can never clear a range by mistake. To remove shifts, send the range again with the shifts you want to keep.
  • A shift you send again unchanged, with the same employee, day, start, end and Location, keeps its Role, the employee's accept or decline answer, and its lock. A new or changed shift has no Role unless you send ROID, and the employee hasn't answered it yet.

Warning

add_roster replaces shifts in locked roster weeks too. A locked shift you leave out or change is deleted, so only send ranges your software should control.

Example

{
"config": {
"method": "replace",
"start_date": "2026-12-07",
"end_date": "2026-12-13",
"LID": [14227]
},
"shifts": [
{
"eusername": "ava_patel",
"LID": 14227,
"date": "2026-12-07",
"start": "17:00",
"end": "21:00",
"ROID": 681,
"JID": 1100,
"note": "Booked by the rostering partner"
},
{
"EID": 0,
"LID": 14227,
"date": "2026-12-11",
"start": "23:00",
"end": "03:00"
}
]
}

The second shift is an open shift that finishes at 3 am the next day. A request with only open shifts works too.

config fields

FieldRequiredWhat it is
methodYesreplace
start_date, end_dateYesThe dates to replace, YYYY-MM-DD, up to 31 days
LIDYesA list of the Location IDs to replace, such as [14227, 14228]

shifts fields

FieldRequiredWhat it is
eusername or EIDOne of themThe employee. Send EID 0 or a blank eusername for an open shift. If both are sent, EID is used
LIDYesThe Location ID. It must be in config.LID
dateYesThe day the shift starts, YYYY-MM-DD, inside the range
start, endYesHH:MM or HH:MM:SS. For a shift past midnight, send the finish as the time on the next day, such as 03:00. A shift can be up to 23 hours 59 minutes
ROIDNoThe Role ID. It must be an active Role. Send 0 to clear the shift's Role. If you leave it out, a shift sent again unchanged keeps its Role and any other shift has none
JIDNoThe Job ID
breakNoA break time to store with the shift, HH:MM:SS. Defaults to 00:00:00
hideNo1 to hide the shift from the employee. Defaults to 0
noteNoA note on the shift

Shifts are added in the order you send them. Every Location, Role and Job ID in the shifts is checked, and one that isn't on record stops the request. An employee who isn't found doesn't stop it: the shift is added as an open shift. Check each employee against get_employees before you send.

Response

{ "success":"1", "authenticated":"1", "message":"Shifts successfully inserted", "data": { "count": 2 } }

count is the number of shifts added. Compare it with the number you sent.

Errors

An error stops the request, and nothing is changed. The line numbers count from 0.

MessageWhat to check
config array not set, method, start_date or end_date fields not setconfig has method, start_date and end_date
method must be set to replacemethod is replace
start_date must be before or equal to end_datestart_date isn't after end_date
LID is not set or not a list arrayconfig.LID is a list, such as [14227]
A maximum of 31 days can be selectedThe range is 31 days or less
shifts array not setshifts is a list
Roster record missing EID or eusername on line 0Each shift has EID or eusername
shifts must include at least one shiftshifts lists at least one shift
LID field missingEach shift has LID
LID not included in LID replace array, LID 14228The shift's Location is in config.LID
date field missing on line 0Each shift has date
date 2026-12-14 could not be found line 0The date is YYYY-MM-DD and inside the range
start or end field missing on line 0Each shift has start and end
999999 LID not on record, 999999 JID not on recordEvery Location in the shifts is active, and every Job exists
999999 ROID not on recordEvery Role in the shifts is active