Skip to main content
GET
/
api
/
categories
/
:slug
Get Category
curl --request GET \
  --url https://api.example.com/api/categories/:slug
{
  "category": {
    "_id": "507f1f77bcf86cd799439011",
    "name": "Technology",
    "slug": "technology",
    "description": "Articles about technology and innovation",
    "createdAt": "2024-01-15T10:30:00.000Z"
  }
}
Retrieves a single category identified by its URL-friendly slug. This endpoint is publicly accessible and does not require authentication.

Request

Path Parameters

slug
string
required
The URL-friendly identifier of the category (e.g., “technology”, “travel”)

Headers

No authentication required.

Response

category
object
The requested category object
{
  "category": {
    "_id": "507f1f77bcf86cd799439011",
    "name": "Technology",
    "slug": "technology",
    "description": "Articles about technology and innovation",
    "createdAt": "2024-01-15T10:30:00.000Z"
  }
}

Error Responses

error
string
Error message describing what went wrong

404 - Category Not Found

Returned when no category exists with the specified slug.
{
  "error": "Category not found"
}

500 - Internal Server Error

{
  "error": "Database connection failed"
}

Example Request

curl https://api.vaniyk-empire.com/api/categories/technology

Build docs developers (and LLMs) love