## Creates a new product list for a store, optionally including initial line items.

`ProductListCreateProductListResponse ProductLists.CreateProductList(ProductListCreateProductListParamsparameters, CancellationTokencancellationToken = default)`

**post** `/api/v2/public/stores/{store_number}/productlists`

Creates a new product list for a store, optionally including initial line items.

### Parameters

- `ProductListCreateProductListParams parameters`

  - `required string storeNumber`

    Path param: The store number to create the product list under.

  - `required string productListName`

    Body param: Name of the product list. Must contain only letters, numbers, spaces, dots, hyphens, or underscores.

  - `required Int productListType`

    Body param: Numeric product list type identifier. Ignored when `module_id` is supplied; the type is then resolved from the module.

  - `string appUsername`

    Query param: Name of the app user creating the product list. Defaults to "unknown" when omitted.

  - `IReadOnlyList<FreeField>? freeFields`

    Body param: Custom free-field key/value pairs to attach to the product list.

    - `string? Key`

      Free-field key.

    - `string? Value`

      Free-field value.

  - `Boolean? isAllowDuplicateProducts`

    Body param: When true (default), duplicate products may appear on multiple lines. When false, lines for the same product are merged and quantities are summed.

  - `IReadOnlyList<Line>? lines`

    Body param: Initial line items to add to the product list. May be empty; lines may be added later via the line-update endpoint.

    - `required string ProductNumber`

      Product number identifying which product the line refers to. Unknown product numbers are silently skipped.

    - `required Double Quantity`

      Quantity for the line. A value of 0 is treated as 1.

    - `string? Barcode`

      Ignored on input. The barcode stored on the line is sourced from the product master via `product_number`. Field retained for backwards compatibility.

  - `Int? moduleID`

    Body param: Optional module identifier. When set, the product list type is resolved from the module's configured type and `product_list_type` is ignored.

### Returns

- `class ProductListCreateProductListResponse:`

  Response returned after a product list is created. Contains the identifier of the new list.

  - `required Long ProductListID`

    Identifier of the newly created product list.

### Example

```csharp
ProductListCreateProductListParams parameters = new()
{
    StoreNumber = "store_number",
    ProductListName = "Produce",
    ProductListType = 1,
};

var response = await client.ProductLists.CreateProductList(parameters);

Console.WriteLine(response);
```

#### Response

```json
{
  "product_list_id": 0
}
```
