> ## 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.

# Silent Hours API: Manage Notification Quiet Periods

> Configure time windows when non-critical notifications are suppressed for specific teams, with full timezone and day-of-week control.

Silent hours rules tell the platform when to hold non-urgent alerts rather than immediately paging team members. This is useful for protecting engineers outside business hours without disabling notifications entirely. Each rule targets a specific team, specifies a time range and timezone, and can be scoped to selected days of the week.

All requests require a Bearer token in the `Authorization` header.

***

## List all silent-hours rules

`GET https://your-api-domain.com/api/v1/silent-hours`

Returns all silent-hours rules configured for the business.

### Response fields

<ResponseField name="rules" type="object[]" required>
  Array of silent-hours rule objects.

  <Expandable title="rule properties">
    <ResponseField name="id" type="string" required>
      Unique identifier for the rule.
    </ResponseField>

    <ResponseField name="name" type="string" required>
      Descriptive name for the rule.
    </ResponseField>

    <ResponseField name="startTime" type="string" required>
      Time when silence begins, in `HH:MM` 24-hour format.
    </ResponseField>

    <ResponseField name="endTime" type="string" required>
      Time when silence ends, in `HH:MM` 24-hour format.
    </ResponseField>

    <ResponseField name="timezone" type="string" required>
      IANA timezone identifier (e.g., `America/New_York`).
    </ResponseField>

    <ResponseField name="daysOfWeek" type="number[]" required>
      Days the rule is active. `1` = Monday through `7` = Sunday.
    </ResponseField>

    <ResponseField name="teamScope" type="string" required>
      Team slug or identifier this rule applies to.
    </ResponseField>

    <ResponseField name="isActive" type="boolean" required>
      Whether the rule is currently enforced.
    </ResponseField>
  </Expandable>
</ResponseField>

<CodeGroup>
  ```bash cURL theme={null}
  curl --request GET \
    --url https://your-api-domain.com/api/v1/silent-hours \
    --header 'Authorization: Bearer YOUR_TOKEN'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    'https://your-api-domain.com/api/v1/silent-hours',
    {
      headers: { Authorization: 'Bearer YOUR_TOKEN' },
    }
  );
  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://your-api-domain.com/api/v1/silent-hours',
      headers={'Authorization': 'Bearer YOUR_TOKEN'},
  )
  data = response.json()
  ```
</CodeGroup>

***

## Replace all silent-hours rules

`POST https://your-api-domain.com/api/v1/silent-hours`

<Note>
  This endpoint **replaces all existing silent-hours rules** for the business with the set provided in the request body. Any rules not included in the payload will be permanently deleted. To preserve existing rules, retrieve them first with `GET /silent-hours`, modify the array, and re-submit.
</Note>

Submits a complete, authoritative list of silent-hours rules. The operation is atomic: the entire set is replaced in a single transaction.

### Request body

<ParamField body="rules" type="object[]" required>
  The complete list of silent-hours rules to activate. Replaces all current rules.

  <Expandable title="rule properties">
    <ParamField body="name" type="string" required placeholder="Frontend Platform">
      A descriptive label for the rule.
    </ParamField>

    <ParamField body="startTime" type="string" required placeholder="21:00">
      Time when silence begins, in `HH:MM` 24-hour format.
    </ParamField>

    <ParamField body="endTime" type="string" required placeholder="08:00">
      Time when silence ends, in `HH:MM` 24-hour format. Can be earlier than `startTime` to span midnight.
    </ParamField>

    <ParamField body="timezone" type="string" required placeholder="America/New_York">
      IANA timezone identifier for interpreting `startTime` and `endTime`.
    </ParamField>

    <ParamField body="daysOfWeek" type="number[]" required placeholder="[1,2,3,4,5]">
      Array of day numbers the rule applies to. `1` = Monday, `2` = Tuesday, ..., `7` = Sunday.
    </ParamField>

    <ParamField body="teamScope" type="string" required placeholder="frontend-team">
      The team slug or identifier this rule should suppress notifications for.
    </ParamField>

    <ParamField body="isActive" type="boolean" required default="true">
      Set to `false` to save the rule without enforcing it.
    </ParamField>
  </Expandable>
</ParamField>

### Response fields

<ResponseField name="rules" type="object[]" required>
  The full set of rules now active, each with a server-assigned `id`.
</ResponseField>

