Overview
For clients unable to maintain persistent WebSocket connections, the REST polling endpoint provides an alternative notification retrieval mechanism. This approach supports battery-constrained devices and simplified client implementations.Fetch Pending Notifications
Endpoint:GET /api/v1/client/notifications
Authentication: Requires Bearer token using user credentials
Query Parameters
Parameter | Type | Required | Description |
---|---|---|---|
status | string | No | Filter by notification state, e.g., “pending” (default: all) |
limit | integer | No | Maximum notifications to return (default: 50, max: 100) |
cursor | string | No | Pagination cursor from previous response |
service_id | string | No | Filter by originating service ID |
project | string | No | Filter by project identifier |
sort | string | No | Sort order, either “newest” or “oldest” (default: “newest”) |
Response
pagination
object contains:
Field | Type | Description |
---|---|---|
next_cursor | string | Cursor to use for fetching the next page |
has_more | boolean | Indicates if more results are available |
total_count | integer | Total count of matching notifications |
Error Responses
Status Code | Error Code | Description |
---|---|---|
400 Bad Request | INVALID_PARAMETER | Invalid query parameter |
401 Unauthorized | AUTH_INVALID_TOKEN | User token is invalid |
429 Too Many Requests | RATE_LIMIT_EXCEEDED | Rate limit exceeded |
Fetch Single Notification
Endpoint:GET /api/v1/client/notifications/{id}
Authentication: Requires Bearer token using user credentials
Path Parameters
Parameter | Type | Description |
---|---|---|
id | string | The UUID of the notification to retrieve |
Response
Returns a single notification object with the same structure as in the list endpoint.Error Responses
Status Code | Error Code | Description |
---|---|---|
401 Unauthorized | AUTH_INVALID_TOKEN | User token is invalid |
403 Forbidden | NOTIFICATION_ACCESS_DENIED | User does not have access to this notification |
404 Not Found | NOTIFICATION_NOT_FOUND | Notification with specified ID does not exist |
Acknowledge Notification
Endpoint:POST /api/v1/client/notifications/{id}/acknowledge
Authentication: Requires Bearer token using user credentials This endpoint allows clients to acknowledge receipt of a notification, updating its status to
acknowledged
.
Path Parameters
Parameter | Type | Description |
---|---|---|
id | string | The UUID of the notification to acknowledge |
Response
Status Code:200 OK
Error Responses
Status Code | Error Code | Description |
---|---|---|
401 Unauthorized | AUTH_INVALID_TOKEN | User token is invalid |
403 Forbidden | NOTIFICATION_ACCESS_DENIED | User does not have access to this notification |
404 Not Found | NOTIFICATION_NOT_FOUND | Notification with specified ID does not exist |
409 Conflict | NOTIFICATION_ALREADY_RESPONDED | Notification has already been responded to |
Examples
Fetch Pending Notifications - JavaScript
Fetch Pending Notifications - Python
Acknowledge Notification - JavaScript
Polling Strategy
For applications that use REST polling instead of WebSockets, implement an efficient polling strategy to minimize battery consumption and server load:- Adaptive Polling: Adjust polling frequency based on notification activity
- Background Polling: Use platform-specific background fetch capabilities for mobile apps
- Exponential Backoff: Increase polling interval after periods of inactivity
- Priority-Based: Poll more frequently for high-priority projects or services
Example Adaptive Polling Strategy
Best Practices
- Use WebSockets When Possible: Prefer WebSocket connections for real-time updates when available
- Efficient Polling: Implement adaptive polling to reduce server load and battery consumption
- Use Pagination: Always handle pagination correctly to retrieve all notifications
- Cache Results: Cache notification data to reduce redundant API calls
- Batch Operations: Use the bulk acknowledge endpoint for marking multiple notifications
- Error Handling: Implement proper error handling and retries for network failures