Complete Blog System API

Full-featured blogging platform with posts, comments, categories, tags, and media management

9
Resources
2025-11-28
2 days ago

Categories

Blog post categories

GET /api/blog/categories Public

Retrieve a paginated list of all categories

Request Example
GET /api/blog/categories
Accept: application/json
Response Example 200 OK
{
  "data": [
    {
        "name": "Web Development",
        "slug": "web-development",
        "description": "HTML, CSS, JavaScript and modern frameworks",
        "parent_id": null,
        "posts_count": 15,
        "color": "#3B82F6"
    },
    ...
  ],
  "meta": {
    "current_page": 1,
    "total": 50,
    "per_page": 15
  }
}
GET /api/blog/categories/{id} Public

Retrieve a single categorie by ID

Request Example
GET /api/blog/categories/1
Accept: application/json
Response Example 200 OK
{
    "name": "Web Development",
    "slug": "web-development",
    "description": "HTML, CSS, JavaScript and modern frameworks",
    "parent_id": null,
    "posts_count": 15,
    "color": "#3B82F6"
}
Error Response 404 Not Found
{
  "error": "Resource not found",
  "message": "The requested categorie does not exist"
}
POST /api/blog/categories Auth Required

Create a new categorie

Request Body
POST /api/blog/categories
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json

{
    "name": "Web Development",
    "slug": "web-development",
    "description": "HTML, CSS, JavaScript and modern frameworks",
    "parent_id": null,
    "posts_count": 15,
    "color": "#3B82F6"
}
Response Example 201 Created
{
    "name": "Web Development",
    "slug": "web-development",
    "description": "HTML, CSS, JavaScript and modern frameworks",
    "parent_id": null,
    "posts_count": 15,
    "color": "#3B82F6"
}
PUT/PATCH /api/blog/categories/{id} Auth Required

Update an existing categorie

Request Body
PUT /api/blog/categories/1
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json

{
    "name": "Web Development",
    "slug": "web-development",
    "description": "HTML, CSS, JavaScript and modern frameworks",
    "parent_id": null,
    "posts_count": 15,
    "color": "#3B82F6"
}
Response Example 200 OK
{
    "name": "Web Development",
    "slug": "web-development",
    "description": "HTML, CSS, JavaScript and modern frameworks",
    "parent_id": null,
    "posts_count": 15,
    "color": "#3B82F6"
}
DELETE /api/blog/categories/{id} Auth Required

Delete a categorie by ID

Request Example
DELETE /api/blog/categories/1
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
Response Example 200 OK
{
  "message": "Categorie deleted successfully"
}
Error Response 500 Error
{
  "error": "Deletion failed",
  "message": "Unable to delete the resource"
}

Comments

Post comments and replies

GET /api/blog/comments Public

Retrieve a paginated list of all comments

Request Example
GET /api/blog/comments
Accept: application/json
Response Example 200 OK
{
  "data": [
    {
        "post_id": 1,
        "post_title": "Getting Started with React Hooks",
        "user_id": 4,
        "user_name": "Sophie Martin",
        "user_avatar": "https://i.pravatar.cc/50?img=28",
        "parent_id": null,
        "content": "Great tutorial! This really helped me understand hooks better.",
        "likes": 12,
        "created_at": "2024-01-15T12:30:00Z"
    },
    ...
  ],
  "meta": {
    "current_page": 1,
    "total": 50,
    "per_page": 15
  }
}
GET /api/blog/comments/{id} Public

Retrieve a single comment by ID

Request Example
GET /api/blog/comments/1
Accept: application/json
Response Example 200 OK
{
    "post_id": 1,
    "post_title": "Getting Started with React Hooks",
    "user_id": 4,
    "user_name": "Sophie Martin",
    "user_avatar": "https://i.pravatar.cc/50?img=28",
    "parent_id": null,
    "content": "Great tutorial! This really helped me understand hooks better.",
    "likes": 12,
    "created_at": "2024-01-15T12:30:00Z"
}
Error Response 404 Not Found
{
  "error": "Resource not found",
  "message": "The requested comment does not exist"
}
POST /api/blog/comments Auth Required Auto User ID

Create a new comment

