{"openapi":"3.1.0","info":{"title":"QuickInspect Export API","version":"1.0.0","description":"Read-only export API for QuickInspect tenant data: incidents, KPI\naggregates, ESRS S1-14 datapoints, and the audit trail.\n\nAuthentication: per-tenant API keys, sent as\n`Authorization: Bearer qi_live_...`. Keys are created and revoked by the\ncompany owner under Company Settings → API Access; treat them as\nsecrets — each key grants read access to all of the company's\noperational records listed here.\n\nAll timestamps are ISO-8601 UTC. All list endpoints use cursor\npagination: pass `next_page_token` back as `page_token` until it is\nnull. Responses are JSON except /v1/esrs-s1 with `format=csv`."},"servers":[{"url":"https://api.quickinspect.me"}],"security":[{"apiKey":[]}],"paths":{"/v1/incidents":{"get":{"operationId":"listIncidents","summary":"List incidents","description":"Incidents of the authenticated company, ascending by date_time_of_event. Records without an event date are not returned.","parameters":[{"name":"from","in":"query","description":"Inclusive lower bound on date_time_of_event (ISO-8601 date or datetime, UTC).","schema":{"type":"string","format":"date-time"}},{"name":"to","in":"query","description":"Exclusive upper bound on date_time_of_event (ISO-8601 date or datetime, UTC).","schema":{"type":"string","format":"date-time"}},{"name":"status","in":"query","schema":{"type":"string","enum":["Open","InProgress","Closed"]}},{"name":"limit","in":"query","description":"Page size, 1–500. Default 100.","schema":{"type":"integer","minimum":1,"maximum":500,"default":100}},{"name":"page_token","in":"query","description":"Opaque cursor from the previous response's next_page_token. Omit for the first page.","schema":{"type":"string"}}],"responses":{"200":{"description":"One page of incidents.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Incident"}},"next_page_token":{"type":["string","null"]}}}}}},"400":{"description":"Invalid request parameter.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, malformed, unknown, or revoked API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"API access is not enabled for this company.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (default 60 requests/minute, 10,000 requests/day per key). Retry-After carries seconds until the window resets.","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/kpis":{"get":{"operationId":"getKpis","summary":"Company KPI aggregates","description":"Pre-aggregated KPI rollup (incidents, findings, inspections, assets, risk assessments, worked hours, locations). Month-keyed maps carry the most recent 24 months.","responses":{"200":{"description":"The KPI rollup.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/KpiRollup"}}}}}},"400":{"description":"Invalid request parameter.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, malformed, unknown, or revoked API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"API access is not enabled for this company.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No rollup exists for this company yet.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (default 60 requests/minute, 10,000 requests/day per key). Retry-After carries seconds until the window resets.","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/esrs-s1":{"get":{"operationId":"getEsrsS1","summary":"ESRS S1-14 datapoints","description":"ESRS S1-14 own-workforce health & safety datapoints computed from the company's incident and worked-hours records for one calendar year (UTC). QuickInspect is the auditable source-data layer — this export feeds the customer's CSRD reporting suite, it does not replace it.","parameters":[{"name":"year","in":"query","description":"Reporting year (UTC). Default: current year.","schema":{"type":"integer"}},{"name":"format","in":"query","description":"json (default) or csv.","schema":{"type":"string","enum":["json","csv"],"default":"json"}}],"responses":{"200":{"description":"Datapoints as JSON, or CSV when format=csv.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EsrsS1"}}}},"text/csv":{"schema":{"type":"string"}}}},"400":{"description":"Invalid request parameter.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, malformed, unknown, or revoked API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"API access is not enabled for this company.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (default 60 requests/minute, 10,000 requests/day per key). Retry-After carries seconds until the window resets.","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/audit-logs":{"get":{"operationId":"listAuditLogs","summary":"List audit-trail entries","description":"Audit-trail entries of the authenticated company, descending by timestamp. Retention: operational entries 90 days, privileged 730 days — pull periodically for a longer horizon.","parameters":[{"name":"from","in":"query","description":"Inclusive lower bound on timestamp (ISO-8601 date or datetime, UTC).","schema":{"type":"string","format":"date-time"}},{"name":"to","in":"query","description":"Exclusive upper bound on timestamp (ISO-8601 date or datetime, UTC).","schema":{"type":"string","format":"date-time"}},{"name":"class","in":"query","schema":{"type":"string","enum":["privileged","operational"]}},{"name":"limit","in":"query","description":"Page size, 1–500. Default 100.","schema":{"type":"integer","minimum":1,"maximum":500,"default":100}},{"name":"page_token","in":"query","description":"Opaque cursor from the previous response's next_page_token. Omit for the first page.","schema":{"type":"string"}}],"responses":{"200":{"description":"One page of audit-log entries.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AuditLog"}},"next_page_token":{"type":["string","null"]}}}}}},"400":{"description":"Invalid request parameter.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, malformed, unknown, or revoked API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"API access is not enabled for this company.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (default 60 requests/minute, 10,000 requests/day per key). Retry-After carries seconds until the window resets.","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/openapi.json":{"get":{"operationId":"getOpenApi","summary":"This document","security":[],"responses":{"200":{"description":"The OpenAPI 3.1 document."}}}}},"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","bearerFormat":"qi_live_<64 hex>","description":"Per-tenant API key from Company Settings → API Access."}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthorized","forbidden","invalid_request","not_found","rate_limited","internal"]},"message":{"type":"string"}}}}},"Incident":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"status":{"type":["string","null"],"enum":["Open","InProgress","Closed",null]},"classification":{"type":["string","null"]},"classification_shortcut":{"type":["string","null"],"description":"e.g. LTC, MTC, RWC, FAT, USC, USA"},"date_time_of_event":{"type":["string","null"],"format":"date-time"},"time_created":{"type":["string","null"],"format":"date-time"},"last_edited":{"type":["string","null"],"format":"date-time"},"closed_date":{"type":["string","null"],"format":"date-time"},"due_date":{"type":["string","null"],"format":"date-time"},"days_lost":{"type":"integer"},"monetary_impact":{"type":["number","null"]},"actual_severity":{"type":["integer","null"]},"actual_likelihood":{"type":["integer","null"]},"actual_rr":{"type":["integer","null"]},"potential_severity":{"type":["integer","null"]},"potential_likelihood":{"type":["integer","null"]},"potential_rr":{"type":["integer","null"]},"injured_body_part":{"type":["string","null"]},"location":{"type":["object","null"],"description":"Scalar location fields (locationLevel1..5 etc.)."},"product_id":{"type":["string","null"]},"company_id":{"type":["string","null"]},"created_by":{"type":["string","null"],"description":"User id."},"created_by_name":{"type":["string","null"]},"created_by_email":{"type":["string","null"]},"subcontractor_name":{"type":["string","null"]},"permit_id":{"type":["string","null"]},"linked_ra_ids":{"type":"array","items":{"type":"string"}},"assignee_ids":{"type":"array","items":{"type":"string"},"description":"Assigned users (not affected workers)."}}},"AuditLog":{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":["string","null"],"format":"date-time"},"user_id":{"type":["string","null"],"description":"User id, or api_key:<keyId> for API access entries."},"action":{"type":["string","null"]},"resource_type":{"type":["string","null"]},"resource_id":{"type":["string","null"]},"status":{"type":["string","null"]},"audit_class":{"type":"string","enum":["privileged","operational"]},"metadata":{"type":"object"}}},"KpiRollup":{"type":"object","description":"Aggregates maintained transactionally on write + reconciled daily. by_month keys are UTC YYYY-MM (most recent 24 months); by_status keys are status enum names.","properties":{"company_id":{"type":"string"},"updated_at":{"type":["string","null"],"format":"date-time"},"last_reconcile_at":{"type":["string","null"],"format":"date-time"},"schema_version":{"type":["integer","null"]},"incidents":{"type":"object","properties":{"total":{"type":"integer"},"days_lost_total":{"type":"integer"},"by_status":{"type":"object"},"by_month":{"type":"object","additionalProperties":{"type":"object","properties":{"total":{"type":"integer"},"days_lost":{"type":"integer"},"by_classification":{"type":"object"}}}},"by_subcontractor":{"type":"object"}}},"findings":{"type":"object","properties":{"total":{"type":"integer"},"by_status":{"type":"object"},"by_month":{"type":"object"},"close_days_sum":{"type":"integer"},"closed_with_date_count":{"type":"integer"}}},"inspections":{"type":"object","properties":{"total":{"type":"integer"},"by_status":{"type":"object"},"by_month":{"type":"object"}}},"assets":{"type":"object","properties":{"total":{"type":"integer"}}},"risk_assessments":{"type":"object","properties":{"total":{"type":"integer"},"by_status":{"type":"object"}}},"worked_hours":{"type":"object","properties":{"by_month":{"type":"object"}}},"locations":{"type":"object","properties":{"total":{"type":"integer"}}}}},"EsrsS1":{"type":"object","properties":{"year":{"type":"integer"},"company_id":{"type":"string"},"reporting_entity":{"type":"string"},"workers_covered_by_hs_management_system":{"type":"integer"},"work_related_fatalities":{"type":"integer"},"recordable_work_related_accidents":{"type":"integer","description":"Classifications LTC+MTC+RWC+FAT."},"rate_of_recordable_work_related_accidents":{"type":["number","null"],"description":"Per 1,000,000 hours worked; null when no worked-hours records exist for the period."},"days_lost_to_work_related_injuries":{"type":"integer"},"near_miss_and_unsafe_observations":{"type":"integer","description":"Classifications USC+USA; supplementary, not an ESRS datapoint."},"total_incident_records_in_period":{"type":"integer"},"total_hours_worked":{"type":"number"},"by_classification":{"type":"object"}}}}}}