Categories

Product Categories API

Categories provide a hierarchical structure for organizing products in your store. The Categories API allows you to manage the category structure, add or remove products from categories, and customize category-specific settings.

Base URL: https://your-store.venddor.com/api/categories

Understanding Categories

Categories in Venddor can be organized in a multi-level hierarchy, allowing for a flexible and intuitive navigation structure for your customers. Each category can have any number of subcategories, and products can belong to multiple categories simultaneously.

Tip: A well-organized category structure improves product discoverability and enhances the overall shopping experience for your customers.

Category Properties

The following table describes the key properties of a category object:

Property Type Description
category_id integer A unique identifier for the category
category string The name of the category as displayed to customers
parent_id integer The ID of the parent category (0 for top-level categories)
status string The status of the category: "A" (active), "H" (hidden), "D" (disabled)
product_count integer The number of products directly assigned to this category
position integer The display order of the category relative to its siblings
description string HTML description of the category displayed on the category page
meta_keywords string Meta keywords for SEO optimization
meta_description string Meta description for SEO optimization
page_title string Custom page title for the category page
image_pair object Information about the category image

API Endpoints

GET /categories

Retrieves a list of all categories with optional filtering parameters.

Query Parameters

Parameter Type Required Description
parent_id integer No Filter categories by parent ID
status string No Filter by status: "A", "H", "D"
include_disabled boolean No Include disabled categories. Default: false
page integer No Page number for pagination. Default: 1
items_per_page integer No Number of items per page. Default: 20, Maximum: 100
{
  "categories": [
    {
      "category_id": "1",
      "category": "Electronics",
      "parent_id": "0",
      "status": "A",
      "product_count": 125,
      "position": 10,
      "description": "<p>Shop our wide selection of electronics</p>",
      "meta_keywords": "electronics, gadgets, tech",
      "meta_description": "Browse our selection of electronics and tech gadgets.",
      "page_title": "Electronics and Tech Gadgets"
    },
    {
      "category_id": "2",
      "category": "Smartphones",
      "parent_id": "1",
      "status": "A",
      "product_count": 42,
      "position": 20,
      "description": "<p>Latest smartphones and accessories</p>",
      "meta_keywords": "smartphones, phones, mobile",
      "meta_description": "Shop the latest smartphones and mobile accessories.",
      "page_title": "Smartphones & Mobile Devices"
    }
  ],
  "pagination": {
    "total": 42,
    "current_page": 1,
    "items_per_page": 20,
    "total_pages": 3
  }
}
GET /categories/{category_id}

Retrieves details of a specific category.

Path Parameters

Parameter Type Description
category_id* integer The unique identifier of the category
POST /categories

Creates a new category.

Request Parameters

Parameter Type Required Description
category* string Yes The name of the category
parent_id integer No The ID of the parent category. Default: 0 (top-level)
status string No Category status: "A", "H", "D". Default: "A"
description string No HTML description for the category page
position integer No Display order position. Default: 0
{
  "category": "Smart Home Devices",
  "parent_id": "1",
  "status": "A",
  "description": "<p>Discover the latest smart home technology</p>",
  "position": 30,
  "meta_keywords": "smart home, automation, IoT",
  "meta_description": "Shop smart home devices and automation products.",
  "page_title": "Smart Home & Automation"
}

Response

{
  "success": true,
  "category_id": "3"
}
Important: When deleting a category, all its products will remain in the database but will need to be reassigned to other categories to appear in your store.