Request Body
POST /api/blog/comments
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json

{
    "post_id": 1,
    "post_title": "Getting Started with React Hooks",
    "user_id": 4,
    "user_name": "Sophie Martin",
    "user_avatar": "https://i.pravatar.cc/50?img=28",
    "parent_id": null,
    "content": "Great tutorial! This really helped me understand hooks better.",
    "likes": 12
}
Response Example 201 Created
{
    "post_id": 1,
    "post_title": "Getting Started with React Hooks",
    "user_id": 4,
    "user_name": "Sophie Martin",
    "user_avatar": "https://i.pravatar.cc/50?img=28",
    "parent_id": null,
    "content": "Great tutorial! This really helped me understand hooks better.",
    "likes": 12,
    "created_at": "2024-01-15T12:30:00Z"
}
PUT/PATCH /api/blog/comments/{id} Auth Required Ownership Check

Update an existing comment

Only the owner can update this resource
Request Body
PUT /api/blog/comments/1
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json

{
    "post_id": 1,
    "post_title": "Getting Started with React Hooks",
    "user_id": 4,
    "user_name": "Sophie Martin",
    "user_avatar": "https://i.pravatar.cc/50?img=28",
    "parent_id": null,
    "content": "Great tutorial! This really helped me understand hooks better.",
    "likes": 12
}
Response Example 200 OK
{
    "post_id": 1,
    "post_title": "Getting Started with React Hooks",
    "user_id": 4,
    "user_name": "Sophie Martin",
    "user_avatar": "https://i.pravatar.cc/50?img=28",
    "parent_id": null,
    "content": "Great tutorial! This really helped me understand hooks better.",
    "likes": 12,
    "created_at": "2024-01-15T12:30:00Z"
}
DELETE /api/blog/comments/{id} Auth Required Ownership Check

Delete a comment by ID

Only the owner can delete this resource
Request Example
DELETE /api/blog/comments/1
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
Response Example 200 OK
{
  "message": "Comment deleted successfully"
}
Error Response 500 Error
{
  "error": "Deletion failed",
  "message": "Unable to delete the resource"
}

Media

Images and files attached to posts

GET /api/blog/media Public

Retrieve a paginated list of all media

Request Example
GET /api/blog/media
Accept: application/json
Response Example 200 OK
{
  "data": [
    {
        "post_id": 1,
        "filename": "react-hooks-diagram.png",
        "url": "https://picsum.photos/1200/600?random=media1",
        "type": "image/png",
        "size": 245678,
        "uploaded_by": 1,
        "uploaded_at": "2024-01-14T16:30:00Z"
    },
    ...
  ],
  "meta": {
    "current_page": 1,
    "total": 50,
    "per_page": 15
  }
}
GET /api/blog/media/{id} Public

Retrieve a single media by ID

Request Example
GET /api/blog/media/1
Accept: application/json
Response Example 200 OK
{
    "post_id": 1,
    "filename": "react-hooks-diagram.png",
    "url": "https://picsum.photos/1200/600?random=media1",
    "type": "image/png",
    "size": 245678,
    "uploaded_by": 1,
    "uploaded_at": "2024-01-14T16:30:00Z"
}
Error Response 404 Not Found
{
  "error": "Resource not found",
  "message": "The requested media does not exist"
}
POST /api/blog/media Auth Required

Create a new media

Request Body
POST /api/blog/media
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json

{
    "post_id": 1,
    "filename": "react-hooks-diagram.png",
    "url": "https://picsum.photos/1200/600?random=media1",
    "type": "image/png",
    "size": 245678,
    "uploaded_by": 1,
    "uploaded_at": "2024-01-14T16:30:00Z"
}
Response Example 201 Created
{
    "post_id": 1,
    "filename": "react-hooks-diagram.png",
    "url": "https://picsum.photos/1200/600?random=media1",
    "type": "image/png",
    "size": 245678,
    "uploaded_by": 1,
    "uploaded_at": "2024-01-14T16:30:00Z"
}
PUT/PATCH /api/blog/media/{id} Public

Update an existing media

Request Body
PUT /api/blog/media/1
Content-Type: application/json

