Skip to content

Likes

The Likes resource provides fake like data, tracking which users have liked which social posts.

MethodEndpointDescription
GET/v1/likesList all likes
GET/v1/likes/:idGet a specific like
{
"id": 1,
"socialPostId": 1,
"userId": 2,
"createdAt": "2026-01-15T11:00:00.000Z"
}
Field Type Description
id number Unique identifier
socialPostId number ID of the liked post
userId number ID of the user who liked
createdAt string ISO 8601 timestamp
Terminal window
curl https://api.phantomjson.app/v1/likes
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
socialPostId number Filter by post ID
userId number Filter by user ID
{
"data": [
{
"id": 1,
"socialPostId": 1,
"userId": 2,
"createdAt": "2026-01-15T11:00:00.000Z"
}
],
"meta": {
"total": 200,
"page": 1,
"limit": 20,
"totalPages": 10
}
}
Terminal window
curl https://api.phantomjson.app/v1/likes/1
{
"data": {
"id": 1,
"socialPostId": 1,
"userId": 2,
"createdAt": "2026-01-15T11:00:00.000Z"
}
}
Terminal window
curl "https://api.phantomjson.app/v1/likes?socialPostId=1"
Terminal window
curl "https://api.phantomjson.app/v1/likes?userId=2"
Terminal window
# Newest first
curl "https://api.phantomjson.app/v1/likes?sort=createdAt:desc"
# Oldest first
curl "https://api.phantomjson.app/v1/likes?sort=createdAt:asc"
Terminal window
curl "https://api.phantomjson.app/v1/likes?fields=id,socialPostId,userId"
Terminal window
# Likes on post 1 by user 2
curl "https://api.phantomjson.app/v1/likes?socialPostId=1&userId=2"
  • Social Post — Each like belongs to a social post (socialPostId)
  • User — Each like belongs to a user (userId)