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

# Get Announcement Stats

> See who has and hasn't viewed or acknowledged an announcement, by person, role, and location.

Returns everyone an announcement was sent to, with whether and when each person viewed and acknowledged it, plus totals. These are the same numbers as the announcement's report in the app.

> [!NOTE]
>
> Announcements must be on your workspace's plan. Otherwise every Announcements endpoint returns `403` with "Workspace doesn't have "Announcements" feature activated."

## Permissions

The key acts as its default user, or the user in the `x-client-user` header (who must be in the workspace). That user's role permissions apply.

* **Manage All Announcements** or **View All Announcements**: any announcement in the workspace
* **Create & Manage Own Announcements** only: announcements the user created

## Path parameters

**workspaceId** `string\<uuid\>` *required*

UUID of the workspace. Must be the workspace your API key is bound to.

**announcementId** `string\<uuid\>` *required*

UUID of the announcement.

## Query parameters

All optional.

`locationId` and `roleId` narrow both the totals and the list. `showFilter` and `q` only filter the list, so the totals stay those of everyone in scope.

**locationId** `string\<uuid\>`

Only people who are members of this location.

**roleId** `string\<uuid\>`

Only people with this role.

**showFilter** `string`

`Viewed`, `Not Viewed`, `Acknowledged`, or `Not Acknowledged`.

**q** `string`

Matches first name, last name, role, or location name.

A `locationId` or `roleId` that isn't a uuid, or any other `showFilter` value, is ignored.

## Response

Returns `200` with `{ "data": { "announcement": { … } } }`:

* `totalCount`, `openedCount`, and `acknowledgedCount` are the number of people it was sent to, who viewed it, and who acknowledged it
* `AnnouncementLogs` has one entry per person, sorted by first name, then last name. It isn't paginated
* Each entry has `opened` and `openedAt` (viewed), `acknowledged` and `acknowledgedAt`, and `Recipient`: `{ "id", "firstName", "lastName", "photo", "roleTitle", "locationName" }`
* `roleTitle` is the person's role, and `locationName` their default location. Each is `""` when they have none

## Errors

Errors return the message at `error.message`.

| Status | When |
| - | - |
| `401` | Invalid client credentials |
| `403` | Announcements isn't on the workspace's plan |
| `403` | The user doesn't have any of the permissions above |
| `403` | The announcement was created by someone else and the user only has Create & Manage Own Announcements |
| `404` | "Announcement not found." |

```bash cURL theme={null}
curl "https://api.xenia.team/api/v1/ops/workspaces/{workspaceId}/announcements/{announcementId}/stats?locationId=8f1c…&showFilter=Not%20Viewed" \
  -H "x-client-key: YOUR_CLIENT_KEY" \
  -H "x-client-secret: YOUR_CLIENT_SECRET"
```

```json 200 theme={null}
{
  "data": {
    "announcement": {
      "id": "6a1f…",
      "title": "Holiday hours",
      "requireAcknowledgement": true,
      "acknowledgedCount": 5,
      "openedCount": 7,
      "totalCount": 9,
      "AnnouncementLogs": [
        {
          "id": "e07b…",
          "acknowledged": false,
          "opened": false,
          "acknowledgedAt": null,
          "openedAt": null,
          "Recipient": {
            "id": "2b7e…",
            "firstName": "Sam",
            "lastName": "Lee",
            "photo": null,
            "roleTitle": "Store Manager",
            "locationName": "Downtown"
          }
        }
      ]
    }
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.