{
    "post_id": 1,
    "filename": "react-hooks-diagram.png",
    "url": "https://picsum.photos/1200/600?random=media1",
    "type": "image/png",
    "size": 245678,
    "uploaded_by": 1,
    "uploaded_at": "2024-01-14T16:30:00Z"
}
Response Example 200 OK
{
    "post_id": 1,
    "filename": "react-hooks-diagram.png",
    "url": "https://picsum.photos/1200/600?random=media1",
    "type": "image/png",
    "size": 245678,
    "uploaded_by": 1,
    "uploaded_at": "2024-01-14T16:30:00Z"
}
DELETE /api/blog/media/{id} Auth Required

Delete a media by ID

Request Example
DELETE /api/blog/media/1
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
Response Example 200 OK
{
  "message": "Media deleted successfully"
}
Error Response 500 Error
{
  "error": "Deletion failed",
  "message": "Unable to delete the resource"
}

Pages

Static pages (About, Contact, etc.)

GET /api/blog/pages Public

Retrieve a paginated list of all pages

Request Example
GET /api/blog/pages
Accept: application/json
Response Example 200 OK
{
  "data": [
    {
        "title": "About Us",
        "slug": "about",
        "content": "We are a team of passionate developers and designers...",
        "template": "default",
        "is_published": true
    },
    ...
  ],
  "meta": {
    "current_page": 1,
    "total": 50,
    "per_page": 15
  }
}
GET /api/blog/pages/{id} Public

Retrieve a single page by ID

Request Example
GET /api/blog/pages/1
Accept: application/json
Response Example 200 OK
{
    "title": "About Us",
    "slug": "about",
    "content": "We are a team of passionate developers and designers...",
    "template": "default",
    "is_published": true
}
Error Response 404 Not Found
{
  "error": "Resource not found",
  "message": "The requested page does not exist"
}
POST /api/blog/pages Auth Required

Create a new page

Request Body
POST /api/blog/pages
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json

{
    "title": "About Us",
    "slug": "about",
    "content": "We are a team of passionate developers and designers...",
    "template": "default",
    "is_published": true
}
Response Example 201 Created
{
    "title": "About Us",
    "slug": "about",
    "content": "We are a team of passionate developers and designers...",
    "template": "default",
    "is_published": true
}
PUT/PATCH /api/blog/pages/{id} Auth Required

Update an existing page

Request Body
PUT /api/blog/pages/1
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json

{
    "title": "About Us",
    "slug": "about",
    "content": "We are a team of passionate developers and designers...",
    "template": "default",
    "is_published": true
}
Response Example 200 OK
{
    "title": "About Us",
    "slug": "about",
    "content": "We are a team of passionate developers and designers...",
    "template": "default",
    "is_published": true
}
DELETE /api/blog/pages/{id} Auth Required

Delete a page by ID

Request Example
DELETE /api/blog/pages/1
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
Response Example 200 OK
{
  "message": "Page deleted successfully"
}
Error Response 500 Error
{
  "error": "Deletion failed",
  "message": "Unable to delete the resource"
}

Posts

Blog articles and posts

GET /api/blog/posts Public

Retrieve a paginated list of all posts

Request Example
GET /api/blog/posts
Accept: application/json
Response Example 200 OK
{
  "data": [
    {
        "title": "Getting Started with React Hooks",
        "slug": "getting-started-react-hooks",
        "excerpt": "Learn the fundamentals of React Hooks and how they can simplify your components.",
        "content": "React Hooks revolutionized the way we write React components...",
        "featured_image": "https://picsum.photos/800/450?random=blog1",
        "author_id": 1,
        "author_name": "Alex Thompson",
        "author_avatar": "https://i.pravatar.cc/50?img=15",
        "category_id": 2,
        "category_name": "Frontend",
        "tags": [
            "JavaScript",
            "React",
            "Tutorial"
        ],
        "status": "published",
        "views": 1245,
        "likes": 89,
        "comments_count": 12,
        "reading_time": "8 min read",
        "published_at": "2024-01-15T09:00:00Z"
    },
    ...
  ],
  "meta": {
    "current_page": 1,
    "total": 50,
    "per_page": 15
  }
}
GET /api/blog/posts/{id} Public

