---
title: "Slack On-Call Groups"
description: "Keep a Slack user group in step with the people on call for a team, and optionally post a message to a channel when the on-call people change."
---

`GET /api/im/chat/oncall-groups` · `POST /api/im/chat/oncall-groups` · `PATCH /api/im/chat/oncall-groups/:id` · `DELETE /api/im/chat/oncall-groups/:id` · `GET /api/im/chat/workspaces/:id/usergroups`

An **on-call group** ties a Slack user group such as `@oncall-ops` to one team and one escalation tier. The user group then always contains exactly the people who are on call for that team and tier right now (the same source as [`GET /api/im/on-call`](/api/incident-management/on-call)). Optionally a channel gets a short message naming the people on call whenever they change.

How it behaves:

- The sync runs once a minute and directly after an on-call group is created or changed. When the people on call have not changed since the last sync, nothing is sent to Slack.
- Only people who linked their Slack user to their Uptimeify account (`/uptimeify connect`, see [Outbound Integrations](/api/incident-management/outbound-integrations)) can be put into the user group. In the channel message linked people are mentioned, everybody else is named.
- Slack does not accept an empty user group. When nobody on call has a linked Slack user, the user group stays as it is and `lastError` says `no linked on-call user`. The channel message is still posted.
- A person who links their Slack user later joins the user group with the next change of the people on call, not before.
- When Slack rejects the change, `lastError` holds Slack's error code and the next run tries again. `missing_scope` means the workspace was connected before this feature existed: an organization admin has to install the Slack app again. `permission_denied` means the workspace only lets admins change user groups. `plan_upgrade_required` means the Slack plan has no user groups.
- Deleting an on-call group, or disconnecting the workspace, leaves the user group in Slack with its last members.

## Authentication

Requires the base IM access every endpoint in this API needs (an IM-eligible role `admin`, `editor` or `responder`, or an organization-wide API token; Incident Management must be enabled for the organization). **Reading** (both `GET` endpoints) is open to any IM-eligible role.

**Writing** (`POST`, `PATCH`, `DELETE`) needs an organization admin signed in to the dashboard, the same bar as connecting the Slack workspace. API tokens and agent connections answer `403` `imChatAdminOnly`.

## List on-call groups

`GET /api/im/chat/oncall-groups`

Returns all on-call groups of your organization as one page.

### Example (cURL)

```bash
curl -X GET "$BASE_URL/api/im/chat/oncall-groups" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Accept: application/json"
```

### Response

`200 OK`

```json
{
  "items": [
    {
      "id": 4,
      "workspaceId": 2,
      "teamId": 3,
      "tierOrder": 1,
      "usergroupId": "S0614TZR7",
      "announceChannelId": "C024BE91L",
      "lastSyncedAt": "2026-11-27T09:00:04.000Z",
      "lastError": null,
      "createdAt": "2026-11-20T10:00:00.000Z",
      "updatedAt": "2026-11-20T10:00:00.000Z"
    }
  ],
  "total": 1,
  "page": 1,
  "perPage": 1
}
```

| Field | Type | Description |
|-------|------|-------------|
| `workspaceId` | number | The connected Slack workspace. |
| `teamId` | number | The [team](/api/incident-management/teams) whose on-call people are in the user group. |
| `tierOrder` | number | The [escalation tier](/api/incident-management/team-tiers) of the team, `1` is the first tier. |
| `usergroupId` | string | Slack id of the user group (starts with `S`). |
| `announceChannelId` | string or null | Slack id of the channel for the message on a change, `null` for no message. |
| `lastSyncedAt` | string or null | When the user group was last written to Slack or an attempt failed, `null` when neither happened yet. |
| `lastError` | string or null | Why the last sync did not set the members: a Slack error code, `no linked on-call user`, or `announcement: <Slack error code>` when only the channel message failed. `null` when there was no error. |

## Create an on-call group

`POST /api/im/chat/oncall-groups`

The first sync runs before the response is sent, so `lastSyncedAt` and `lastError` already describe it. The on-call group is created even when Slack rejects that first sync.

