---
updatedAt: 2026-02-25T12:57:26.000Z
---

# KustomerCore.getCategories()

Fetches the categories in your Kustomer Knowledge Base

[block:callout]
{
  "type": "success",
  "title": "First, initialize chat",
  "body": "You must initialize with `KustomerCore.init()` before you can execute any additional Core SDK methods"
}
[/block]

## Examples

[block:code]
{
  "codes": [
    {
      "code": "// Gets your categories for a certain knowledge base\nKustomerCore.getCategories({\n  lang: 'en_us',\n  knowledgeBaseId: 'SOME_ID'\n}, function (callbackResponse, error) {\n  console.log('Fetched categories!');\n});",
      "language": "javascript",
      "name": "Code samples: KustomerCore.getCategories()"
    }
  ]
}
[/block]

## Syntax

[block:code]
{
  "codes": [
    {
      "code": "KustomerCore.getCategories(options, function(callbackResponse, error))",
      "language": "javascript",
      "name": "JavaScript syntax: Kustomer.describeConversation()"
    }
  ]
}
[/block]

[block:parameters]
{
  "data": {
    "h-0": "Parameter",
    "h-1": "Type",
    "h-2": "Description",
    "0-1": "Object",
    "0-2": "**Required**\n\nAn object containing details about the categories you want to fetch. A breakdown of the `options` object is listed below.",
    "0-0": "options",
    "1-0": "function(callbackResponse, error)",
    "1-1": "Function",
    "1-2": "**Optional**\n\nA callback that is run after the method completes.\n\n**callbackResponse** is an object returned to the callback function. See the `callbackResponse` section below to see the properties of the object.\n\n**error** is either `undefined` or a native JavaScript Error object."
  },
  "cols": 3,
  "rows": 2
}
[/block]

### `options`

[block:parameters]
{
  "data": {
    "h-0": "Property",
    "h-1": "Type",
    "h-2": "Description",
    "0-0": "knowledgeBaseId",
    "0-2": "**Required**\n\nThe unique ID of the knowledge base.",
    "1-0": "lang",
    "1-2": "**Required**\n\nThe language code of the categories to fetch.",
    "1-1": "String",
    "0-1": "String"
  },
  "cols": 3,
  "rows": 2
}
[/block]

### `callbackResponse`

[block:parameters]
{
  "data": {
    "h-0": "Property",
    "h-1": "Type",
    "h-2": "Description",
    "0-0": "categories",
    "0-1": "Object",
    "0-2": "**Required**\n\nAn object with its keys being category IDs and values being the category object.\n\nThese category objects have the same structure as `rootCategory`.",
    "1-0": "rootCategory",
    "1-1": "Object",
    "1-2": "**Required**\n\nThe root category object. See below for what the `rootCategory` looks like."
  },
  "cols": 3,
  "rows": 2
}
[/block]

### `rootCategory`

[block:parameters]
{
  "data": {
    "h-0": "Property",
    "h-1": "Type",
    "h-2": "Description",
    "0-0": "categoryId",
    "0-1": "String",
    "0-2": "**Required**\n\nThe unique ID of the category",
    "1-0": "title",
    "1-1": "String",
    "1-2": "**Optional**\n\nThe category's title.",
    "2-0": "description",
    "2-1": "String",
    "2-2": "**Optional**\n\nThe category's description.",
    "3-0": "parentCategory",
    "3-1": "String",
    "3-2": "**Optional**\n\nThe parent category's ID.",
    "4-0": "childCategories",
    "4-1": "Array",
    "4-2": "**Required**\n\nAn array of child category IDs."
  },
  "cols": 3,
  "rows": 5
}
[/block]