Retrieve a single post by ID

Request Example
GET /api/blog/posts/1
Accept: application/json
Response Example 200 OK
{
    "title": "Getting Started with React Hooks",
    "slug": "getting-started-react-hooks",
    "excerpt": "Learn the fundamentals of React Hooks and how they can simplify your components.",
    "content": "React Hooks revolutionized the way we write React components...",
    "featured_image": "https://picsum.photos/800/450?random=blog1",
    "author_id": 1,
    "author_name": "Alex Thompson",
    "author_avatar": "https://i.pravatar.cc/50?img=15",
    "category_id": 2,
    "category_name": "Frontend",
    "tags": [
        "JavaScript",
        "React",
        "Tutorial"
    ],
    "status": "published",
    "views": 1245,
    "likes": 89,
    "comments_count": 12,
    "reading_time": "8 min read",
    "published_at": "2024-01-15T09:00:00Z"
}
Error Response 404 Not Found
{
  "error": "Resource not found",
  "message": "The requested post does not exist"
}
POST /api/blog/posts Auth Required Auto User ID

Create a new post

Request Body
POST /api/blog/posts
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json

{
    "title": "Getting Started with React Hooks",
    "slug": "getting-started-react-hooks",
    "excerpt": "Learn the fundamentals of React Hooks and how they can simplify your components.",
    "content": "React Hooks revolutionized the way we write React components...",
    "featured_image": "https://picsum.photos/800/450?random=blog1",
    "author_id": 1,
    "author_name": "Alex Thompson",
    "author_avatar": "https://i.pravatar.cc/50?img=15",
    "category_id": 2,
    "category_name": "Frontend",
    "tags": [
        "JavaScript",
        "React",
        "Tutorial"
    ],
    "status": "published",
    "views": 1245,
    "likes": 89,
    "comments_count": 12,
    "reading_time": "8 min read",
    "published_at": "2024-01-15T09:00:00Z"
}
Response Example 201 Created
{
    "title": "Getting Started with React Hooks",
    "slug": "getting-started-react-hooks",
    "excerpt": "Learn the fundamentals of React Hooks and how they can simplify your components.",
    "content": "React Hooks revolutionized the way we write React components...",
    "featured_image": "https://picsum.photos/800/450?random=blog1",
    "author_id": 1,
    "author_name": "Alex Thompson",
    "author_avatar": "https://i.pravatar.cc/50?img=15",
    "category_id": 2,
    "category_name": "Frontend",
    "tags": [
        "JavaScript",
        "React",
        "Tutorial"
    ],
    "status": "published",
    "views": 1245,
    "likes": 89,
    "comments_count": 12,
    "reading_time": "8 min read",
    "published_at": "2024-01-15T09:00:00Z"
}
PUT/PATCH /api/blog/posts/{id} Auth Required Ownership Check

Update an existing post

Only the owner can update this resource
Request Body
PUT /api/blog/posts/1
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json

{
    "title": "Getting Started with React Hooks",
    "slug": "getting-started-react-hooks",
    "excerpt": "Learn the fundamentals of React Hooks and how they can simplify your components.",
    "content": "React Hooks revolutionized the way we write React components...",
    "featured_image": "https://picsum.photos/800/450?random=blog1",
    "author_id": 1,
    "author_name": "Alex Thompson",
    "author_avatar": "https://i.pravatar.cc/50?img=15",
    "category_id": 2,
    "category_name": "Frontend",
    "tags": [
        "JavaScript",
        "React",
        "Tutorial"
    ],
    "status": "published",
    "views": 1245,
    "likes": 89,
    "comments_count": 12,
    "reading_time": "8 min read",
    "published_at": "2024-01-15T09:00:00Z"
}
Response Example 200 OK
{
    "title": "Getting Started with React Hooks",
    "slug": "getting-started-react-hooks",
    "excerpt": "Learn the fundamentals of React Hooks and how they can simplify your components.",
    "content": "React Hooks revolutionized the way we write React components...",
    "featured_image": "https://picsum.photos/800/450?random=blog1",
    "author_id": 1,
    "author_name": "Alex Thompson",
    "author_avatar": "https://i.pravatar.cc/50?img=15",
    "category_id": 2,
    "category_name": "Frontend",
    "tags": [
        "JavaScript",
        "React",
        "Tutorial"
    ],
    "status": "published",
    "views": 1245,
    "likes": 89,
    "comments_count": 12,
    "reading_time": "8 min read",
    "published_at": "2024-01-15T09:00:00Z"
}
DELETE /api/blog/posts/{id} Auth Required Ownership Check

