List posts

GET /posts
Returns all posts. Supports filtering by user.

Query Parameters

NameTypeDescription
userId ?integerFilter posts by user ID

Responses

A list of posts

array<Post> application/json
NameTypeDescription
userId ?integer
id ?integer
title ?string
body ?string
curl -X GET 'https://jsonplaceholder.typicode.com/posts'
const response = await fetch('https://jsonplaceholder.typicode.com/posts', {
  method: 'GET',
  headers: { 'Accept': 'application/json' }
});
const data = await response.json();