Skip to content

Posts

The Posts resource provides fake blog post data with titles, body content, and user relationships.

Available Endpoints

MethodEndpointDescription
GET/v1/postsList all posts
GET/v1/posts/:idGet a specific post
GET/v1/posts/:id/commentsGet post's comments
{
"id": 1,
"userId": 1,
"title": "First Post",
"body": "This is the body of the first post.",
"createdAt": "2026-01-15T10:30:00.000Z",
"updatedAt": "2026-01-15T10:30:00.000Z"
}
Field Type Description
id number Unique identifier
userId number ID of the author
title string Post title
body string Post content
createdAt string ISO 8601 timestamp
updatedAt string ISO 8601 timestamp
Terminal window
curl https://api.phantomjson.app/v1/posts
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
userId number Filter by user ID
{
"data": [
{
"id": 1,
"userId": 1,
"title": "First Post",
"body": "This is the body of the first post."
}
],
"meta": {
"total": 500,
"page": 1,
"limit": 20,
"totalPages": 25
}
}
Terminal window
curl https://api.phantomjson.app/v1/posts/1
{
"data": {
"id": 1,
"userId": 1,
"title": "First Post",
"body": "This is the body of the first post."
}
}
Terminal window
curl https://api.phantomjson.app/v1/posts/1/comments
{
"data": [
{
"id": 1,
"postId": 1,
"name": "Jane Doe",
"email": "jane@example.com",
"body": "Great post!"
}
],
"meta": {
"total": 3,
"page": 1,
"limit": 20,
"totalPages": 1
}
}
Terminal window
curl "https://api.phantomjson.app/v1/posts?q=react"
Terminal window
curl "https://api.phantomjson.app/v1/posts?userId=1"
Terminal window
curl "https://api.phantomjson.app/v1/posts?sort=createdAt:desc"
Terminal window
curl "https://api.phantomjson.app/v1/posts?fields=id,title,userId"
  • User — Each post belongs to a user (userId)
  • Comments — Each post has many comments (access via /v1/posts/:id/comments)