Delete a post by ID

Only the owner can delete this resource
Request Example
DELETE /api/blog/posts/1
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
Response Example 200 OK
{
  "message": "Post deleted successfully"
}
Error Response 500 Error
{
  "error": "Deletion failed",
  "message": "Unable to delete the resource"
}

Settings

Blog configuration and metadata

GET /api/blog/settings Public

Retrieve a paginated list of all settings

Request Example
GET /api/blog/settings
Accept: application/json
Response Example 200 OK
{
  "data": [
    {
        "key": "site_name",
        "value": "Tech Blog Hub",
        "description": "The name of the blog"
    },
    ...
  ],
  "meta": {
    "current_page": 1,
    "total": 50,
    "per_page": 15
  }
}
GET /api/blog/settings/{id} Public

Retrieve a single setting by ID

Request Example
GET /api/blog/settings/1
Accept: application/json
Response Example 200 OK
{
    "key": "site_name",
    "value": "Tech Blog Hub",
    "description": "The name of the blog"
}
Error Response 404 Not Found
{
  "error": "Resource not found",
  "message": "The requested setting does not exist"
}
POST /api/blog/settings Public

Create a new setting

Request Body
POST /api/blog/settings
Content-Type: application/json

{
    "key": "site_name",
    "value": "Tech Blog Hub",
    "description": "The name of the blog"
}
Response Example 201 Created
{
    "key": "site_name",
    "value": "Tech Blog Hub",
    "description": "The name of the blog"
}
PUT/PATCH /api/blog/settings/{id} Auth Required

Update an existing setting

Request Body
PUT /api/blog/settings/1
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json

{
    "key": "site_name",
    "value": "Tech Blog Hub",
    "description": "The name of the blog"
}
Response Example 200 OK
{
    "key": "site_name",
    "value": "Tech Blog Hub",
    "description": "The name of the blog"
}
DELETE /api/blog/settings/{id} Public

Delete a setting by ID

Request Example
DELETE /api/blog/settings/1
Accept: application/json
Response Example 200 OK
{
  "message": "Setting deleted successfully"
}
Error Response 500 Error
{
  "error": "Deletion failed",
  "message": "Unable to delete the resource"
}

Subscribers

Newsletter subscribers

GET /api/blog/subscribers Auth Required

Retrieve a paginated list of all subscribers

Request Example
GET /api/blog/subscribers
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
Response Example 200 OK
{
  "data": [
    {
        "email": "subscriber1@example.com",
        "name": "Michael Brown",
        "subscribed_at": "2024-01-10T10:00:00Z",
        "is_active": true
    },
    ...
  ],
  "meta": {
    "current_page": 1,
    "total": 50,
    "per_page": 15
  }
}
GET /api/blog/subscribers/{id} Auth Required

Retrieve a single subscriber by ID

Request Example
GET /api/blog/subscribers/1
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
Response Example 200 OK
{
    "email": "subscriber1@example.com",
    "name": "Michael Brown",
    "subscribed_at": "2024-01-10T10:00:00Z",
    "is_active": true
}
Error Response 404 Not Found
{
  "error": "Resource not found",
  "message": "The requested subscriber does not exist"
}
POST /api/blog/subscribers Public

Create a new subscriber

Request Body
POST /api/blog/subscribers
Content-Type: application/json

{
    "email": "subscriber1@example.com",
    "name": "Michael Brown",
    "subscribed_at": "2024-01-10T10:00:00Z",
    "is_active": true
}
Response Example 201 Created
{
    "email": "subscriber1@example.com",
    "name": "Michael Brown",
    "subscribed_at": "2024-01-10T10:00:00Z",
    "is_active": true
}
PUT/PATCH /api/blog/subscribers/{id} Public

