{"openapi":"3.1.0","info":{"title":"QRONEX API","version":"1.0.0","description":"Read verified attendance and keep employees in sync.\n\n**No endpoint creates punches** \u2014 attendance only comes from the QRONEX app after server-side checks.\n\nRate limit: 120 requests\/min per key (429 + Retry-After). Times are ISO-8601 UTC; `from`\/`to` dates are IST."},"servers":[{"url":"https:\/\/qronex.app\/api\/v1"}],"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"Company API key `qrx_live_\u2026` from Portal \u2192 API & webhooks. Scopes: offices:read, employees:read, employees:write, attendance:read, attendance:export, remote:write, webhooks:manage"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}}}}},"Office":{"type":"object","properties":{"office_code":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"lat":{"type":"number"},"lng":{"type":"number"},"geofence_radius_m":{"type":"integer"},"timezone":{"type":"string"},"is_active":{"type":"boolean"},"gates":{"type":"array","items":{"type":"object","properties":{"gate_code":{"type":"string"},"name":{"type":"string"},"is_active":{"type":"boolean"}}}}}},"Employee":{"type":"object","properties":{"employee_code":{"type":"string"},"name":{"type":"string"},"email":{"type":["string","null"]},"mobile":{"type":["string","null"]},"department":{"type":["string","null"]},"designation":{"type":["string","null"]},"hrms_ref":{"type":["string","null"]},"office_code":{"type":"string"},"status":{"type":"string","enum":["active","inactive"]},"updated_at":{"type":"string","format":"date-time"}}},"EmployeeInput":{"type":"object","properties":{"employee_code":{"type":"string","description":"Create only"},"name":{"type":"string"},"office_code":{"type":"string"},"email":{"type":"string"},"mobile":{"type":"string"},"department":{"type":"string"},"designation":{"type":"string"},"hrms_ref":{"type":"string"}}},"AttendanceEvent":{"type":"object","properties":{"id":{"type":"string","example":"QRX-00001289"},"type":{"type":"string","enum":["IN","OUT"]},"mode":{"type":"string","example":"OFFICE_QR"},"recorded_at":{"type":"string","format":"date-time"},"employee_code":{"type":"string"},"employee_name":{"type":"string"},"hrms_ref":{"type":["string","null"]},"office_code":{"type":"string"},"gate_code":{"type":"string"},"location":{"type":"object","properties":{"distance_m":{"type":"integer"},"accuracy_m":{"type":"integer"}}}}},"Webhook":{"type":"object","properties":{"id":{"type":"integer"},"url":{"type":"string"},"description":{"type":["string","null"]},"events":{"type":"array","items":{"type":"string","enum":["attendance.created","device.approved","employee.deactivated","attendance.adjusted","remote_permission.approved"]}},"is_active":{"type":"boolean"},"secret":{"type":"string","description":"Only returned on create"}}}}},"paths":{"\/offices":{"get":{"summary":"List offices and gates","security":[{"apiKey":["offices:read"]}],"x-scope":"offices:read","responses":{"200":{"description":"OK","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Office"}}}}}}},"401":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/employees":{"get":{"summary":"List employees (cursor paginated)","security":[{"apiKey":["employees:read"]}],"x-scope":"employees:read","parameters":[{"name":"cursor","in":"query","required":false,"description":"Cursor from next_cursor","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"1\u2013500, default 100","schema":{"type":"integer"}},{"name":"office_code","in":"query","required":false,"description":"Filter","schema":{"type":"string"}},{"name":"status","in":"query","required":false,"description":"active|inactive","schema":{"type":"string"}},{"name":"updated_since","in":"query","required":false,"description":"ISO date-time \u2014 for incremental sync","schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"OK","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Employee"}},"next_cursor":{"type":["string","null"],"description":"Pass as ?cursor= for the next page"}}}}}},"401":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}},"post":{"summary":"Create an employee","security":[{"apiKey":["employees:write"]}],"x-scope":"employees:write","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Retry-safe POST\/PATCH: same key + same body replays the first response","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/EmployeeInput"}}}},"responses":{"201":{"description":"Created","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/Employee"}}}}}},"422":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/employees\/{code}":{"get":{"summary":"Get one employee","security":[{"apiKey":["employees:read"]}],"x-scope":"employees:read","parameters":[{"name":"code","in":"path","required":true,"schema":{"type":"string"},"example":"EMP0001"}],"responses":{"200":{"description":"OK","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/Employee"}}}}}},"404":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}},"patch":{"summary":"Update employee details or office","security":[{"apiKey":["employees:write"]}],"x-scope":"employees:write","parameters":[{"name":"code","in":"path","required":true,"schema":{"type":"string"},"example":"EMP0001"},{"name":"Idempotency-Key","in":"header","required":false,"description":"Retry-safe POST\/PATCH: same key + same body replays the first response","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/EmployeeInput"}}}},"responses":{"200":{"description":"OK","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/Employee"}}}}}},"404":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/employees\/{code}\/deactivate":{"post":{"summary":"Deactivate an employee and revoke their phones","security":[{"apiKey":["employees:write"]}],"x-scope":"employees:write","parameters":[{"name":"code","in":"path","required":true,"schema":{"type":"string"},"example":"EMP0001"},{"name":"Idempotency-Key","in":"header","required":false,"description":"Retry-safe POST\/PATCH: same key + same body replays the first response","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/Employee"}}}}}},"404":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/attendance\/events":{"get":{"summary":"List verified IN\/OUT events (cursor paginated, oldest first)","security":[{"apiKey":["attendance:read"]}],"x-scope":"attendance:read","parameters":[{"name":"from","in":"query","required":false,"description":"Date (IST), default today","schema":{"type":"string","format":"date"}},{"name":"to","in":"query","required":false,"description":"Date (IST), default = from; max 93 days","schema":{"type":"string","format":"date"}},{"name":"office_code","in":"query","required":false,"description":"e.g. HYD01","schema":{"type":"string"}},{"name":"employee_code","in":"query","required":false,"description":"e.g. EMP0001","schema":{"type":"string"}},{"name":"type","in":"query","required":false,"description":"IN or OUT","schema":{"type":"string","enum":["IN","OUT"]}},{"name":"cursor","in":"query","required":false,"description":"Cursor from next_cursor","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"1\u2013500, default 100","schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/AttendanceEvent"}},"next_cursor":{"type":["string","null"],"description":"Pass as ?cursor= for the next page"}}}}}},"422":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/attendance\/events\/{ref}":{"get":{"summary":"Get one event","security":[{"apiKey":["attendance:read"]}],"x-scope":"attendance:read","parameters":[{"name":"ref","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/AttendanceEvent"}}}}}},"404":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/attendance\/export":{"get":{"summary":"Download events as CSV","security":[{"apiKey":["attendance:export"]}],"x-scope":"attendance:export","parameters":[{"name":"from","in":"query","required":false,"description":"Date (IST), default today","schema":{"type":"string","format":"date"}},{"name":"to","in":"query","required":false,"description":"Date (IST), default = from; max 93 days","schema":{"type":"string","format":"date"}},{"name":"office_code","in":"query","required":false,"description":"e.g. HYD01","schema":{"type":"string"}},{"name":"employee_code","in":"query","required":false,"description":"e.g. EMP0001","schema":{"type":"string"}},{"name":"type","in":"query","required":false,"description":"IN or OUT","schema":{"type":"string","enum":["IN","OUT"]}}],"responses":{"200":{"description":"CSV","content":{"text\/csv":{"schema":{"type":"string"}}}},"401":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/remote-permissions":{"get":{"summary":"List remote \/ field permissions","security":[{"apiKey":["remote:write"]}],"x-scope":"remote:write","parameters":[{"name":"cursor","in":"query","required":false,"description":"Cursor from next_cursor","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"1\u2013500, default 100","schema":{"type":"integer"}},{"name":"status","in":"query","required":false,"description":"pending|approved|rejected|revoked","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application\/json":{"schema":{"type":"object"}}}},"401":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}},"post":{"summary":"Grant an approved remote permission (WFH, field duty, client site)","security":[{"apiKey":["remote:write"]}],"x-scope":"remote:write","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Retry-safe POST\/PATCH: same key + same body replays the first response","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["employee_code","type","from","to","reason"],"properties":{"employee_code":{"type":"string"},"type":{"type":"string","enum":["wfh","field_duty","client_site","temporary_remote"]},"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"},"reason":{"type":"string"},"location_waived":{"type":"boolean"},"location_label":{"type":"string"},"lat":{"type":"number"},"lng":{"type":"number"},"radius_m":{"type":"integer"}}}}}},"responses":{"201":{"description":"Created","content":{"application\/json":{"schema":{"type":"object"}}}},"404":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/webhooks":{"get":{"summary":"List webhook endpoints","security":[{"apiKey":["webhooks:manage"]}],"x-scope":"webhooks:manage","responses":{"200":{"description":"OK","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Webhook"}}}}}}},"401":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}},"post":{"summary":"Create a webhook endpoint (HTTPS, public address)","security":[{"apiKey":["webhooks:manage"]}],"x-scope":"webhooks:manage","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Retry-safe POST\/PATCH: same key + same body replays the first response","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["url","events"],"properties":{"url":{"type":"string"},"description":{"type":"string"},"events":{"type":"array","items":{"type":"string","enum":["attendance.created","device.approved","employee.deactivated","attendance.adjusted","remote_permission.approved"]}}}}}}},"responses":{"201":{"description":"Created","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/Webhook"}}}}}},"422":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/webhooks\/{id}":{"delete":{"summary":"Delete a webhook endpoint","security":[{"apiKey":["webhooks:manage"]}],"x-scope":"webhooks:manage","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"204":{"description":"Deleted"},"404":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}}},"webhooks":{"attendance.created":{"post":{"summary":"A verified IN\/OUT punch was recorded","description":"Headers: X-Qronex-Event, X-Qronex-Delivery, X-Qronex-Signature: t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>. Reply 2xx within 10 s; failures retry with backoff for ~24 h. Deduplicate on body.id.","requestBody":{"content":{"application\/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"event":{"type":"string","const":"attendance.created"},"created_at":{"type":"string"},"tenant":{"type":"string"},"data":{"$ref":"#\/components\/schemas\/AttendanceEvent"}}}}}},"responses":{"200":{"description":"Acknowledged"}}}},"device.approved":{"post":{"summary":"An employee phone was approved","description":"Headers: X-Qronex-Event, X-Qronex-Delivery, X-Qronex-Signature: t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>. Reply 2xx within 10 s; failures retry with backoff for ~24 h. Deduplicate on body.id.","requestBody":{"content":{"application\/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"event":{"type":"string","const":"device.approved"},"created_at":{"type":"string"},"tenant":{"type":"string"},"data":{"type":"object"}}}}}},"responses":{"200":{"description":"Acknowledged"}}}},"employee.deactivated":{"post":{"summary":"An employee was deactivated","description":"Headers: X-Qronex-Event, X-Qronex-Delivery, X-Qronex-Signature: t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>. Reply 2xx within 10 s; failures retry with backoff for ~24 h. Deduplicate on body.id.","requestBody":{"content":{"application\/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"event":{"type":"string","const":"employee.deactivated"},"created_at":{"type":"string"},"tenant":{"type":"string"},"data":{"$ref":"#\/components\/schemas\/Employee"}}}}}},"responses":{"200":{"description":"Acknowledged"}}}},"attendance.adjusted":{"post":{"summary":"An approved correction added a manual punch","description":"Headers: X-Qronex-Event, X-Qronex-Delivery, X-Qronex-Signature: t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>. Reply 2xx within 10 s; failures retry with backoff for ~24 h. Deduplicate on body.id.","requestBody":{"content":{"application\/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"event":{"type":"string","const":"attendance.adjusted"},"created_at":{"type":"string"},"tenant":{"type":"string"},"data":{"$ref":"#\/components\/schemas\/AttendanceEvent"}}}}}},"responses":{"200":{"description":"Acknowledged"}}}},"remote_permission.approved":{"post":{"summary":"A remote \/ field permission was approved","description":"Headers: X-Qronex-Event, X-Qronex-Delivery, X-Qronex-Signature: t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>. Reply 2xx within 10 s; failures retry with backoff for ~24 h. Deduplicate on body.id.","requestBody":{"content":{"application\/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"event":{"type":"string","const":"remote_permission.approved"},"created_at":{"type":"string"},"tenant":{"type":"string"},"data":{"type":"object"}}}}}},"responses":{"200":{"description":"Acknowledged"}}}}}}