MASKDocs

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#

GET/integration/keyScope: any key

The 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

200OKKeyInfo
Fields of KeyInfo
  • allInstitutionsboolean

    true = every institution, including ones created later; institutionIds is then empty

  • expiresAtinteger

    Epoch seconds; absent when the key does not expire

  • idinteger
  • institutionIdsarray of integer
  • namestring
  • rateLimitPerMinuteinteger

    Requests per minute; also sent as X-RateLimit-Limit

  • scopesarray of string

    Canonical scope strings, e.g. events:read

Errors this route can answer
  • 401Unauthorizedinvalid_api_keykey_expiredkey_revoked
  • 403Forbiddenip_not_allowedscope_missinginstitution_not_allowednot_api_eventadmin_linked_employee
  • 429Too Many Requestsrate_limited
  • 500Internal Server Errorinternal_error
  • 503Service Unavailableunavailable

Each error has the same JSON body; see Errors for what every code means.

List institutions#

GET/integration/institutionsScope: any key

The 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

200OKarray of Institution
Fields of Institution
  • dayBoundaryMinutesinteger

    Minutes after local midnight when its business day starts (240 = 04:00)

  • displayNamestring
  • enabledEventCodesarray of string

    The event codes enabled here; an event with another code is refused

  • idinteger
  • namestring
  • shortNamestring
  • statusstring

    active, inactive or archived

  • timezonestring

    IANA zone of its business dates, e.g. Europe/Sarajevo

Errors this route can answer
  • 401Unauthorizedinvalid_api_keykey_expiredkey_revoked
  • 403Forbiddenip_not_allowedscope_missinginstitution_not_allowednot_api_eventadmin_linked_employee
  • 429Too Many Requestsrate_limited
  • 500Internal Server Errorinternal_error
  • 503Service Unavailableunavailable

Each error has the same JSON body; see Errors for what every code means.

Get institution#

GET/integration/institutions/{id}Scope: any key

One 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

200OKInstitution
Fields of Institution
  • dayBoundaryMinutesinteger

    Minutes after local midnight when its business day starts (240 = 04:00)

  • displayNamestring
  • enabledEventCodesarray of string

    The event codes enabled here; an event with another code is refused

  • idinteger
  • namestring
  • shortNamestring
  • statusstring

    active, inactive or archived

  • timezonestring

    IANA zone of its business dates, e.g. Europe/Sarajevo

Errors this route can answer
  • 400Bad Requestvalidation_failedidempotency_requiredevent_too_old
  • 401Unauthorizedinvalid_api_keykey_expiredkey_revoked
  • 403Forbiddenip_not_allowedscope_missinginstitution_not_allowednot_api_eventadmin_linked_employee
  • 404Not Foundnot_found
  • 429Too Many Requestsrate_limited
  • 500Internal Server Errorinternal_error
  • 503Service Unavailableunavailable

Each error has the same JSON body; see Errors for what every code means.

List event codes#

GET/integration/event-codesScope: any key

The 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

200OKarray of EventCode
Fields of EventCode
  • closesSessionboolean

    Ends a shift (clock_out)

  • codestring
  • countsAsWorkboolean
  • displayNamestring
  • opensIntervalstring

    The interval kind it opens: work, break, personal or business; absent when it only closes

  • opensSessionboolean

    Starts a shift (clock_in)

  • sortOrderinteger
Errors this route can answer
  • 401Unauthorizedinvalid_api_keykey_expiredkey_revoked
  • 403Forbiddenip_not_allowedscope_missinginstitution_not_allowednot_api_eventadmin_linked_employee
  • 429Too Many Requestsrate_limited
  • 500Internal Server Errorinternal_error
  • 503Service Unavailableunavailable

Each error has the same JSON body; see Errors for what every code means.