Skip to main content

Purpose

Returns a single category, regardless of whether it is a root or subcategory, and optionally its child nodes.

HTTP Request

GET https://integrations.clopos.com/open-api/v2/categories/{id}

Authorization

The following headers are required:
  • x-token

Request Example

curl -X GET "https://integrations.clopos.com/open-api/v2/categories/1?include_children=true" \
  -H "x-token: oauth_example_token" \

Response

200 OK — Category found

{
  "success": true,
  "data": {
    "id": 1,
    "parent_id": null,
    "name": "Beverages",
    "slug": "beverages",
    "type": "PRODUCT",
    "color": "#3498db",
    "status": 1,
    "depth": 0,
    "_lft": 1,
    "_rgt": 8,
    "properties": {
      "visible": true,
      "sortable": true,
      "description": "All beverages and drinks"
    },
    "children": [
      {
        "id": 2,
        "parent_id": 1,
        "name": "Coffee",
        "slug": "coffee",
        "type": "PRODUCT",
        "status": 1,
        "depth": 1,
        "children": []
      }
    ],
    "created_at": "2024-01-20T16:00:00Z",
    "updated_at": "2024-01-20T16:00:00Z"
  },
  "time": 12,
  "timestamp": "2024-01-20T16:05:00Z",
  "unix": 1705763100
}

404 Not Found — Category does not exist

{
  "success": false,
  "error": "resource_not_found",
  "message": "Category not found"
}

Field Reference

Top-Level Fields

FieldTypeDescription
successbooleanIndicates the success status of the request.
dataobjectCategory details.
timenumberResponse time.
timestampstringISO 8601 formatted time.
unixnumberUnix timestamp.

Category Object

FieldTypeDescription
idintegerCategory ID.
parent_idintegerParent category ID, null for root.
namestringCategory name.
slugstringURL-friendly identifier.
typestringPRODUCT, INGREDIENT, ACCOUNTING.
statusinteger1 = active, 0 = inactive.
depthintegerHierarchy level.
_lft, _rgtintegerNested set boundaries.
colorstringHEX color.
propertiesobjectAdditional visibility/setting info.
childrenarrayList of subcategories.
created_atstringCreation time.
updated_atstringLast update time.

Notes

  • The include_children=false parameter returns only a single category record; recommended for performance in large trees.
  • The returned children array recursively uses the same schema; be careful when processing the tree structure repeatedly on the client side.
  • Based on the type field in the response, you can read menu, content, or accounting categories from the same endpoint.
  • If the category is not found, it returns 404; add fallback or remapping logic on the client side.