# Manage Notifications

This page describes the `activity` endpoint of the Immuta API, which allows you to view your activity notifications.

{% hint style="info" %}
Additional fields may be included in some responses you receive; however, these attributes are for internal purposes and are therefore undocumented.
{% endhint %}

## Review your notifications

| Method | Path                  | Purpose                                                                                     |
| ------ | --------------------- | ------------------------------------------------------------------------------------------- |
| GET    | `/activity`           | [View your activity notification feed.](#review-user-activities)                            |
| GET    | `/activity/hasUnread` | [Determine whether you have unread activity notifications.](#review-user-unread-activities) |

### Review your activity notifications

<mark style="color:green;">`GET`</mark> `/activity`

View your activity notification feed.

#### Query parameters

| Attribute          | Description                                                                                                     | Required |
| ------------------ | --------------------------------------------------------------------------------------------------------------- | -------- |
| excludeMine        | `boolean` If `true`, excludes activities that were initiated by the calling user.                               | No       |
| nonRequestActivity | `boolean` If true, excludes data source access requests from the returned activities.                           | No       |
| new                | `boolean` If `true`, excludes activities that are marked as 'read'.                                             | No       |
| offset             | `integer` Used in combination with `size` to fetch pages.                                                       | No       |
| size               | `integer` The number of records to return in this query.                                                        | No       |
| modelType          | `string` The type of object to get activity for (i.e., data source, script, etc.).                              | No       |
| modelId            | `string` The ID for the model (i.e., the data source ID).                                                       | No       |
| sortField          | `string` The field to use for sorting.                                                                          | No       |
| sortOrder          | `string` The sort order to use. **The default is `desc`.**                                                      | No       |
| searchText         | `string` If set, will use text to search through notification types and return all matched types.               | No       |
| notificationType   | `string` If set, will only return activities of this type.                                                      | No       |
| permission         | `string` If set, will only return activities from users with a given permission if current user has it as well. | No       |

#### Response parameters

| Attribute  | Description                                                 |
| ---------- | ----------------------------------------------------------- |
| count      | `integer` The total number of results available.            |
| unread     | `integer` The number of unread activities.                  |
| activities | `metadata` The information about the individual activities. |

#### Request example

This example request gets 5 activities for the current user and sorts them in descending order.

```bash
curl \
    --request GET \
    --header "Content-Type: application/json" \
    --header "Authorization: Bearer dea464c07bd07300095caa8" \
    https://demo.immuta.com/activity?size=5&sortOrder=desc
```

#### Response example

```json
{
  "count": 210,
  "activities": [
    {
      "modelType": "datasource",
      "modelId": "105",
      "createdAt": "2021-05-04T18:39:08.712Z",
      "notificationType": "modelUserDeleted",
      "metadata": {
        "dataSourceName": "Public Uciml Census Income Enriched",
        "activity": "access",
        "action": "revoked"
      },
      "read": false,
      "id": 1255,
      "updatedAt": "2021-05-04T18:39:08.712Z",
      "actionBy": {
        "id": 2,
        "name": "John",
        "email": "john.doe@immuta.com"
      },
      "targetUser": {
        "id": 2,
        "name": "John",
        "email": "john.doe@immuta.com"
      }
    },
    {
      "modelType": "datasource",
      "modelId": "106",
      "createdAt": "2021-05-04T18:39:08.696Z",
      "notificationType": "modelUserDeleted",
      "metadata": {
        "dataSourceName": "Public Fake Medical Claims 2017",
        "activity": "access",
        "action": "revoked"
      },
      "read": false,
      "id": 1254,
      "updatedAt": "2021-05-04T18:39:08.696Z",
      "actionBy": {
        "id": 2,
        "name": "John",
        "email": "john.doe@immuta.com"
      },
      "targetUser": {
        "id": 2,
        "name": "John",
        "email": "john.doe@immuta.com"
      }
    },
    {
      "modelType": "datasource",
      "modelId": "105",
      "createdAt": "2021-05-04T18:39:08.649Z",
      "notificationType": "modelDeleted",
      "metadata": {
        "dataSourceName": "Public Uciml Census Income Enriched",
        "fields": {
        "deleted": true
      }
    },
      "read": false,
      "id": 1253,
      "updatedAt": "2021-05-04T18:39:08.649Z",
      "actionBy": {
        "id": 2,
        "name": "John",
        "email": "john.doe@immuta.com"
      },
      "targetUser": {
        "id": 2,
        "name": "John",
        "email": "john.doe@immuta.com"
      }
    },
    {
      "modelType": "datasource",
      "modelId": "106",
      "createdAt": "2021-05-04T18:39:08.650Z",
      "notificationType": "modelDeleted",
      "metadata": {
        "dataSourceName": "Public Fake Medical Claims 2017",
        "fields": {
        "deleted": true
      }
    },
      "read": false,
      "id": 1252,
      "updatedAt": "2021-05-04T18:39:08.650Z",
      "actionBy": {
        "id": 2,
        "name": "John",
        "email": "john.doe@immuta.com"
      },
      "targetUser": {
        "id": 2,
        "name": "John",
        "email": "john.doe@immuta.com"
      }
    },
    {
      "modelType": "datasource",
      "modelId": "103",
      "createdAt": "2021-05-04T18:39:08.555Z",
      "notificationType": "modelUserDeleted",
      "metadata": {
        "dataSourceName": "Public Credit Transactions",
        "activity": "access",
        "action": "revoked"
      },
      "read": false,
      "id": 1251,
      "updatedAt": "2021-05-04T18:39:08.555Z",
      "actionBy": {
        "id": 2,
        "name": "John",
        "email": "john.doe@immuta.com"
      },
     "targetUser": {
        "id": 2,
        "name": "John",
        "email": "john.doe@immuta.com"
      }
    }
  ],
  "unread": 210,
  "next": "1251_2021-05-04T18:39:08.555Z"
}
```

### Review your unread notifications

<mark style="color:green;">`GET`</mark> `/activity/hasUnread`

Determine whether you have unread activity notifications.

#### Response parameters

| Attribute | Description                                          |
| --------- | ---------------------------------------------------- |
| unread    | `boolean` If `true`, the user has unread activities. |

#### Request example

This request determines whether or not the requesting user has unread activities.

```bash
curl \
    --request GET \
    --header "Content-Type: application/json" \
    --header "Authorization: Bearer dea464c07bd07300095caa8" \
    https://demo.immuta.com/activity/hasUnread
```

#### Response example

```json
{
  "unread": false
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.immuta.com/saas/developer-guides/api-intro/immuta-v1-api/configure-your-instance-of-immuta/activity.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
