Get post by ID

GET /posts/{postId}
Returns a single post by its ID.

Path Parameters

NameTypeDescription
postId requiredintegerPost ID

Responses

Post details

Post application/json
NameTypeDescription
userId ?integer
id ?integer
title ?string
body ?string

Post not found

curl -X GET 'https://jsonplaceholder.typicode.com/posts/{postId}'
const response = await fetch('https://jsonplaceholder.typicode.com/posts/{postId}', {
  method: 'GET',
  headers: { 'Accept': 'application/json' }
});
const data = await response.json();