Create a post

POST /posts
Creates a new post (faked — returns the created object with an ID).

Body

requiredapplication/json
NameTypeDescription
title requiredstring
body requiredstring
userId requiredinteger

Responses

Post created

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