Skip to main content

Get Category

Retrieve detailed information about a specific category using its unique identifier.

Endpoint

GET /api/v1/categories/{id}

Path Parameters

id
integer
required
The unique identifier of the category to retrieve

Response

Returns a single category object.
id
integer
Unique identifier for the category
name
string
The category name
description
string
Detailed description of the category
parentId
integer
ID of the parent category (null for main categories)
isActive
boolean
Whether the category is currently active
product_ids
array
List of product IDs associated with this category
subcategory_ids
array
List of subcategory IDs that belong to this category

Status Codes

  • 200 - Success, returns the category object
  • 404 - Category not found

Example

Request

curl -X GET "https://api.example.com/api/v1/categories/1" \
  -H "Content-Type: application/json"

Response

{
  "id": 1,
  "name": "Living Room",
  "description": "Furniture for living spaces",
  "parentId": null,
  "isActive": true,
  "product_ids": [101, 102, 103],
  "subcategory_ids": [10, 11]
}

Error Response (404)

{
  "error": "Category not found",
  "status": 404
}

Build docs developers (and LLMs) love