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

# Get Notifications

Use this API to retrieve notifications.

> [!WARNING]
>
> Prior to using this API, you must:
>
> * Enable advanced queries option in [the console](https://console.velt.dev/dashboard/config/appconfig)
> * Deploy v4 series of the Velt SDK.

# Endpoint

`POST https://api.velt.dev/v2/notifications/get`

# Headers

**x-velt-api-key** `string` *required*

Your API key.

**x-velt-auth-token** `string` *required*

Your [Auth Token](https://velt.dev/docs/security/auth-tokens.md).

# Body

#### Params

**data** `object` *required*

**properties**

**organizationId** `string` *required*

Organization ID

**documentId** `string`

Document ID. Either pass this or userId.

**locationId** `string`

Location ID

**userId** `string`

User ID. Either pass this or documentId.

**notificationIds** `string[]`

Array of Notification IDs. Limit: Only 30 items can be passed at a time.

**pageSize** `number`

Number of items to be retrieved per page. Default: 1000.

**pageToken** `string`

Page token retrieved from previous API call.

**order** `string`

Order of the notifications based on timestamp. Must be either `asc` or `desc`. Default: `desc`.

## **Example Requests**

#### 1. Get by organizationId, documentId

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "documentId": "yourDocumentId",
    "pageSize": 20,
    "pageToken": "8740648311207869"
  }
}
```

#### 2. Get by organizationId, documentId and notificationIds

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "documentId": "yourDocumentId",
    "notificationIds": [
      "yourNotificationId"
    ]
  }
}
```

#### 3. Get by organizationId, documentId and locationId

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "documentId": "yourDocumentId",
    "locationId": "yourLocationId",
    "pageSize": 20,
    "pageToken": "8740648311207869"
  }
}
```

#### 4. Get by organizationId, documentId, locationId and notificationIds

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "documentId": "yourDocumentId",
    "locationId": "yourLocationId",
    "notificationIds": [
      "yourNotificationId"
    ]
  }
}
```

#### 5. Get by organizationId and userId

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "userId": "yourUserId",
    "pageSize": 20,
    "pageToken": "8740648311207869"
  }
}
```

#### 6. Get by organizationId, userId and notificationIds

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "userId": "yourUserId",
    "notificationIds": [
      "yourNotificationId"
    ]
  }
}
```

#### 7. Get by organizationId, documentId and userId

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "documentId": "yourDocumentId",
    "userId": "yourUserId",
    "pageSize": 20,
    "pageToken": "8740648311207869"
  }
}
```

#### 8. Get by organizationId, locationId and userId

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "userId": "yourUserId",
    "locationId": "yourLocationId",
    "pageSize": 20,
    "pageToken": "8740648311207869"
  }
}
```

#### 9. Get by organizationId, documentId, locationId, and userId

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "documentId": "yourDocumentId",
    "userId": "yourUserId",
    "locationId": "yourLocationId",
    "pageSize": 20,
    "pageToken": "8740648311207869"
  }
}
```

# Response

> [!NOTE]
>
> Velt filters results by comment visibility. A notification for a private comment reaches only users who can see that comment. This check runs in addition to any Access Context filtering.

#### Success Response

```JSON theme={null}
{
  "result": {
    "status": "success",
    "message": "Notification(s) retrieved successfully.",
    "data": [
      {
        "id": "notificationId",
        "notificationSource": "custom",
        "notificationSourceData": {}, //The data of the notification source. e.g., CommentAnnotation
        "actionUser": {
          "email": "user@example.com",
          "name": "User Name",
          "userId": "yourUserId"
        },
        "displayBodyMessage": "This is body message (Secondary message)",
        "displayHeadlineMessageTemplate": "This is main template, you can pass variables using curly brackets like this: {actionUser}, {recipientUser}, {yourCustomVariableWithStringValue}",
        "displayHeadlineMessageTemplateData": {
          "actionUser": {
            "email": "user@example.com",
            "name": "User Name",
            "userId": "yourUserId"
          },
          "recipientUser": {
            "email": "recipient@example.com",
            "name": "Recipient Name",
            "userId": "recipientUserId"
          },
          "yourCustomVariableWithStringValue": "Variable will be replaced with this text"
        },
        "metadata": {
          "apiKey": "yourApiKey",
          "documentId": "yourDocumentId",
          "organizationId": "yourOrganizationId"
        },
        "notifyUsers": {
          "yourNotifyUserId": true
        },
        "notifyUsersByUserId": {
          "yourNotifyUserById": true
        },
        "timestamp": 1722409519944
      }
    ],
    "pageToken": "nextPageToken"
  }
}
```

#### Failure Response

```JSON theme={null}
{
  "error": {
    "message": "ERROR_MESSAGE",
    "status": "INVALID_ARGUMENT"
  }
}
```

```js theme={null}
{
  "result": {
    "status": "success",
    "message": "Notification(s) retrieved successfully.",
    "data": [
      {
        "id": "notificationId",
        "notificationSource": "custom",
        "notificationSourceData": {}, //The data of the notification source. e.g., CommentAnnotation
        "actionUser": {
          "email": "user@example.com",
          "name": "User Name",
          "userId": "yourUserId"
        },
        "displayBodyMessage": "This is body message (Secondary message)",
        "displayHeadlineMessageTemplate": "This is main template, you can pass variables using curly brackets like this: {actionUser}, {recipientUser}, {yourCustomVariableWithStringValue}",
        "displayHeadlineMessageTemplateData": {
          "actionUser": {
            "email": "user@example.com",
            "name": "User Name",
            "userId": "yourUserId"
          },
          "recipientUser": {
            "email": "recipient@example.com",
            "name": "Recipient Name",
            "userId": "recipientUserId"
          },
          "yourCustomVariableWithStringValue": "Variable will be replaced with this text"
        },
        "metadata": {
          "apiKey": "yourApiKey",
          "documentId": "yourDocumentId",
          "organizationId": "yourOrganizationId"
        },
        "notifyUsers": {
          "yourNotifyUserId": true
        },
        "notifyUsersByUserId": {
          "yourNotifyUserById": true
        },
        "timestamp": 1722409519944
      }
    ],
    "pageToken": "nextPageToken"
  }
}
```


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