API Reference
JSONPlaceholder provides a complete REST API with 6 main resource types. All endpoints support standard HTTP methods and return JSON responses.
Base URL
bash
https://api.jsonplaceholder.dev
bash
http://localhost:3000
Quick Overview
Get basic API information:
bash
GET /
json
{
"message": "🚀 JSONPlaceholder - Powered by Bun + Elysia.js",
"version": "2.0.0",
"resources": {
"posts": "100 posts",
"comments": "500 comments",
"albums": "100 albums",
"photos": "5000 photos",
"todos": "200 todos",
"users": "10 users"
},
"endpoints": {
"users": "/users",
"posts": "/posts",
"comments": "/comments",
"albums": "/albums",
"photos": "/photos",
"todos": "/todos"
}
}
Resources
Resource | Description | Count |
---|---|---|
Users | User accounts with complete profile information | 10 |
Posts | Blog posts with title and content | 100 |
Comments | Comments on posts | 500 |
Albums | Photo albums | 100 |
Photos | Individual photos with URLs | 5000 |
Todos | Todo items with completion status | 200 |
HTTP Methods
All resources support the following HTTP methods:
Method | Description | Example |
---|---|---|
GET | Retrieve resource(s) | GET /posts |
POST | Create new resource | POST /posts |
PUT | Update entire resource | PUT /posts/1 |
PATCH | Partially update resource | PATCH /posts/1 |
DELETE | Delete resource | DELETE /posts/1 |
Common Patterns
Get All Resources
bash
GET /posts
GET /users
GET /comments
Get Single Resource
bash
GET /posts/1
GET /users/1
GET /comments/1
Filter by Related Resource
bash
GET /posts?userId=1
GET /comments?postId=1
GET /albums?userId=1
Get Related Resources
bash
GET /users/1/posts
GET /users/1/albums
GET /posts/1/comments
Response Format
All responses are in JSON format with proper HTTP status codes:
- 200 - Success
- 201 - Created (for POST requests)
- 404 - Not Found
- 500 - Server Error
Success Response
json
{
"id": 1,
"title": "Example Post",
"body": "This is an example post content",
"userId": 1
}
Error Response
json
{
"error": "Post not found",
"status": "error"
}
Rate Limiting
There are no rate limits on the JSONPlaceholder API. It's designed for testing and development purposes.
CORS
CORS is enabled for all origins and methods, making it perfect for frontend development:
http
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, PUT, PATCH, DELETE
Access-Control-Allow-Headers: Content-Type