JSONPlaceholder API
Fake REST API for testing and prototyping — posts, users, todos and more.
What it does
JSONPlaceholder is a free fake REST API for prototyping and tutorials. It serves a fixed dataset — 100 posts, 500 comments, 100 albums, 5,000 photos, 200 to-dos and 10 users — with full GET support and simulated POST/PUT/PATCH/DELETE that return a plausible response without persisting anything.
Base URL
Authentication
None. No key, no sign-up, no limits worth worrying about.
Code examples
curl -s https://jsonplaceholder.typicode.com/posts/1 curl -s "https://jsonplaceholder.typicode.com/posts?userId=1" curl -s https://jsonplaceholder.typicode.com/posts/1/comments
const res = await fetch("https://jsonplaceholder.typicode.com/todos?_limit=5");
const todos = await res.json();
console.log(todos.map(t => t.title));
// "Creating" a post is faked: you get id 101 back but nothing is stored
const created = await fetch("https://jsonplaceholder.typicode.com/posts", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ title: "hi", userId: 1 }),
}).then(r => r.json());
console.log(created.id); // 101Rate limits & quotas
No hard rate limit. Supports handy query params: _limit, _page, _sort, _order, field filters (?userId=1) and nested routes (/posts/1/comments). Writes always ‘succeed’ but changes are not saved — reload and they are gone.
Key response fields
| /posts, /comments, /albums, /photos, /todos, /users | The six resources |
| id | 1-indexed; POST returns the next id but does not persist |
| userId | Foreign key linking posts/albums/todos to a user |
| _limit / _page | Client-side-friendly pagination params |
Common errors
| 404 | Unknown id or resource (e.g. /posts/999). |
| (no real errors) | Writes never fail — that is the point; don’t build error handling tests here. |
When to use it (and alternatives)
The standard choice for front-end demos, teaching HTTP, and wiring up a UI before the real backend exists. If you need writes that actually persist for a session, use Reqres or run json-server locally. For request echoing use httpbin.
FAQ
Does JSONPlaceholder save data I POST?
No. It returns a realistic response (including a new id) so your code path works, but the dataset is read-only and resets. Use json-server locally if you need real persistence.
Can I paginate results?
Yes — ?_page=2&_limit=10. The total count comes back in the X-Total-Count header.
Is it going to stay up?
It has run reliably for years on the same infrastructure as the json-server project, but treat any free public service as best-effort.
New to APIs?
Short guides for working with this API — and any other.