# Categories

## Retrieves a filtered list of categories.

`Categories.ListCategories(CategoryListCategoriesParams?parameters, CancellationTokencancellationToken = default)`

**get** `/api/v2/public/categories`

Retrieves a filtered list of categories.

### Parameters

- `CategoryListCategoriesParams parameters`

  - `Long moduleID`

    Optional module identifier to filter categories.

  - `Int pageSize`

    The number of results per page.

  - `Int pageStart`

    The page offset for pagination.

  - `string parentCategoryCode`

    Optional parent category code to filter by hierarchy.

  - `string searchText`

    Optional text to search categories by name.

### Example

```csharp
CategoryListCategoriesParams parameters = new();

await client.Categories.ListCategories(parameters);
```

## Creates or updates categories.

`CategoryCreateCategoriesResponse Categories.CreateCategories(CategoryCreateCategoriesParams?parameters, CancellationTokencancellationToken = default)`

**post** `/api/v2/public/categories`

Creates or updates categories.

### Parameters

- `CategoryCreateCategoriesParams parameters`

  - `Boolean flush`

    Query param: When true, removes existing categories before inserting.

  - `IReadOnlyList<Category>? categories`

    Body param: The list of category entries.

    - `required string CategoryName`

      The category display name.

    - `required Boolean IsAdjustMinMax`

      Whether min/max stock levels should be automatically adjusted for products in this category.

    - `required Boolean IsMarkdown`

      Whether markdown pricing is enabled for this category.

    - `string? CategoryCode`

      Unique category code identifier.

    - `Int? ExpirationOffset`

      Number of days offset for product expiration within this category.

    - `string? FriendlyCategoryName`

      A user-friendly alternative name for the category.

    - `string? MarkdownPercentages`

      Comma-separated markdown percentage values.

    - `string? ParentCategoryCode`

      The parent category code for hierarchy. Defaults to "0" (root) when not provided.

    - `Int? ReceiptOffset`

      Number of days offset for receipt processing within this category.

### Returns

- `class CategoryCreateCategoriesResponse:`

  Standard success response returned by mutation endpoints.

  - `required Boolean Success`

    Indicates whether the operation completed successfully.

  - `string? Data`

    Optional data payload returned by the operation.

  - `string? Message`

    Human-readable message describing the result.

### Example

```csharp
CategoryCreateCategoriesParams parameters = new();

var response = await client.Categories.CreateCategories(parameters);

Console.WriteLine(response);
```

#### Response

```json
{
  "success": true,
  "data": "data",
  "message": "message"
}
```
