Overview
Welcome!
JSONPlaceholder is a free online REST API that you can use for testing and prototyping.
It provides fake endpoints for common resources such as posts, comments, users, todos, and more.
Base URL
[https://jsonplaceholder.typicode.com](https://jsonplaceholder.typicode.com)
Resources
Here are the main resources you can interact with:
| Resource | Endpoint | Description |
|---|---|---|
| Posts | /posts | Blog posts with title and body. |
| Comments | /comments | Comments tied to posts. |
| Albums | /albums | Collections of photos. |
| Photos | /photos | Photos inside albums. |
| Todos | /todos | To-do tasks with completion state. |
| Users | /users | User profiles with details. |
How to Use
- JavaScript (fetch)
- JavaScript (Axios)
- Python (requests)
fetch('https://jsonplaceholder.typicode.com/posts/1')
.then(response => response.json())
.then(json => console.log(json))
import axios from 'axios';
axios.get('https://jsonplaceholder.typicode.com/posts/1')
.then(response => {
console.log(response.data);
});
import requests
response = requests.get("https://jsonplaceholder.typicode.com/posts/1")
print(response.json())
Example Response
{
"userId": 1,
"id": 1,
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
"body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum..."
}