Skip to main content
ADMIN ACCESS REQUIRED - This endpoint requires authentication with an ADMIN role.

Overview

Retrieves a list of all categories in the system, ordered by ID in descending order (newest first).

Authentication

This endpoint requires:
  • Valid JWT token in the Authorization header
  • User must have ADMIN role

Request

No parameters required.

Response

success
boolean
required
Indicates if the request was successful
message
string
required
Success message indicating categories were retrieved
data
object
required
categories
array
required
Array of category objects
id
integer
required
Unique identifier for the category
name
string
required
Category name (max 255 characters)
description
string
Optional category description (max 255 characters)
created_at
string
required
Timestamp when the category was created
updated_at
string
required
Timestamp when the category was last updated
deleted_at
string
Timestamp when the category was soft deleted (null if active)

Code Examples

curl -X GET "https://api.example.com/category" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Accept: application/json" \
  -H "Accept-Language: en"

Response Examples

Success Response (200 OK)

{
  "success": true,
  "message": "All categories retrieved successfully",
  "data": {
    "categories": [
      {
        "id": 2,
        "name": "Hardware",
        "description": "Hardware related issues and repairs",
        "created_at": "2026-03-08T10:30:00.000000Z",
        "updated_at": "2026-03-08T10:30:00.000000Z",
        "deleted_at": null
      },
      {
        "id": 1,
        "name": "Software",
        "description": "Software troubleshooting and support",
        "created_at": "2026-03-08T09:15:00.000000Z",
        "updated_at": "2026-03-08T09:15:00.000000Z",
        "deleted_at": null
      }
    ]
  }
}

Unauthorized Response (401 Unauthorized)

{
  "success": false,
  "message": "Unauthenticated"
}

Forbidden Response (403 Forbidden)

Returned when the authenticated user does not have ADMIN role:
{
  "success": false,
  "message": "Unauthorized. Admin access required."
}

Error Codes

Status CodeDescription
200Success - Categories retrieved
401Unauthorized - Invalid or missing JWT token
403Forbidden - User does not have ADMIN role
500Internal Server Error

Build docs developers (and LLMs) love