> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scrubbe.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SLA Policies: Setting Response and Resolution Targets

> Learn how Scrubbe SLA policies define response and resolution time targets per incident priority, track breaches, and trigger automatic escalation.

An SLA policy in Scrubbe defines the time targets your team commits to for acknowledging and resolving incidents at a given priority level. Once SLA tracking is enabled for your organization, Scrubbe measures every open incident against the matching policy, notifies your team when targets are at risk, and can automatically escalate incidents that breach their thresholds. SLA policies are the mechanism that turns incident response from informal effort into measurable, accountable practice.

## Enabling SLA tracking

SLA tracking is controlled by your IMS configuration. Set `slaEnabled` to `true` to activate it, and set `autoEscalate` to `true` to let Scrubbe escalate breached incidents without manual intervention:

```http theme={null}
PUT /api/v1/ims/config
```

```json theme={null}
{
  "slaEnabled": true,
  "autoEscalate": true
}
```

When `autoEscalate` is `true`, Scrubbe routes a breached incident to the `escalationContact` defined in the matching SLA policy.

## Creating an SLA policy

```http theme={null}
POST /api/v1/sla-policies
```

```json theme={null}
{
  "name": "Critical Outage SLA",
  "priority": "CRITICAL",
  "responseTimeMinutes": 15,
  "responseThreshold": 90,
  "resolveTimeMinutes": 60,
  "resolveThreshold": 85,
  "escalationContact": "Tier1",
  "applicableTeam": "oncall@example.com",
  "uptimeTarget": 99.9
}
```

### Policy fields

<AccordionGroup>
  <Accordion title="Identity">
    | Field            | Description                                                                          |
    | ---------------- | ------------------------------------------------------------------------------------ |
    | `name`           | Human-readable label for the policy                                                  |
    | `priority`       | The incident priority this policy applies to: `LOW`, `MEDIUM`, `HIGH`, or `CRITICAL` |
    | `applicableTeam` | Email or identifier of the team this policy governs                                  |
  </Accordion>

  <Accordion title="Response targets">
    | Field                 | Description                                                                                                             |
    | --------------------- | ----------------------------------------------------------------------------------------------------------------------- |
    | `responseTimeMinutes` | Maximum minutes from `OPEN` to `ACKNOWLEDGED` before the response SLA breaches                                          |
    | `responseThreshold`   | Target compliance rate as a percentage (e.g. `90` means 90% of incidents must be acknowledged within the response time) |
  </Accordion>

  <Accordion title="Resolution targets">
    | Field                | Description                                                               |
    | -------------------- | ------------------------------------------------------------------------- |
    | `resolveTimeMinutes` | Maximum minutes from `OPEN` to `RESOLVED` before the resolve SLA breaches |
    | `resolveThreshold`   | Target compliance rate as a percentage                                    |
  </Accordion>

  <Accordion title="Escalation and uptime">
    | Field               | Description                                                                                        |
    | ------------------- | -------------------------------------------------------------------------------------------------- |
    | `escalationContact` | Name or identifier of the person or team to notify on breach (used when `autoEscalate` is enabled) |
    | `uptimeTarget`      | Target uptime percentage for this priority tier (e.g. `99.9`)                                      |
  </Accordion>
</AccordionGroup>

## How SLA tracking works

When a ticket is created with a given priority, Scrubbe looks up the SLA policy for that priority and sets `slaResponseTimeMinutes` and `slaResolveTimeMinutes` on the ticket. Timers start when the ticket status becomes `OPEN`.

Scrubbe sends a warning notification at the halfway mark for both the response and resolution windows. If the window closes without the required status transition, the ticket is marked as breached.

### Breach types

| Breach type       | Meaning                                                      |
| ----------------- | ------------------------------------------------------------ |
| `NONE`            | No SLA has been breached on this ticket                      |
| `RESPONSE_BREACH` | The ticket was not acknowledged within `responseTimeMinutes` |
| `RESOLVE_BREACH`  | The ticket was not resolved within `resolveTimeMinutes`      |
| `BOTH`            | Both the response and resolution windows were exceeded       |

The current breach state is visible on each ticket in the `slaBreachType` field.

<Warning>
  SLA timers run in real time. If you update a ticket's priority after creation, the ticket continues to track against the originally assigned SLA targets — not the targets of the new priority. Update priority before the response window closes to avoid unexpected breaches.
</Warning>

## Managing policies

| Operation             | Endpoint                             |
| --------------------- | ------------------------------------ |
| List all policies     | `GET /api/v1/sla-policies`           |
| Get a specific policy | `GET /api/v1/sla-policies/:id`       |
| Update a policy       | `PUT /api/v1/sla-policies/:id`       |
| Delete a policy       | `DELETE /api/v1/sla-policies/:id`    |
| View SLA analytics    | `GET /api/v1/sla-policies/analytics` |

## SLA policy analytics

`GET /api/v1/sla-policies/analytics` returns compliance data across your policies — breach counts by priority, average response and resolution times, and compliance rates against your configured thresholds. Use this endpoint to identify which priority tiers need staffing or process changes.

<Tip>
  Define one policy per priority level (`LOW`, `MEDIUM`, `HIGH`, `CRITICAL`) to ensure every incident has a matching target. Incidents with a priority that has no matching policy will not have SLA timers set automatically.
</Tip>