### Request Body

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `workspaceId` | number | Yes | A Slack workspace connected to your organization. |
| `teamId` | number | Yes | A team of your organization. |
| `tierOrder` | number | No | Escalation tier, `1` to `100`. Default `1`. |
| `usergroupId` | string | Yes | Slack id of the user group: `S` followed by 2 to 20 capital letters or digits. Not the handle. |
| `announceChannelId` | string or null | No | Slack channel id: `C` or `G` followed by 2 to 20 capital letters or digits. Not a channel name. Default `null`. |

A team and tier can have one on-call group per workspace, and a user group can belong to one on-call group per workspace.

### Example (cURL)

```bash
curl -X POST "$BASE_URL/api/im/chat/oncall-groups" \
  -H "Cookie: $SESSION_COOKIE" \
  -H "Origin: $BASE_URL" \
  -H "Content-Type: application/json" \
  -d '{
    "workspaceId": 2,
    "teamId": 3,
    "usergroupId": "S0614TZR7",
    "announceChannelId": "C024BE91L"
  }'
```

### Response

`201 Created`

```json
{
  "id": 4,
  "workspaceId": 2,
  "teamId": 3,
  "tierOrder": 1,
  "usergroupId": "S0614TZR7",
  "announceChannelId": "C024BE91L",
  "lastSyncedAt": "2026-11-27T09:00:04.000Z",
  "lastError": null,
  "createdAt": "2026-11-27T09:00:03.000Z",
  "updatedAt": "2026-11-27T09:00:03.000Z"
}
```

## Update an on-call group

`PATCH /api/im/chat/oncall-groups/:id`

Partial update of `teamId`, `tierOrder`, `usergroupId` and `announceChannelId` (`null` switches the message off). The workspace cannot be changed: delete the on-call group and create a new one. After a change of team, tier or user group the members are written to Slack again right away. Returns the on-call group in the same form as on create, with `200 OK`.

```bash
curl -X PATCH "$BASE_URL/api/im/chat/oncall-groups/4" \
  -H "Cookie: $SESSION_COOKIE" \
  -H "Origin: $BASE_URL" \
  -H "Content-Type: application/json" \
  -d '{ "announceChannelId": null }'
```

## Delete an on-call group

`DELETE /api/im/chat/oncall-groups/:id`

Uptimeify stops maintaining the user group. Answers `204 No Content`.

```bash
curl -X DELETE "$BASE_URL/api/im/chat/oncall-groups/4" \
  -H "Cookie: $SESSION_COOKIE" \
  -H "Origin: $BASE_URL"
```

## List the user groups of a workspace

`GET /api/im/chat/workspaces/:id/usergroups`

Returns the active user groups of the connected Slack workspace, live from Slack and sorted by handle, so you can pick a `usergroupId`. Nothing of it is stored.

### Example (cURL)

```bash
curl -X GET "$BASE_URL/api/im/chat/workspaces/2/usergroups" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Accept: application/json"
```

### Response

`200 OK`

```json
{
  "items": [
    { "id": "S0614TZR7", "handle": "oncall-ops", "name": "On call Ops" }
  ],
  "total": 1,
  "page": 1,
  "perPage": 1
}
```

## Common errors

- `401 Unauthorized` when not authenticated
- `403 Forbidden` (`imAccessDenied`) when using a customer-scoped token, or a session without an IM-eligible role
- `403 Forbidden` (`imNotEnabled`) when Incident Management is not enabled for the organization
- `403 Forbidden` (`imChatAdminOnly`) when writing with an API token, an agent connection, or without the organization admin role
- `400 Bad Request` (`invalidRequestBody`) when `:id` is not a positive integer, a required field is missing, `usergroupId` or `announceChannelId` does not have the form of a Slack id, or `tierOrder` is not between `1` and `100`
- `404 Not Found` (`imChatOncallGroupNotFound`) when the on-call group does not exist, or belongs to another organization
- `404 Not Found` (`imChatWorkspaceNotFound`) when the workspace in the path does not exist, or belongs to another organization
- `409 Conflict` (`imChatOncallGroupExists`) when the team and tier, or the user group, already has an on-call group in the workspace
- `422 Unprocessable Entity` (`imChatWorkspaceNotFound`) when `workspaceId` is not a Slack workspace connected to your organization
- `422 Unprocessable Entity` (`invalidTeamId`) when `teamId` does not belong to your organization
- `502 Bad Gateway` (`imChatUpstreamFailed`) when Slack did not return the user groups, for example `missing_scope` for a workspace connected before this feature existed
