-
Notifications
You must be signed in to change notification settings - Fork 0
API Documentation Sample: Blog Posts API
This is a sample documentation for a fictional blog posts API
The Blog Posts API allows developers to create, retrieve, update, and delete blog posts for a simple content-driven web application.
It is designed for products that need to manage written content such as blogs, newsletters, or knowledge bases.
All requests and responses use JSON.
This API uses Bearer token authentication.
Include your API key in the Authorization header for every request.
Authorization: Bearer YOUR_API_KEY
Requests without a valid API key will return a 401 Unauthorized response.
Creates a new blog post.
POST /posts
{
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}{
"title": "Understanding APIs",
"content": "APIs allow applications to communicate with each other..."
}{
"id": "post_12345",
"title": "Understanding APIs",
"content": "APIs allow applications to communicate with each other.",
"created_at": "2026-01-05T12:00:00Z"
}Returns a list of all blog posts.
GET /posts
{
"Authorization": "Bearer YOUR_API_KEY"
}[
{
"id": "post_12345",
"title": "Understanding APIs",
"created_at": "2026-01-05T12:00:00Z"
},
{
"id": "post_67890",
"title": "Getting Started with REST",
"created_at": "2026-01-04T09:30:00Z"
}
]Returns a specific blog post by ID.
GET /posts/{id}
{
"Authorization": "Bearer YOUR_API_KEY"
}{
"id": "post_12345",
"title": "Understanding APIs",
"content": "APIs allow applications to communicate with each other.",
"created_at": "2026-01-05T12:00:00Z"
}Updates an existing blog post.
PUT /posts/{id}
{
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}{
"title": "Understanding REST APIs",
"content": "REST APIs use standard HTTP methods for communication..."
}{
"id": "post_12345",
"title": "Understanding REST APIs",
"content": "REST APIs use standard HTTP methods for communication.",
"updated_at": "2026-01-06T08:15:00Z"
}Deletes a blog post permanently.
DELETE /posts/{id}
{
"Authorization": "Bearer YOUR_API_KEY"
}{
"message": "Blog post deleted successfully."
}All error responses follow a consistent structure.
{
"error": "Unauthorized",
"message": "Invalid API key provided."
}-
Obtain an API key
-
Add the key to the
Authorizationheader -
Make your first request using the /posts endpoint