Update an existing subscriber

Request Body
PUT /api/blog/subscribers/1
Content-Type: application/json

{
    "email": "subscriber1@example.com",
    "name": "Michael Brown",
    "subscribed_at": "2024-01-10T10:00:00Z",
    "is_active": true
}
Response Example 200 OK
{
    "email": "subscriber1@example.com",
    "name": "Michael Brown",
    "subscribed_at": "2024-01-10T10:00:00Z",
    "is_active": true
}
DELETE /api/blog/subscribers/{id} Auth Required

Delete a subscriber by ID

Request Example
DELETE /api/blog/subscribers/1
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
Response Example 200 OK
{
  "message": "Subscriber deleted successfully"
}
Error Response 500 Error
{
  "error": "Deletion failed",
  "message": "Unable to delete the resource"
}

Tags

Post tags for classification

GET /api/blog/tags Public

Retrieve a paginated list of all tags

Request Example
GET /api/blog/tags
Accept: application/json
Response Example 200 OK
{
  "data": [
    {
        "name": "JavaScript",
        "slug": "javascript",
        "posts_count": 25
    },
    ...
  ],
  "meta": {
    "current_page": 1,
    "total": 50,
    "per_page": 15
  }
}
GET /api/blog/tags/{id} Public

Retrieve a single tag by ID

Request Example
GET /api/blog/tags/1
Accept: application/json
Response Example 200 OK
{
    "name": "JavaScript",
    "slug": "javascript",
    "posts_count": 25
}
Error Response 404 Not Found
{
  "error": "Resource not found",
  "message": "The requested tag does not exist"
}
POST /api/blog/tags Auth Required

Create a new tag

Request Body
POST /api/blog/tags
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json

{
    "name": "JavaScript",
    "slug": "javascript",
    "posts_count": 25
}
Response Example 201 Created
{
    "name": "JavaScript",
    "slug": "javascript",
    "posts_count": 25
}
PUT/PATCH /api/blog/tags/{id} Public

Update an existing tag

Request Body
PUT /api/blog/tags/1
Content-Type: application/json

{
    "name": "JavaScript",
    "slug": "javascript",
    "posts_count": 25
}
Response Example 200 OK
{
    "name": "JavaScript",
    "slug": "javascript",
    "posts_count": 25
}
DELETE /api/blog/tags/{id} Auth Required

Delete a tag by ID

Request Example
DELETE /api/blog/tags/1
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
Response Example 200 OK
{
  "message": "Tag deleted successfully"
}
Error Response 500 Error
{
  "error": "Deletion failed",
  "message": "Unable to delete the resource"
}

Users

Blog authors and registered readers

GET /api/blog/users Public

Retrieve a paginated list of all users

Request Example
GET /api/blog/users
Accept: application/json
Response Example 200 OK
{
  "data": [
    {
        "name": "Alex Thompson",
        "username": "alexthompson",
        "email": "alex@techblog.com",
        "password": "$2y$12$dfZSbIdUQR02rz5b22XzB.eV/PrxZ7XEA1sNmRt01/CYImOD3aud2",
        "api_token": "476d8ebd8fc1a73c18b01c2c4ad5914a9b9f6bebb474e44beb88d4f26f22e61b",
        "avatar": "https://i.pravatar.cc/150?img=15",
        "bio": "Tech enthusiast and software developer. Writing about web development and AI.",
        "role": "author",
        "posts_count": 12,
        "joined_at": "2023-01-15",
        "social_links": {
            "twitter": "@alexthompson",
            "github": "alexthompson"
        }
    },
    ...
  ],
  "meta": {
    "current_page": 1,
    "total": 50,
    "per_page": 15
  }
}
GET /api/blog/users/{id} Public

Retrieve a single user by ID

