Skip to content

Comments

The Comments resource provides fake comment data with names, emails, and body content.

Available Endpoints

MethodEndpointDescription
GET/v1/commentsList all comments
GET/v1/comments/:idGet a specific comment
{
"id": 1,
"postId": 1,
"name": "Jane Doe",
"email": "jane@example.com",
"body": "Great post!",
"createdAt": "2026-01-15T10:30:00.000Z",
"updatedAt": "2026-01-15T10:30:00.000Z"
}
Field Type Description
id number Unique identifier
postId number ID of the post
name string Commenter’s name
email string Commenter’s email
body string Comment content
createdAt string ISO 8601 timestamp
updatedAt string ISO 8601 timestamp
Terminal window
curl https://api.phantomjson.app/v1/comments
Parameter Type Default Description
page number 1 Page number
limit number 20 Items per page (max: 100)
sort string Sort field and direction
q string Search query
fields string Fields to return
postId number Filter by post ID
{
"data": [
{
"id": 1,
"postId": 1,
"name": "Jane Doe",
"email": "jane@example.com",
"body": "Great post!"
}
],
"meta": {
"total": 1500,
"page": 1,
"limit": 20,
"totalPages": 75
}
}
Terminal window
curl https://api.phantomjson.app/v1/comments/1
{
"data": {
"id": 1,
"postId": 1,
"name": "Jane Doe",
"email": "jane@example.com",
"body": "Great post!"
}
}
Terminal window
curl "https://api.phantomjson.app/v1/comments?q=great"
Terminal window
curl "https://api.phantomjson.app/v1/comments?postId=1"
Terminal window
curl "https://api.phantomjson.app/v1/comments?sort=name:asc"
Terminal window
curl "https://api.phantomjson.app/v1/comments?fields=id,name,body"
  • Post — Each comment belongs to a post (postId)
  • Access comments for a specific post via /v1/posts/:id/comments