<CodeGroup>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://your-api-domain.com/api/v1/silent-hours \
    --header 'Authorization: Bearer YOUR_TOKEN' \
    --header 'Content-Type: application/json' \
    --data '{
      "rules": [
        {
          "name": "Frontend Platform",
          "startTime": "21:00",
          "endTime": "08:00",
          "timezone": "America/New_York",
          "daysOfWeek": [1, 2, 3, 4, 5],
          "teamScope": "frontend-team",
          "isActive": true
        }
      ]
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    'https://your-api-domain.com/api/v1/silent-hours',
    {
      method: 'POST',
      headers: {
        Authorization: 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        rules: [
          {
            name: 'Frontend Platform',
            startTime: '21:00',
            endTime: '08:00',
            timezone: 'America/New_York',
            daysOfWeek: [1, 2, 3, 4, 5],
            teamScope: 'frontend-team',
            isActive: true,
          },
        ],
      }),
    }
  );
  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://your-api-domain.com/api/v1/silent-hours',
      headers={'Authorization': 'Bearer YOUR_TOKEN'},
      json={
          'rules': [
              {
                  'name': 'Frontend Platform',
                  'startTime': '21:00',
                  'endTime': '08:00',
                  'timezone': 'America/New_York',
                  'daysOfWeek': [1, 2, 3, 4, 5],
                  'teamScope': 'frontend-team',
                  'isActive': True,
              }
          ]
      },
  )
  data = response.json()
  ```
</CodeGroup>

***

## Update a rule

`PUT https://your-api-domain.com/api/v1/silent-hours/:id`

Updates a single existing silent-hours rule by ID. Supply the full rule body; all fields are replaced.

### Path parameters

<ParamField path="id" type="string" required>
  The unique identifier of the rule to update.
</ParamField>

### Request body

Accepts the same fields as the individual rule objects in [Replace all rules](#replace-all-silent-hours-rules).

<CodeGroup>
  ```bash cURL theme={null}
  curl --request PUT \
    --url https://your-api-domain.com/api/v1/silent-hours/rule_xyz789 \
    --header 'Authorization: Bearer YOUR_TOKEN' \
    --header 'Content-Type: application/json' \
    --data '{
      "name": "Frontend Platform (updated)",
      "startTime": "22:00",
      "endTime": "08:00",
      "timezone": "America/New_York",
      "daysOfWeek": [1, 2, 3, 4, 5, 6],
      "teamScope": "frontend-team",
      "isActive": true
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    'https://your-api-domain.com/api/v1/silent-hours/rule_xyz789',
    {
      method: 'PUT',
      headers: {
        Authorization: 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        name: 'Frontend Platform (updated)',
        startTime: '22:00',
        endTime: '08:00',
        timezone: 'America/New_York',
        daysOfWeek: [1, 2, 3, 4, 5, 6],
        teamScope: 'frontend-team',
        isActive: true,
      }),
    }
  );
  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.put(
      'https://your-api-domain.com/api/v1/silent-hours/rule_xyz789',
      headers={'Authorization': 'Bearer YOUR_TOKEN'},
      json={
          'name': 'Frontend Platform (updated)',
          'startTime': '22:00',
          'endTime': '08:00',
          'timezone': 'America/New_York',
          'daysOfWeek': [1, 2, 3, 4, 5, 6],
          'teamScope': 'frontend-team',
          'isActive': True,
      },
  )
  data = response.json()
  ```
</CodeGroup>

***

## Delete a rule

`DELETE https://your-api-domain.com/api/v1/silent-hours/:id`

Removes a single silent-hours rule. Other rules are unaffected.

### Path parameters

<ParamField path="id" type="string" required>
  The unique identifier of the rule to delete.
</ParamField>

<CodeGroup>
  ```bash cURL theme={null}
  curl --request DELETE \
    --url https://your-api-domain.com/api/v1/silent-hours/rule_xyz789 \
    --header 'Authorization: Bearer YOUR_TOKEN'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    'https://your-api-domain.com/api/v1/silent-hours/rule_xyz789',
    {
      method: 'DELETE',
      headers: { Authorization: 'Bearer YOUR_TOKEN' },
    }
  );
  ```

  ```python Python theme={null}
  import requests

  requests.delete(
      'https://your-api-domain.com/api/v1/silent-hours/rule_xyz789',
      headers={'Authorization': 'Bearer YOUR_TOKEN'},
  )
  ```
</CodeGroup>