Request Example
GET /api/blog/users/1
Accept: application/json
Response Example 200 OK
{
    "name": "Alex Thompson",
    "username": "alexthompson",
    "email": "alex@techblog.com",
    "password": "$2y$12$dfZSbIdUQR02rz5b22XzB.eV/PrxZ7XEA1sNmRt01/CYImOD3aud2",
    "api_token": "476d8ebd8fc1a73c18b01c2c4ad5914a9b9f6bebb474e44beb88d4f26f22e61b",
    "avatar": "https://i.pravatar.cc/150?img=15",
    "bio": "Tech enthusiast and software developer. Writing about web development and AI.",
    "role": "author",
    "posts_count": 12,
    "joined_at": "2023-01-15",
    "social_links": {
        "twitter": "@alexthompson",
        "github": "alexthompson"
    }
}
Error Response 404 Not Found
{
  "error": "Resource not found",
  "message": "The requested user does not exist"
}
POST /api/blog/users Public

Create a new user

Request Body
POST /api/blog/users
Content-Type: application/json

{
    "name": "Alex Thompson",
    "username": "alexthompson",
    "email": "alex@techblog.com",
    "password": "$2y$12$dfZSbIdUQR02rz5b22XzB.eV/PrxZ7XEA1sNmRt01/CYImOD3aud2",
    "api_token": "476d8ebd8fc1a73c18b01c2c4ad5914a9b9f6bebb474e44beb88d4f26f22e61b",
    "avatar": "https://i.pravatar.cc/150?img=15",
    "bio": "Tech enthusiast and software developer. Writing about web development and AI.",
    "role": "author",
    "posts_count": 12,
    "joined_at": "2023-01-15",
    "social_links": {
        "twitter": "@alexthompson",
        "github": "alexthompson"
    }
}
Response Example 201 Created
{
    "name": "Alex Thompson",
    "username": "alexthompson",
    "email": "alex@techblog.com",
    "password": "$2y$12$dfZSbIdUQR02rz5b22XzB.eV/PrxZ7XEA1sNmRt01/CYImOD3aud2",
    "api_token": "476d8ebd8fc1a73c18b01c2c4ad5914a9b9f6bebb474e44beb88d4f26f22e61b",
    "avatar": "https://i.pravatar.cc/150?img=15",
    "bio": "Tech enthusiast and software developer. Writing about web development and AI.",
    "role": "author",
    "posts_count": 12,
    "joined_at": "2023-01-15",
    "social_links": {
        "twitter": "@alexthompson",
        "github": "alexthompson"
    }
}
PUT/PATCH /api/blog/users/{id} Auth Required Ownership Check

Update an existing user

Only the owner can update this resource
Request Body
PUT /api/blog/users/1
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json

{
    "name": "Alex Thompson",
    "username": "alexthompson",
    "email": "alex@techblog.com",
    "password": "$2y$12$dfZSbIdUQR02rz5b22XzB.eV/PrxZ7XEA1sNmRt01/CYImOD3aud2",
    "api_token": "476d8ebd8fc1a73c18b01c2c4ad5914a9b9f6bebb474e44beb88d4f26f22e61b",
    "avatar": "https://i.pravatar.cc/150?img=15",
    "bio": "Tech enthusiast and software developer. Writing about web development and AI.",
    "role": "author",
    "posts_count": 12,
    "joined_at": "2023-01-15",
    "social_links": {
        "twitter": "@alexthompson",
        "github": "alexthompson"
    }
}
Response Example 200 OK
{
    "name": "Alex Thompson",
    "username": "alexthompson",
    "email": "alex@techblog.com",
    "password": "$2y$12$dfZSbIdUQR02rz5b22XzB.eV/PrxZ7XEA1sNmRt01/CYImOD3aud2",
    "api_token": "476d8ebd8fc1a73c18b01c2c4ad5914a9b9f6bebb474e44beb88d4f26f22e61b",
    "avatar": "https://i.pravatar.cc/150?img=15",
    "bio": "Tech enthusiast and software developer. Writing about web development and AI.",
    "role": "author",
    "posts_count": 12,
    "joined_at": "2023-01-15",
    "social_links": {
        "twitter": "@alexthompson",
        "github": "alexthompson"
    }
}
DELETE /api/blog/users/{id} Auth Required Ownership Check

Delete a user by ID

Only the owner can delete this resource
Request Example
DELETE /api/blog/users/1
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
Response Example 200 OK
{
  "message": "User deleted successfully"
}
Error Response 500 Error
{
  "error": "Deletion failed",
  "message": "Unable to delete the resource"
}