{"openapi":"3.0.3","info":{"title":"Iriana Time API","version":"0.3.1","description":"Staff attendance records. Send `Authorization: Bearer ta_…`. Key scopes: read (get data), write (read, and send records in), operate (read, device reads and staff changes on the terminal). Keys are made on the Integrations page and shown once. Dates are Gregorian YYYY-MM-DD; punch times are given in UTC together with the terminal's own local text. Send X-Correlation-ID to find a call in the logs."},"components":{"securitySchemes":{"appKey":{"type":"http","scheme":"bearer"}}},"paths":{"/health":{"get":{"summary":"Service health","description":"Open.","responses":{"200":{"description":"OK"}}}},"/api/v1/openapi.json":{"get":{"summary":"This description","description":"Open.","responses":{"200":{"description":"OK"}}}},"/api/v1/punches":{"get":{"summary":"Punches in arrival order. Poll with afterId = the last nextAfterId to receive each record once.","description":"Key scope: read.","security":[{"appKey":[]}],"parameters":[{"name":"afterId","in":"query","required":false,"description":"Only records after this id","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"At most 1000","schema":{"type":"integer"}},{"name":"day","in":"query","required":false,"description":"Device calendar day, or 'today'","schema":{"type":"string"}},{"name":"from","in":"query","required":false,"description":"UTC from (ISO date-time)","schema":{"type":"string"}},{"name":"to","in":"query","required":false,"description":"UTC before (ISO date-time)","schema":{"type":"string"}},{"name":"deviceSn","in":"query","required":false,"description":"One device","schema":{"type":"string"}},{"name":"enrollId","in":"query","required":false,"description":"One staff number","schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"401":{"description":"No or wrong key"},"403":{"description":"The key may not do this"}}}},"/api/v1/punches/stream":{"get":{"summary":"New punches pushed as they are saved (server-sent events: ready, punch, rejected, status, progress)","description":"Key scope: read.","security":[{"appKey":[]}],"responses":{"200":{"description":"OK"},"401":{"description":"No or wrong key"},"403":{"description":"The key may not do this"}}}},"/api/v1/records":{"get":{"summary":"Records by device calendar day, newest first, with totals","description":"Key scope: read.","security":[{"appKey":[]}],"parameters":[{"name":"from","in":"query","required":false,"description":"First day","schema":{"type":"string","format":"date"}},{"name":"to","in":"query","required":false,"description":"Last day","schema":{"type":"string","format":"date"}},{"name":"q","in":"query","required":false,"description":"Name part or staff number","schema":{"type":"string"}},{"name":"flagged","in":"query","required":false,"description":"1: only punches the device marked","schema":{"type":"string"}},{"name":"cursor","in":"query","required":false,"description":"nextCursor of the page before","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"At most 500","schema":{"type":"integer"}}],"responses":{"200":{"description":"OK"},"401":{"description":"No or wrong key"},"403":{"description":"The key may not do this"}}}},"/api/v1/records.csv":{"get":{"summary":"The same records as a CSV file (UTF-8 with BOM), at most 100000 rows","description":"Key scope: read.","security":[{"appKey":[]}],"parameters":[{"name":"from","in":"query","required":false,"description":"First day","schema":{"type":"string","format":"date"}},{"name":"to","in":"query","required":false,"description":"Last day","schema":{"type":"string","format":"date"}},{"name":"q","in":"query","required":false,"description":"Name part or staff number","schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"401":{"description":"No or wrong key"},"403":{"description":"The key may not do this"}}}},"/api/v1/export.xlsx":{"get":{"summary":"Excel file with up to four sheets (per person, per day, detected shifts, all punches) plus the filters used. At most 100000 rows per sheet.","description":"Key scope: read.","security":[{"appKey":[]}],"parameters":[{"name":"from","in":"query","required":false,"description":"First day","schema":{"type":"string","format":"date"}},{"name":"to","in":"query","required":false,"description":"Last day","schema":{"type":"string","format":"date"}},{"name":"ids","in":"query","required":false,"description":"Staff numbers, comma separated (one person or several)","schema":{"type":"string"}},{"name":"q","in":"query","required":false,"description":"Name part or staff number","schema":{"type":"string"}},{"name":"deviceSn","in":"query","required":false,"description":"One device","schema":{"type":"string"}},{"name":"mode","in":"query","required":false,"description":"The device's method code","schema":{"type":"integer"}},{"name":"timeFrom","in":"query","required":false,"description":"Only punches from this time of day, HH:MM","schema":{"type":"string"}},{"name":"timeTo","in":"query","required":false,"description":"Only punches up to this time of day, HH:MM","schema":{"type":"string"}},{"name":"flagged","in":"query","required":false,"description":"1: only punches the device marked","schema":{"type":"string"}},{"name":"single","in":"query","required":false,"description":"1: the per-day sheet lists only days with one punch","schema":{"type":"string"}},{"name":"sheets","in":"query","required":false,"description":"summary,days,shifts,punches (default: all four)","schema":{"type":"string"}},{"name":"lang","in":"query","required":false,"description":"fa (default) or en","schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"401":{"description":"No or wrong key"},"403":{"description":"The key may not do this"}}}},"/api/v1/export/preview":{"get":{"summary":"How many punches, person-days and people the same filters select","description":"Key scope: read.","security":[{"appKey":[]}],"parameters":[{"name":"from","in":"query","required":false,"description":"First day","schema":{"type":"string","format":"date"}},{"name":"to","in":"query","required":false,"description":"Last day","schema":{"type":"string","format":"date"}},{"name":"ids","in":"query","required":false,"description":"Staff numbers, comma separated (one person or several)","schema":{"type":"string"}},{"name":"q","in":"query","required":false,"description":"Name part or staff number","schema":{"type":"string"}},{"name":"deviceSn","in":"query","required":false,"description":"One device","schema":{"type":"string"}},{"name":"mode","in":"query","required":false,"description":"The device's method code","schema":{"type":"integer"}},{"name":"timeFrom","in":"query","required":false,"description":"Only punches from this time of day, HH:MM","schema":{"type":"string"}},{"name":"timeTo","in":"query","required":false,"description":"Only punches up to this time of day, HH:MM","schema":{"type":"string"}},{"name":"flagged","in":"query","required":false,"description":"1: only punches the device marked","schema":{"type":"string"}},{"name":"single","in":"query","required":false,"description":"1: the per-day sheet lists only days with one punch","schema":{"type":"string"}},{"name":"sheets","in":"query","required":false,"description":"summary,days,shifts,punches (default: all four)","schema":{"type":"string"}},{"name":"lang","in":"query","required":false,"description":"fa (default) or en","schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"401":{"description":"No or wrong key"},"403":{"description":"The key may not do this"}}}},"/api/v1/records/range":{"get":{"summary":"The first day with a record","description":"Key scope: read.","security":[{"appKey":[]}],"responses":{"200":{"description":"OK"},"401":{"description":"No or wrong key"},"403":{"description":"The key may not do this"}}}},"/api/v1/reports/timesheet":{"get":{"summary":"Per person: days with a punch, punches, days with one punch only, minutes from first to last punch. Not worked time.","description":"Key scope: read.","security":[{"appKey":[]}],"parameters":[{"name":"from","in":"query","required":false,"description":"First day","schema":{"type":"string","format":"date"}},{"name":"to","in":"query","required":false,"description":"Last day, at most 62 days","schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"OK"},"401":{"description":"No or wrong key"},"403":{"description":"The key may not do this"}}}},"/api/v1/reports/timesheet/days":{"get":{"summary":"One person, day by day","description":"Key scope: read.","security":[{"appKey":[]}],"parameters":[{"name":"deviceSn","in":"query","required":true,"description":"Device","schema":{"type":"string"}},{"name":"enrollId","in":"query","required":true,"description":"Staff number","schema":{"type":"string"}},{"name":"from","in":"query","required":false,"description":"First day","schema":{"type":"string","format":"date"}},{"name":"to","in":"query","required":false,"description":"Last day, at most 62 days","schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"OK"},"401":{"description":"No or wrong key"},"403":{"description":"The key may not do this"}}}},"/api/v1/overview":{"get":{"summary":"Today, the last 14 days and the terminals","description":"Key scope: read.","security":[{"appKey":[]}],"responses":{"200":{"description":"OK"},"401":{"description":"No or wrong key"},"403":{"description":"The key may not do this"}}}},"/api/v1/people/{deviceSn}/{enrollId}":{"get":{"summary":"One person: name, first and last punch, and their punches in a period of at most 62 days. Staff numbers come from /api/v1/device-users.","description":"Key scope: read.","security":[{"appKey":[]}],"parameters":[{"name":"deviceSn","in":"path","required":true,"schema":{"type":"string"}},{"name":"enrollId","in":"path","required":true,"schema":{"type":"string"}},{"name":"from","in":"query","required":false,"description":"First day","schema":{"type":"string","format":"date"}},{"name":"to","in":"query","required":false,"description":"Last day","schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"OK"},"401":{"description":"No or wrong key"},"403":{"description":"The key may not do this"}}}},"/api/v1/presence":{"get":{"summary":"Who was at work: everyone whose shift began on a day or ran into it, who was in at a moment, and who usually works that weekday but has no punch. Estimates from punch times.","description":"Key scope: read.","security":[{"appKey":[]}],"parameters":[{"name":"date","in":"query","required":false,"description":"The day (default today)","schema":{"type":"string","format":"date"}},{"name":"at","in":"query","required":false,"description":"HH:MM: who was in at that moment (default now for today)","schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"401":{"description":"No or wrong key"},"403":{"description":"The key may not do this"}}}},"/api/v1/shifts":{"get":{"summary":"Shift types, types suggested from the data, and everyone's usual shifts","description":"Key scope: read.","security":[{"appKey":[]}],"responses":{"200":{"description":"OK"},"401":{"description":"No or wrong key"},"403":{"description":"The key may not do this"}}}},"/api/v1/shifts/types":{"put":{"summary":"Replace the list of shift types","description":"Key scope: operate.","security":[{"appKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["types"],"properties":{"types":{"type":"array","items":{"type":"object","required":["name","start","end"],"properties":{"id":{"type":"integer"},"name":{"type":"string"},"start":{"type":"string","description":"HH:MM"},"end":{"type":"string","description":"HH:MM; at or before the start means the next day"}}}}}}}}},"responses":{"200":{"description":"OK"},"401":{"description":"No or wrong key"},"403":{"description":"The key may not do this"}}}},"/api/v1/shifts/people/{deviceSn}/{enrollId}":{"put":{"summary":"Set a person's usual shifts by hand; an empty list learns them again","description":"Key scope: operate.","security":[{"appKey":[]}],"parameters":[{"name":"deviceSn","in":"path","required":true,"schema":{"type":"string"}},{"name":"enrollId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["typeIds"],"properties":{"typeIds":{"type":"array","items":{"type":"integer"}}}}}}},"responses":{"200":{"description":"OK"},"401":{"description":"No or wrong key"},"403":{"description":"The key may not do this"}}}},"/api/v1/insights":{"get":{"summary":"Dashboard figures: today, the usual level by hour, 30-day trend, shift families and what needs a look","description":"Key scope: read.","security":[{"appKey":[]}],"responses":{"200":{"description":"OK"},"401":{"description":"No or wrong key"},"403":{"description":"The key may not do this"}}}},"/api/v1/devices":{"get":{"summary":"Terminals, online state, clock difference, capacity","description":"Key scope: read.","security":[{"appKey":[]}],"responses":{"200":{"description":"OK"},"401":{"description":"No or wrong key"},"403":{"description":"The key may not do this"}}}},"/api/v1/device-users":{"get":{"summary":"Staff numbers seen, with current and previous name","description":"Key scope: read.","security":[{"appKey":[]}],"responses":{"200":{"description":"OK"},"401":{"description":"No or wrong key"},"403":{"description":"The key may not do this"}}}},"/api/v1/rejected":{"get":{"summary":"Records that were not accepted, with reasons","description":"Key scope: read.","security":[{"appKey":[]}],"parameters":[{"name":"from","in":"query","required":false,"description":"First day","schema":{"type":"string","format":"date"}},{"name":"to","in":"query","required":false,"description":"Last day","schema":{"type":"string","format":"date"}},{"name":"limit","in":"query","required":false,"description":"At most 500","schema":{"type":"integer"}}],"responses":{"200":{"description":"OK"},"401":{"description":"No or wrong key"},"403":{"description":"The key may not do this"}}}},"/api/v1/staff":{"get":{"summary":"The terminal's staff list and its change log","description":"Key scope: read.","security":[{"appKey":[]}],"responses":{"200":{"description":"OK"},"401":{"description":"No or wrong key"},"403":{"description":"The key may not do this"}}},"post":{"summary":"Add a person to the terminal (only when staff management is switched on)","description":"Key scope: operate.","security":[{"appKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["enrollId","name"],"properties":{"enrollId":{"type":"string"},"name":{"type":"string"}}}}}},"responses":{"200":{"description":"OK"},"401":{"description":"No or wrong key"},"403":{"description":"The key may not do this"}}}},"/api/v1/import/punches":{"post":{"summary":"Send punch records in. They are stored under the source api:<app> and never as a terminal's. Sending the same record again changes nothing.","description":"Key scope: write.","security":[{"appKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["records"],"properties":{"records":{"type":"array","maxItems":500,"items":{"type":"object","required":["enrollId","time"],"properties":{"enrollId":{"type":"integer","description":"Staff number"},"time":{"type":"string","description":"Local site time, 'YYYY-MM-DD HH:MM:SS'"},"name":{"type":"string"},"mode":{"type":"integer"},"inout":{"type":"integer"},"event":{"type":"integer"}}}}}}}}},"responses":{"200":{"description":"Counts: received, inserted, duplicates, rejected, with the reason for each rejection"},"401":{"description":"No or wrong key"},"403":{"description":"The key may not send records"}}}},"/api/v1/devices/refused":{"get":{"summary":"Connections the device gate refused","description":"Key scope: operate.","security":[{"appKey":[]}],"responses":{"200":{"description":"OK"},"401":{"description":"No or wrong key"},"403":{"description":"The key may not do this"}}}},"/api/v1/devices/{sn}/read":{"post":{"summary":"Read safe device fields","description":"Key scope: operate.","security":[{"appKey":[]}],"parameters":[{"name":"sn","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"command":{"type":"string","enum":["getdevinfo","getdevcap"]}}}}}},"responses":{"200":{"description":"OK"},"401":{"description":"No or wrong key"},"403":{"description":"The key may not do this"}}}},"/api/v1/devices/{sn}/pull-history":{"post":{"summary":"Copy a date range from the terminal's log into the records; safe to repeat","description":"Key scope: operate.","security":[{"appKey":[]}],"parameters":[{"name":"sn","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["from","to"],"properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}}}}}},"responses":{"200":{"description":"OK"},"401":{"description":"No or wrong key"},"403":{"description":"The key may not do this"}}}}}}