Integration API API reference
Reference data
The calling key, its institutions and the event catalog: what you need to read everything else. Any valid key.
Get key#
/integration/keyScope: any keyThe calling key's own name, scopes, institutions, rate limit and expiry.
An all-institutions key has "allInstitutions": true and an empty institutionIds. expiresAt (epoch seconds) appears when the key expires.
curl -s "$MASK/integration/key" -H "Authorization: Bearer $KEY"
{
"id": 26,
"name": "Docs example: payroll pull (Docs Example School)",
"scopes": ["employees:read", "cards:read", "events:read", "sessions:read", "reports:read"],
"allInstitutions": false,
"institutionIds": [1],
"rateLimitPerMinute": 120
}
Responses
Fields of KeyInfo
allInstitutionsbooleantrue = every institution, including ones created later; institutionIds is then empty
expiresAtintegerEpoch seconds; absent when the key does not expire
idintegerinstitutionIdsarray of integernamestringrateLimitPerMinuteintegerRequests per minute; also sent as X-RateLimit-Limit
scopesarray of stringCanonical scope strings, e.g. events:read
Errors this route can answer
- 401Unauthorized
invalid_api_keykey_expiredkey_revoked - 403Forbidden
ip_not_allowedscope_missinginstitution_not_allowednot_api_eventadmin_linked_employee - 429Too Many Requests
rate_limited - 500Internal Server Error
internal_error - 503Service Unavailable
unavailable
Each error has the same JSON body; see Errors for what every code means.
List institutions#
/integration/institutionsScope: any keyThe institutions the key covers, by id, with their timezone, day boundary, status and enabled event codes.
Archived institutions are included. timezone and dayBoundaryMinutes are what you need to interpret times, and enabledEventCodes lists the codes accepted there: an event with another code is refused. status is active, inactive or archived.
curl -s "$MASK/integration/institutions" -H "Authorization: Bearer $KEY"
[
{
"id": 1,
"name": "Docs Example School",
"shortName": "DES",
"displayName": "DES",
"timezone": "Europe/Sarajevo",
"dayBoundaryMinutes": 240,
"status": "active",
"enabledEventCodes": ["clock_in", "clock_out"]
}
]
Responses
Fields of Institution
dayBoundaryMinutesintegerMinutes after local midnight when its business day starts (240 = 04:00)
displayNamestringenabledEventCodesarray of stringThe event codes enabled here; an event with another code is refused
idintegernamestringshortNamestringstatusstringactive, inactive or archived
timezonestringIANA zone of its business dates, e.g. Europe/Sarajevo
Errors this route can answer
- 401Unauthorized
invalid_api_keykey_expiredkey_revoked - 403Forbidden
ip_not_allowedscope_missinginstitution_not_allowednot_api_eventadmin_linked_employee - 429Too Many Requests
rate_limited - 500Internal Server Error
internal_error - 503Service Unavailable
unavailable
Each error has the same JSON body; see Errors for what every code means.
Get institution#
/integration/institutions/{id}Scope: any keyOne institution the key covers; 404 for any other.
An institution outside the key:
curl -s "$MASK/integration/institutions/4" -H "Authorization: Bearer $KEY" # a key that covers only institution 1
{"status": "error", "code": "not_found", "message": "Institution with ID 4 not found", "requestId": "08a620e2-d578-486d-a714-dc4ab77bf57b"}
Parameters
idpathintegerrequired
Responses
Fields of Institution
dayBoundaryMinutesintegerMinutes after local midnight when its business day starts (240 = 04:00)
displayNamestringenabledEventCodesarray of stringThe event codes enabled here; an event with another code is refused
idintegernamestringshortNamestringstatusstringactive, inactive or archived
timezonestringIANA zone of its business dates, e.g. Europe/Sarajevo
Errors this route can answer
- 400Bad Request
validation_failedidempotency_requiredevent_too_old - 401Unauthorized
invalid_api_keykey_expiredkey_revoked - 403Forbidden
ip_not_allowedscope_missinginstitution_not_allowednot_api_eventadmin_linked_employee - 404Not Found
not_found - 429Too Many Requests
rate_limited - 500Internal Server Error
internal_error - 503Service Unavailable
unavailable
Each error has the same JSON body; see Errors for what every code means.
List event codes#
/integration/event-codesScope: any keyThe event catalog: every code with what it does to a shift.
opensInterval is the kind of stretch the code starts (work, break, personal, business), absent for a code that only closes. The catalog changes rarely: reading it once a day is enough.
curl -s "$MASK/integration/event-codes" -H "Authorization: Bearer $KEY"
[
{"code": "clock_in", "displayName": "Clock in", "opensSession": true, "closesSession": false, "opensInterval": "work", "countsAsWork": true, "sortOrder": 10},
{"code": "clock_out", "displayName": "Clock out", "opensSession": false, "closesSession": true, "countsAsWork": false, "sortOrder": 20},
{"code": "break_start", "displayName": "Break start", "opensSession": false, "closesSession": false, "opensInterval": "break", "countsAsWork": false, "sortOrder": 30},
{"code": "break_end", "displayName": "Break end", "opensSession": false, "closesSession": false, "opensInterval": "work", "countsAsWork": true, "sortOrder": 40},
{"code": "business_exit", "displayName": "Business exit", "opensSession": false, "closesSession": false, "opensInterval": "business", "countsAsWork": true, "sortOrder": 50},
{"code": "business_return", "displayName": "Business return", "opensSession": false, "closesSession": false, "opensInterval": "work", "countsAsWork": true, "sortOrder": 60},
{"code": "personal_exit", "displayName": "Personal exit", "opensSession": false, "closesSession": false, "opensInterval": "personal", "countsAsWork": false, "sortOrder": 70},
{"code": "personal_return", "displayName": "Personal return", "opensSession": false, "closesSession": false, "opensInterval": "work", "countsAsWork": true, "sortOrder": 80}
]
Responses
Fields of EventCode
closesSessionbooleanEnds a shift (clock_out)
codestringcountsAsWorkbooleandisplayNamestringopensIntervalstringThe interval kind it opens: work, break, personal or business; absent when it only closes
opensSessionbooleanStarts a shift (clock_in)
sortOrderinteger
Errors this route can answer
- 401Unauthorized
invalid_api_keykey_expiredkey_revoked - 403Forbidden
ip_not_allowedscope_missinginstitution_not_allowednot_api_eventadmin_linked_employee - 429Too Many Requests
rate_limited - 500Internal Server Error
internal_error - 503Service Unavailable
unavailable
Each error has the same JSON body; see Errors for what every code means.