The auto-generated unique identifier for the new post
Create Post
Create a new blog post
POST
/posts Overview
Creates a new blog post. Requires authentication.
Authorization
Note
This endpoint requires a Bearer token for authentication.
Request Body
Body Parameters
title
required
Title of the post
body
required
Content of the post. Supports plain text or markdown.
userId
required
ID of the user creating the post
Response
Returns the created post object with the assigned ID.
id integer title string The title provided in the request
body string The content provided in the request
userId integer The user ID provided in the request
Example Request
{ "title": "My First Blog Post", "body": "This is the content of my first blog post. It supports **markdown** formatting!", "userId": 1}Example Response
{ "id": 101, "title": "My First Blog Post", "body": "This is the content of my first blog post. It supports **markdown** formatting!", "userId": 1}Error Responses
| Status | Description |
|---|---|
400 | Invalid request body - missing required fields |
401 | Unauthorized - missing or invalid Bearer token |
Try it out
POST
/posts Authorization
Bearer Token