Skip to content

Fetch Product Categories

Description

This endpoint retrieves a list of categories available in the system.

Endpoint

GET /v1/categories

Query Parameters

ParameterTypeDescription
namestringFilter categories by name

Required Headers

json
{
  "Authorization": "Bearer JWT_TOKEN",
  "X-MerchantApiKey": "MERCHANT_API_KEY",
  "Content-Type": "application/json"
}

Example API Call (Fetch or Axios)

js
fetch('{{url}}/v1/categories', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer JWT_TOKEN',
    'X-MerchantApiKey': 'MERCHANT_API_KEY',
    'Content-Type': 'application/json',
  }
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));

Sample 200 Response (Success)

json
{
    "status": true,
    "message": "success",
    "data": [
        {
            "id": "679e8cab72d06732223ab6b0",
            "name": "Clothing",
            "slug": "clothing"
        },
        {
            "id": "679e8cab72d06732223ab6b1",
            "name": "Book",
            "slug": "book"
        },
        {
            "id": "679e8d2e84c29f6d3c80eff2",
            "name": "Phone Cases",
            "slug": "phone_cases"
        }
    ]
}

Next Steps

Build with joy