SLA API
All endpoints require authentication and sla tool permissions.
SLA Policies
Section titled “SLA Policies”List Policies
Section titled “List Policies”GET /api/sla/policiesPermission: sla:view
Query parameters:
| Param | Type | Description |
|---|---|---|
company_id | string | Filter policies by company |
Response: { policies } — each policy includes company_name and a nested rules array with priority info (priority_label, priority_value, priority_color, priority_position).
Create Policy
Section titled “Create Policy”POST /api/sla/policiesPermission: sla:update
Body:
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Policy name |
description | string | No | Description |
company_id | string | No | Link to a company |
rules | array | No | Array of priority rules |
Each rule in the rules array:
| Field | Type | Required | Description |
|---|---|---|---|
priority_id | string | Yes | Config list item ID for priority |
response_hours | number | Yes | Hours allowed for first response |
resolution_hours | number | Yes | Hours allowed for resolution |
Response: { policy } (201)
Update Policy
Section titled “Update Policy”PUT /api/sla/policies/:idPermission: sla:update
Body: Any of: name, description, company_id, rules. When rules is provided, all existing rules are replaced.
Response: { policy }
Delete Policy
Section titled “Delete Policy”DELETE /api/sla/policies/:idPermission: sla:manage
Response: { ok: true }
Task SLA Assignment
Section titled “Task SLA Assignment”Get Task SLA
Section titled “Get Task SLA”GET /api/sla/tasks/:taskIdPermission: sla:view
Returns the SLA assignment for a task, including policy_name, response_hours, resolution_hours, and priority_label.
Response: { sla } — null if no SLA assigned.
Assign SLA to Task
Section titled “Assign SLA to Task”PUT /api/sla/tasks/:taskIdPermission: sla:update
Body:
| Field | Type | Required | Description |
|---|---|---|---|
policy_id | string | Yes | SLA policy ID |
created_at | string | No | Override start time (defaults to task creation time) |
Calculates response_deadline and resolution_deadline based on the policy rule matching the task’s priority. Requires the task to have a priority set. Uses upsert — reassigning replaces the existing SLA.
Response: { sla }
Record Response
Section titled “Record Response”POST /api/sla/tasks/:taskId/respondPermission: sla:update
Marks the SLA response as met. Records whether the response deadline was breached.
Response: { ok: true, breached } — breached is true if response was after the deadline.
Record Resolution
Section titled “Record Resolution”POST /api/sla/tasks/:taskId/resolvePermission: sla:update
Marks the SLA resolution as met. Records whether the resolution deadline was breached.
Response: { ok: true, breached } — breached is true if resolution was after the deadline.
Compliance Dashboard
Section titled “Compliance Dashboard”Get Compliance Data
Section titled “Get Compliance Data”GET /api/sla/compliancePermission: sla:view
Query parameters:
| Param | Type | Description |
|---|---|---|
policy_id | string | Filter by specific policy |
Response:
{ "compliance": [ { "policy_name": "string", "policy_id": "string", "total": 0, "response_breaches": 0, "resolution_breaches": 0, "open_response_breaches": 0, "open_resolution_breaches": 0 } ], "at_risk": [ { "id": "string", "title": "string", "response_deadline": "string", "resolution_deadline": "string", "policy_name": "string", "assignee_name": "string" } ]}The at_risk array contains tasks approaching a deadline within the next 4 hours (limit 20).