Skip to content

pos-list-categories ​

Method: GET
Path: /pos/catalog/categories

Tags: Categories

Summary ​

List all categories

Description ​

Returns a list of your product categories. The categories are returned sorted by creation date, with the most recently created categories appearing first.

Pos SDK Usage ​

SDK Method: pos.listCategories()

Example:

typescript
// Basic category listing
const { data, error } = await pos.listCategories();

if (error) {
  console.error("Failed to list categories:", error.message);
} else {
  console.log("Categories found:", data.categories?.length || 0);
  data.categories?.forEach(category => {
    console.log(`Category: ${category.name} - ${category.description}`);
  });
}

// With pagination
const { data: catData, error: catError } = await pos.listCategories({
  page: 1,
  limit: 10
});

TypeScript Definition ​

typescript
"pos-list-categories": {
        parameters: {
            query?: {
                /** @description search keyword */
                search?: components["parameters"]["searchKeyword"];
                active?: boolean;
                /** @description Retrieve this category and its descendants. */
                category_id?: string;
                /** @description Results per page. Values outside 1–100 are clamped to that range. Non-integer input returns 400. */
                limit?: number;
                /** @description Maximum depth of child categories. Omit to retrieve all levels. */
                nested_level?: number;
                /** @description Page number, starting at 1. Non-integer values and values below 1 return 400. */
                page?: number;
                /** @description To return child categories using category id. */
                parent_category_id?: string;
                /** @description To return child categories using category slug */
                parent_category_slug?: string;
                /** @description Sort by `name`, `description`, `created_at` or `modified_at`, using a JSON object of field names and `asc` or `desc` values. */
                sort_by?: string;
            };
            header?: never;
            path?: never;
            cookie?: never;
        };
        requestBody?: never;
        responses: {
            /** @description OK */
            200: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": {
                        /** @example all categories */
                        message: string;
                        success: boolean;
                        content: {
                            categories: components["schemas"]["ProductCategory"][];
                            pagination: components["schemas"]["Pagination"];
                        };
                    };
                };
            };
            400: components["responses"]["BadRequest"];
            401: components["responses"]["Unauthorized"];
            403: components["responses"]["Forbidden"];
            500: components["responses"]["InternalServerError"];
            504: components["responses"]["GatewayTimeout"];
        };
    };

Component References ​

ReferenceResolves To
components["parameters"]["searchKeyword"]searchKeyword
components["schemas"]["ProductCategory"]ProductCategory
components["schemas"]["Pagination"]Pagination
components["responses"]["BadRequest"]BadRequest
components["responses"]["Unauthorized"]Unauthorized
components["responses"]["Forbidden"]Forbidden
components["responses"]["InternalServerError"]InternalServerError
components["responses"]["GatewayTimeout"]GatewayTimeout

Parameters ​

  • search (query): search keyword
  • active (query): No description
  • category_id (query): Retrieve this category and its descendants.
  • limit (query): Results per page. Values outside 1–100 are clamped to that range. Non-integer input returns 400.
  • nested_level (query): Maximum depth of child categories. Omit to retrieve all levels.
  • page (query): Page number, starting at 1. Non-integer values and values below 1 return 400.
  • parent_category_id (query): To return child categories using category id.
  • parent_category_slug (query): To return child categories using category slug
  • sort_by (query): Sort by name, description, created_at or modified_at, using a JSON object of field names and asc or desc values.

Responses ​

200 ​

OK

400 ​

Bad request

401 ​

Authentication failed. Codes include token-required, token-expired and token_not_valid for an invalid or expired token.

403 ​

Access denied. token-required requires an authenticated session; permission-denied means the caller cannot access this resource. On POS, session-expired requires signing in again.

500 ​

The request failed because of an unexpected error.

504 ​

The request timed out.

OpenAPI Definition ​

json
{
  "operationId": "pos-list-categories",
  "summary": "List all categories",
  "description": "Returns a list of your product categories. The categories are returned sorted by creation date, with the most recently created categories appearing first.",
  "parameters": [
    {
      "$ref": "#/components/parameters/searchKeyword"
    },
    {
      "name": "active",
      "in": "query",
      "schema": {
        "type": "boolean",
        "default": true
      }
    },
    {
      "name": "category_id",
      "in": "query",
      "description": "Retrieve this category and its descendants.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "description": "Results per page. Values outside 1–100 are clamped to that range. Non-integer input returns 400.",
      "schema": {
        "type": "integer",
        "default": 100,
        "maximum": 100,
        "minimum": 1
      }
    },
    {
      "name": "nested_level",
      "in": "query",
      "description": "Maximum depth of child categories. Omit to retrieve all levels.",
      "schema": {
        "type": "integer",
        "minimum": 0
      }
    },
    {
      "name": "page",
      "in": "query",
      "description": "Page number, starting at 1. Non-integer values and values below 1 return 400.",
      "schema": {
        "type": "integer",
        "default": 1,
        "minimum": 1
      }
    },
    {
      "name": "parent_category_id",
      "in": "query",
      "description": "To return child categories using category id.",
      "schema": {
        "type": "string",
        "example": "01JWZW41Y3FBKTZSP399SKANY7",
        "examples": [
          "01JWZW41Y3FBKTZSP399SKANY7"
        ]
      }
    },
    {
      "name": "parent_category_slug",
      "in": "query",
      "description": "To return child categories using category slug",
      "schema": {
        "type": "string",
        "example": "vitals"
      }
    },
    {
      "name": "sort_by",
      "in": "query",
      "description": "Sort by `name`, `description`, `created_at` or `modified_at`, using a JSON object of field names and `asc` or `desc` values.",
      "required": false,
      "schema": {
        "type": "string",
        "examples": [
          "{\"name\":\"asc\"}"
        ]
      }
    }
  ],
  "responses": {
    "200": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string",
                "examples": [
                  "all categories"
                ]
              },
              "success": {
                "type": "boolean"
              },
              "content": {
                "properties": {
                  "categories": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/ProductCategory"
                    }
                  },
                  "pagination": {
                    "$ref": "#/components/schemas/Pagination"
                  }
                },
                "required": [
                  "categories",
                  "pagination"
                ],
                "type": "object"
              }
            },
            "required": [
              "message",
              "success",
              "content"
            ]
          }
        }
      },
      "links": {
        "ListProductsByCategory": {
          "operationId": "pos-list-products",
          "description": "List products in a category. Use a category's `id` as the `category_id` query parameter."
        }
      }
    },
    "400": {
      "$ref": "#/components/responses/BadRequest"
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "403": {
      "$ref": "#/components/responses/Forbidden"
    },
    "500": {
      "$ref": "#/components/responses/InternalServerError"
    },
    "504": {
      "$ref": "#/components/responses/GatewayTimeout"
    }
  },
  "externalDocs": {
    "url": "https://llm-docs.commercengine.io/admin-pos/operations/pos-list-categories"
  },
  "security": [
    {
      "Authorization": []
    }
  ],
  "tags": [
    "Categories"
  ],
  "x-speakeasy-group": "pos",
  "x-speakeasy-name-override": "listCategories"
}

Auto-generated from OpenAPI spec and TypeScript definitions

Last updated: