Notifications
Overview
Section titled “Overview”The Notifications resource provides fake notification data with types, messages, and read status.
Endpoints
Section titled “Endpoints”| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/notifications | List all notifications |
| GET | /v1/notifications/:id | Get a specific notification |
Notification Object
Section titled “Notification Object”{ "id": 1, "userId": 1, "type": "like", "actorId": 2, "entityId": 15, "entityType": "social_post", "message": "John Doe liked your post", "read": false, "createdAt": "2026-01-15T12:00:00.000Z"}| Field | Type | Description |
|---|---|---|
id |
number |
Unique identifier |
userId |
number |
ID of the notification recipient |
type |
string |
Notification type (like, comment, follow, mention) |
actorId |
number |
ID of the user who triggered the notification |
entityId |
number |
ID of the related entity |
entityType |
string |
Type of the related entity (social_post, comment) |
message |
string |
Notification message text |
read |
boolean |
Whether the notification has been read |
createdAt |
string |
ISO 8601 timestamp |
List Notifications
Section titled “List Notifications”curl https://api.phantomjson.app/v1/notificationsQuery Parameters
Section titled “Query Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
page |
number |
1 |
Page number |
limit |
number |
20 |
Items per page (max: 100) |
sort |
string |
— | Sort field and direction |
fields |
string |
— | Fields to return |
userId |
number |
— | Filter by user ID |
type |
string |
— | Filter by notification type |
read |
boolean |
— | Filter by read status |
Response
Section titled “Response”{ "data": [ { "id": 1, "userId": 1, "type": "like", "actorId": 2, "entityId": 15, "entityType": "social_post", "message": "John Doe liked your post", "read": false, "createdAt": "2026-01-15T12:00:00.000Z" } ], "meta": { "total": 75, "page": 1, "limit": 20, "totalPages": 4 }}Get Notification by ID
Section titled “Get Notification by ID”curl https://api.phantomjson.app/v1/notifications/1Response
Section titled “Response”{ "data": { "id": 1, "userId": 1, "type": "like", "actorId": 2, "entityId": 15, "entityType": "social_post", "message": "John Doe liked your post", "read": false, "createdAt": "2026-01-15T12:00:00.000Z" }}Examples
Section titled “Examples”Filter by User
Section titled “Filter by User”curl "https://api.phantomjson.app/v1/notifications?userId=1"Filter by Type
Section titled “Filter by Type”curl "https://api.phantomjson.app/v1/notifications?type=like"Filter Unread Notifications
Section titled “Filter Unread Notifications”curl "https://api.phantomjson.app/v1/notifications?read=false"Sort by Creation Date
Section titled “Sort by Creation Date”# Newest firstcurl "https://api.phantomjson.app/v1/notifications?sort=createdAt:desc"
# Oldest firstcurl "https://api.phantomjson.app/v1/notifications?sort=createdAt:asc"Field Selection
Section titled “Field Selection”curl "https://api.phantomjson.app/v1/notifications?fields=id,type,message,read"Combined Query
Section titled “Combined Query”# Unread like notifications for user 1curl "https://api.phantomjson.app/v1/notifications?userId=1&type=like&read=false&sort=createdAt:desc"Relations
Section titled “Relations”- User — Each notification belongs to a user (
userId) - Actor — Each notification may have an actor user (
actorId)
