JSONPlaceholder
jsonplaceholder.typicode.com · Developer Tools
Free fake REST API for testing and prototyping. Posts, comments, albums, photos, todos, and users. No API key required — great for learning and demos.
Authentication
No authentication requiredFree to use with no key needed.
Sample Requests
GET
Get posts
Get all 100 fake posts.
https://jsonplaceholder.typicode.com/posts
Hover any highlighted part to learn what it does
curl -X GET "https://jsonplaceholder.typicode.com/posts"
import requests
response = requests.get(
"https://jsonplaceholder.typicode.com/posts",
)
print(response.json())const url = 'https://jsonplaceholder.typicode.com/posts'; const response = await fetch(url); const data = await response.json(); console.log(data);
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
targetURL := "https://jsonplaceholder.typicode.com/posts"
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://jsonplaceholder.typicode.com/posts")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://jsonplaceholder.typicode.com/posts";
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));
POST
Create a post
Create a fake post (returns the new post — nothing is persisted).
https://jsonplaceholder.typicode.com/posts
Hover any highlighted part to learn what it does
Headers — extra info sent with the request
| Content-Type | application/json |
Request Body — data you're sending
{
"body": "Hello World",
"title": "My Post",
"userId": 1
}
curl -X POST "https://jsonplaceholder.typicode.com/posts" \
-H "Content-Type: application/json" \
-H "Content-Type: application/json" \
-d '{"body":"Hello World","title":"My Post","userId":1}'import requests
headers = {
"Content-Type": "application/json"
}
data = {
"body": "Hello World",
"title": "My Post",
"userId": 1
}
response = requests.post(
"https://jsonplaceholder.typicode.com/posts",
headers=headers,
json=data,
)
print(response.json())const url = 'https://jsonplaceholder.typicode.com/posts';
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
"body": "Hello World",
"title": "My Post",
"userId": 1
}),
});
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"bytes"
"encoding/json"
)
func main() {
targetURL := "https://jsonplaceholder.typicode.com/posts"
jsonData, _ := json.Marshal({"body":"Hello World","title":"My Post","userId":1})
req, _ := http.NewRequest("POST", targetURL, bytes.NewBuffer(jsonData))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://jsonplaceholder.typicode.com/posts")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Post.new(uri)
req["Content-Type"] = "application/json"
req["Content-Type"] = "application/json"
req.body = "{\"body\":\"Hello World\",\"title\":\"My Post\",\"userId\":1}"
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://jsonplaceholder.typicode.com/posts";
$opts = ["http" => [
"method" => "POST",
"header" => implode("\r\n", [
"Content-Type: application/json",
"Content-Type: application/json"
]),
"content" => json_encode({"body":"Hello World","title":"My Post","userId":1}),
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Postman Setup Guide
- No API key needed
- GET /posts — all posts
- GET /posts/1 — single post
- GET /posts?userId=1 — posts by user
- POST, PUT, PATCH, DELETE all work but changes are not persisted