# Get notification preferences

`GET /api/v1/notification-preferences`

Retrieve the quiet hours, the delivery mode and the zone both are read in.

These belong to the account rather than to a channel. Which channels are on is a separate thing, and is above.

This endpoint also answers QUERY, with the same parameters sent in the request body. [How QUERY works](https://my.monicahq.com/docs/api/query-method).

## Returns

The preferences of the account. There is exactly one record, made with the account.

- `data` (object): The preference.
- `data.type` (string): Always notification_preference. It names the kind of record, so a caller holding several kinds can tell them apart without looking at where they came from.
- `data.id` (string): The id of this record, as a string even when it reads as a number. It is what every endpoint naming this record takes.
- `data.attributes` (object): Everything the record holds.
- `data.attributes.quiet_hours_are_enabled` (boolean): Whether there are hours during which nothing may be delivered.
- `data.attributes.quiet_hours_start` (string): The local time from which nothing may go out, as HH:MM, or null when quiet hours are off.
- `data.attributes.quiet_hours_end` (string): The local time from which delivery may resume, as HH:MM, or null when quiet hours are off.
- `data.attributes.delivery_mode` (string): Whether each notification goes out on its own, with immediate, or is folded into one summary a day, with digest.
- `data.attributes.digest_time` (string): The local time the daily summary is sent, as HH:MM, or null when nothing is folded.
- `data.attributes.digest_weekdays` (array): Which days the summary is sent, as numbers from 0 for Sunday to 6 for Saturday, or null for every day.
- `data.attributes.timezone` (string): The zone quiet hours and the summary hour are read in, up to 64 characters.
- `data.links` (object): Where to find this record.
- `data.links.self` (string): The absolute address this record is read from.

## Rate limit

Sixty requests per minute, per user, shared by every key and device. Every answer carries the budget left in `X-RateLimit-Remaining`.

## Request

```sh
curl https://my.monicahq.com/api/v1/notification-preferences \
  -H "Authorization: Bearer $MONICA_TOKEN"
```

```javascript
const response = await fetch('https://my.monicahq.com/api/v1/notification-preferences', {
  headers: { Authorization: `Bearer ${token}` },
})
const data = await response.json()
```

```php
$response = Http::withToken($token)->get('https://my.monicahq.com/api/v1/notification-preferences');
```

## Response

`200`

```json
{
    "data": {
        "type": "notification_preference",
        "id": "17",
        "attributes": {
            "quiet_hours_are_enabled": true,
            "quiet_hours_start": "22:00",
            "quiet_hours_end": "08:00",
            "delivery_mode": "immediate",
            "digest_time": null,
            "digest_weekdays": null,
            "timezone": "America/New_York"
        },
        "links": {
            "self": "https://my.monicahq.com/api/v1/notification-preferences"
        }
    }
}
```
