API Reference
Complete reference for all JSONPlaceholder.dev API endpoints. This documentation matches the comprehensive Postman collection structure.
🌐 Public API Available
Ready to use! You can test all these endpoints immediately using our public API at https://api.jsonplaceholder.dev
- no setup required!
Base URL
https://api.jsonplaceholder.dev
http://localhost:3000
Authentication
No authentication required. This is a public testing API.
Response Format
All responses are in JSON format. Success responses return the requested data, while error responses include an error message.
// Success Response Example
{
"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "[email protected]"
}
// Error Response Example
{
"error": "Not Found",
"message": "Resource with ID 999 not found"
}
HTTP Status Codes
200 OK
- Successful GET, PUT, PATCH201 Created
- Successful POST204 No Content
- Successful DELETE400 Bad Request
- Invalid request data404 Not Found
- Resource not found500 Internal Server Error
- Server error
Posts
Manage blog posts with full CRUD operations.
Get All Posts
GET /posts
Response: Array of all posts (100 items)
Get Posts by User
GET /posts?userId={userId}
Parameters:
userId
(number) - Filter posts by user ID
Response: Array of posts by the specified user
Get Single Post
GET /posts/{id}
Parameters:
id
(number) - Post ID
Response: Single post object
Get Post Comments
GET /posts/{id}/comments
Parameters:
id
(number) - Post ID
Response: Array of comments for the specified post
Create Post
POST /posts
Content-Type: application/json
Request Body:
{
"userId": 1,
"title": "New Post Title",
"body": "Post content goes here"
}
Response: Created post with assigned ID
Update Post (Full Replace)
PUT /posts/{id}
Content-Type: application/json
Parameters:
id
(number) - Post ID
Request Body:
{
"id": 1,
"userId": 1,
"title": "Updated Post Title",
"body": "Updated post content"
}
Response: Updated post object
Update Post (Partial)
PATCH /posts/{id}
Content-Type: application/json
Parameters:
id
(number) - Post ID
Request Body:
{
"title": "New Title Only"
}
Response: Updated post object
Delete Post
DELETE /posts/{id}
Parameters:
id
(number) - Post ID
Response: Empty response with 204 status
Users
Manage user accounts with complete profile information.
Get All Users
GET /users
Response: Array of all users (10 items)
Get Single User
GET /users/{id}
Parameters:
id
(number) - User ID
Response: Single user object with full profile
Get User Posts
GET /users/{id}/posts
Parameters:
id
(number) - User ID
Response: Array of posts by the specified user
Get User Albums
GET /users/{id}/albums
Parameters:
id
(number) - User ID
Response: Array of albums by the specified user
Get User Todos
GET /users/{id}/todos
Parameters:
id
(number) - User ID
Response: Array of todos by the specified user
Create User
POST /users
Content-Type: application/json
Request Body:
{
"name": "John Doe",
"username": "johndoe",
"email": "[email protected]",
"address": {
"street": "123 Main St",
"city": "New York",
"zipcode": "10001"
},
"phone": "1-555-123-4567",
"website": "johndoe.com"
}
Response: Created user with assigned ID
Update User (Full Replace)
PUT /users/{id}
Content-Type: application/json
Parameters:
id
(number) - User ID
Request Body: Complete user object (same as POST)
Response: Updated user object
Update User (Partial)
PATCH /users/{id}
Content-Type: application/json
Parameters:
id
(number) - User ID
Request Body:
{
"email": "[email protected]"
}
Response: Updated user object
Delete User
DELETE /users/{id}
Parameters:
id
(number) - User ID
Response: Empty response with 204 status
Comments
Manage post comments with full CRUD operations.
Get All Comments
GET /comments
Response: Array of all comments (500 items)
Get Comments by Post (Query)
GET /comments?postId={postId}
Parameters:
postId
(number) - Filter comments by post ID
Response: Array of comments for the specified post
Get Comments by Post (Path)
GET /posts/{postId}/comments
Parameters:
postId
(number) - Post ID
Response: Array of comments for the specified post
Get Single Comment
GET /comments/{id}
Parameters:
id
(number) - Comment ID
Response: Single comment object
Create Comment
POST /comments
Content-Type: application/json
Request Body:
{
"postId": 1,
"name": "Great post!",
"email": "[email protected]",
"body": "Thanks for sharing this information!"
}
Response: Created comment with assigned ID
Update Comment (Full Replace)
PUT /comments/{id}
Content-Type: application/json
Parameters:
id
(number) - Comment ID
Request Body: Complete comment object
Response: Updated comment object
Update Comment (Partial)
PATCH /comments/{id}
Content-Type: application/json
Parameters:
id
(number) - Comment ID
Request Body:
{
"body": "Updated comment text"
}
Response: Updated comment object
Delete Comment
DELETE /comments/{id}
Parameters:
id
(number) - Comment ID
Response: Empty response with 204 status
Albums
Manage photo albums with full CRUD operations.
Get All Albums
GET /albums
Response: Array of all albums (100 items)
Get Albums by User
GET /albums?userId={userId}
Parameters:
userId
(number) - Filter albums by user ID
Response: Array of albums for the specified user
Get Single Album
GET /albums/{id}
Parameters:
id
(number) - Album ID
Response: Single album object
Get Album Photos
GET /albums/{id}/photos
Parameters:
id
(number) - Album ID
Response: Array of photos in the specified album
Create Album
POST /albums
Content-Type: application/json
Request Body:
{
"userId": 1,
"title": "My Vacation Photos"
}
Response: Created album with assigned ID
Update Album (Full Replace)
PUT /albums/{id}
Content-Type: application/json
Parameters:
id
(number) - Album ID
Request Body: Complete album object
Response: Updated album object
Update Album (Partial)
PATCH /albums/{id}
Content-Type: application/json
Parameters:
id
(number) - Album ID
Request Body:
{
"title": "Updated Album Title"
}
Response: Updated album object
Delete Album
DELETE /albums/{id}
Parameters:
id
(number) - Album ID
Response: Empty response with 204 status
Photos
Manage photos with full CRUD operations.
Get All Photos
GET /photos
Response: Array of all photos (5000 items) - Note: This is a large response
Get Photos by Album (Query)
GET /photos?albumId={albumId}
Parameters:
albumId
(number) - Filter photos by album ID
Response: Array of photos for the specified album
Get Photos by Album (Path)
GET /albums/{albumId}/photos
Parameters:
albumId
(number) - Album ID
Response: Array of photos in the specified album
Get Single Photo
GET /photos/{id}
Parameters:
id
(number) - Photo ID
Response: Single photo object
Create Photo
POST /photos
Content-Type: application/json
Request Body:
{
"albumId": 1,
"title": "Beautiful sunset",
"url": "https://via.placeholder.com/600/sunset",
"thumbnailUrl": "https://via.placeholder.com/150/sunset"
}
Response: Created photo with assigned ID
Update Photo (Full Replace)
PUT /photos/{id}
Content-Type: application/json
Parameters:
id
(number) - Photo ID
Request Body: Complete photo object
Response: Updated photo object
Update Photo (Partial)
PATCH /photos/{id}
Content-Type: application/json
Parameters:
id
(number) - Photo ID
Request Body:
{
"title": "New Photo Title"
}
Response: Updated photo object
Delete Photo
DELETE /photos/{id}
Parameters:
id
(number) - Photo ID
Response: Empty response with 204 status
Todos
Manage todo items with full CRUD operations.
Get All Todos
GET /todos
Response: Array of all todos (200 items)
Get Todos by User
GET /todos?userId={userId}
Parameters:
userId
(number) - Filter todos by user ID
Response: Array of todos for the specified user
Get Single Todo
GET /todos/{id}
Parameters:
id
(number) - Todo ID
Response: Single todo object
Create Todo
POST /todos
Content-Type: application/json
Request Body:
{
"userId": 1,
"title": "Learn API testing",
"completed": false
}
Response: Created todo with assigned ID
Update Todo (Full Replace)
PUT /todos/{id}
Content-Type: application/json
Parameters:
id
(number) - Todo ID
Request Body: Complete todo object
Response: Updated todo object
Update Todo (Partial)
PATCH /todos/{id}
Content-Type: application/json
Parameters:
id
(number) - Todo ID
Request Body:
{
"completed": true
}
Response: Updated todo object
Delete Todo
DELETE /todos/{id}
Parameters:
id
(number) - Todo ID
Response: Empty response with 204 status
Admin
Administrative endpoints for data management.
Reset All Data
POST /reset
Requirements:
- Server must be running with
ENABLE_UPDATES=1
- Only works in live mode, not read-only mode
Response:
{
"message": "Data reset successful",
"timestamp": "2024-01-01T12:00:00.000Z",
"cleared": {
"cache": true,
"data": true
}
}
Error Response (Read-only mode):
{
"error": "Forbidden",
"message": "Reset endpoint is only available when ENABLE_UPDATES=1"
}
Data Models
User Model
{
"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "[email protected]",
"address": {
"street": "Kulas Light",
"suite": "Apt. 556",
"city": "Gwenborough",
"zipcode": "92998-3874",
"geo": {
"lat": "-37.3159",
"lng": "81.1496"
}
},
"phone": "1-770-736-8031",
"website": "hildegard.org",
"company": {
"name": "Romaguera-Crona",
"catchPhrase": "Multi-layered client-server neural-net",
"bs": "harness real-time e-markets"
}
}
Post Model
{
"userId": 1,
"id": 1,
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
"body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
}
Comment Model
{
"postId": 1,
"id": 1,
"name": "id labore ex et quam laborum",
"email": "[email protected]",
"body": "laudantium enim quasi est quidem magnam voluptate ipsam eos\ntempora quo necessitatibus\ndolor quam autem quasi\nreiciendis et nam sapiente accusantium"
}
Album Model
{
"userId": 1,
"id": 1,
"title": "quidem molestiae enim"
}
Photo Model
{
"albumId": 1,
"id": 1,
"title": "accusamus beatae ad facilis cum similique qui sunt",
"url": "https://via.placeholder.com/600/92c952",
"thumbnailUrl": "https://via.placeholder.com/150/92c952"
}
Todo Model
{
"userId": 1,
"id": 1,
"title": "delectus aut autem",
"completed": false
}
Rate Limiting
Currently, there are no rate limits imposed. However, for performance testing with tools like autocannon, consider:
- Use
DISABLE_CORS=1
for maximum throughput - Enable caching with
ENABLE_CACHE=1
- Use specific endpoints rather than fetching all 5000 photos
Error Handling
All endpoints may return these common errors:
- 404 Not Found - Resource with specified ID doesn't exist
- 400 Bad Request - Invalid JSON or missing required fields
- 500 Internal Server Error - Unexpected server error
When using the reset endpoint:
- 403 Forbidden - Server running in read-only mode (
ENABLE_UPDATES=0
)
Postman Collection
Import the complete Postman collection from collections/JSONPlaceholder.postman_collection.json
to test all these endpoints with pre-configured requests and sample data.
The collection includes:
- All CRUD operations for every resource
- Query parameter examples
- Sample request bodies
- Proper error handling examples
- Admin reset functionality