# Request Notifications 
source: https://developer.mastercard.com/commercial-event-notifications/documentation/use_cases/request_notifications/index.md

There may be situations where you need to retrieve notifications independently of the push notification stream. The Commercial Event Notifications service retains notifications for a limited period of time
and you can, at any point, retrieve notifications generated within a specified time range. Notifications are currently retained for 7 days from the time that the notification was generated.
Refer to the notification [query parameters](https://developer.mastercard.com/commercial-event-notifications/documentation/parameters/notifications/notifications/index.md#query-parameters) for details of the parameters to send with your request.
Diagram receive-notifications

```java
//Calling Get All notifications sort by Subscription Name.
NotificationsApi notificationsApi = new NotificationsApi(client);  // passing the Apiclient
NotificationsWrapper notifications = null;
OffsetDateTime startDate = OffsetDateTime.of(LocalDateTime.now().minusDays(1), ZoneOffset.UTC);
OffsetDateTime endDate = OffsetDateTime.now(ZoneOffset.UTC);
List<String> subscriptionNames = null;
String pushStatus = null;
Integer offset = 10;
Integer limit = 5;
try {
    notifications = notificationsApi.notificationsGet(startDate, endDate, subscriptionNames, pushStatus, offset, limit);
} catch (ApiException e) {
    System.err.println("Exception when calling get Notifications");
    e.printStackTrace();
}
System.out.println("Get system generated notification from past 24 hours:" + notifications.toString());
```

In the above code, you are passing:

* The initialized client for authentication.
* The start date/time and the end date/time for which you want to retrieve notifications.
* The offset and the limit parameters, needed to step through a paginated response.

The response to this request will contain zero or more notifications, contained in a [notification payload](https://developer.mastercard.com/commercial-event-notifications/documentation/parameters/notifications/notifications/index.md).
Responses are paginated, therefore you must check the pagination fields and make further requests to retrieve the remaining notifications as needed.

Notifications are returned for the period from the start date/time to the end date/time, inclusive of the start but exclusive of the end. This allows you to make sequential requests, without risking overlaps or gaps in the time period, by using the end time of a previous request as the start time of the next request.

### Try it Out {#try-it-out}


API Reference: `GET /notifications`

### Additional Information {#additional-information}

Refer to the [Codes and Formats](https://developer.mastercard.com/commercial-event-notifications/documentation/codeandformats/index.md) for more information about error codes.
