# Product Lists

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

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

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

### Path Parameters

- `store_number: string`

### Query Parameters

- `app_username: optional string`

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

### Body Parameters

- `product_list_name: string`

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

- `product_list_type: number`

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

- `free_fields: optional array of object { key, value }`

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

  - `key: optional string`

    Free-field key.

  - `value: optional string`

    Free-field value.

- `is_allow_duplicate_products: optional boolean`

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

- `lines: optional array of object { product_number, quantity, barcode }`

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

  - `product_number: string`

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

  - `quantity: number`

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

  - `barcode: optional string`

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

- `module_id: optional number`

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

### Returns

- `product_list_id: number`

  Identifier of the newly created product list.

### Example

```http
curl https://api.colleqtive.net/api/v2/public/stores/$STORE_NUMBER/productlists \
    -H 'Content-Type: application/json' \
    -H "Authorization: $COLLEQTIVE_BEARER_TOKEN" \
    -d '{
          "product_list_name": "Produce",
          "product_list_type": 1
        }'
```

#### Response

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

## Retrieves a paginated list of product lists for a specific store, optionally including line items.

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

Retrieves a paginated list of product lists for a specific store, optionally including line items.

### Path Parameters

- `store_number: string`

### Query Parameters

- `last_updated_on: optional string`

  Filter product lists modified on or after this date.

- `name: optional string`

  Optional product list name filter.

- `product_list_id: optional number`

  Optional product list identifier to filter by.

- `show_lines: optional boolean`

  When true, includes the line items for each product list.

- `type: optional number`

  Optional product list type filter.

### Returns

- `page_size: number`

  Maximum number of items returned per page.

- `page_start: number`

  Current page number (1-based).

- `total_count: number`

  Total number of records matching the query across all pages.

- `list: optional array of object { id, line_count, type, 6 more }`

  Collection of items for the current page.

  - `id: number`

    Unique identifier of the product list.

  - `line_count: number`

    Number of line items on the product list.

  - `type: number`

    Numeric product list type identifier.

  - `app_username: optional string`

    Name of the app user associated with the product list. Separate from the audit `created_by` / `modified_by` fields; this is the in-store app user the list belongs to.

  - `free_fields: optional array of object { key, value }`

    Custom free-field key/value pairs associated with the product list.

    - `key: optional string`

      Free-field key.

    - `value: optional string`

      Free-field value.

  - `lines: optional array of object { quantity, barcode, category_code, 7 more }`

    Line items belonging to the product list. Only populated when `show_lines=true` is passed on the request.

    - `quantity: number`

      Quantity on the line.

    - `barcode: optional string`

      The product barcode.

    - `category_code: optional string`

      Category code of the product.

    - `colli: optional number`

      Number of items per colli (case pack).

    - `is_decimal: optional boolean`

      Whether decimal quantities are allowed for the product.

    - `parent_category_code: optional string`

      Parent category code of the product.

    - `product_name: optional string`

      Display name of the product.

    - `product_number: optional string`

      The product number.

    - `stock_pool: optional string`

      Stock pool the line targets.

    - `store_walking_order: optional number`

      Order in which the product appears in the store walking sequence.

  - `modified_on: optional string`

    Date and time the product list was last modified.

  - `name: optional string`

    Name of the product list.

  - `type_description: optional string`

    Human-readable description of the product list type.

- `list_body: optional map[unknown]`

  Additional body-level metadata for the list.

- `list_filters: optional map[array of string]`

  Active filter criteria applied to the result set, keyed by field name.

- `next_page: optional number`

  Next page number, or null when on the last page.

- `previous_page: optional number`

  Previous page number, or null when on the first page.

- `project_last_modified_date: optional string`

  Last modified date/time of the project.

- `scroll_id: optional string`

  Opaque scroll identifier for deep-pagination scenarios.

- `server_time: optional string`

  Server UTC date/time when the response was generated.

- `sort_column: optional string`

  Column name the results are sorted by.

- `sort_order: optional string`

  Sort direction (asc or desc).

- `task_last_modified_date: optional string`

  Last modified date/time of the task.

### Example

```http
curl https://api.colleqtive.net/api/v2/public/stores/$STORE_NUMBER/productlists \
    -H "Authorization: $COLLEQTIVE_BEARER_TOKEN"
```

#### Response

```json
{
  "page_size": 0,
  "page_start": 0,
  "total_count": 0,
  "list": [
    {
      "id": 0,
      "line_count": 0,
      "type": 0,
      "app_username": "app_username",
      "free_fields": [
        {
          "key": "key",
          "value": "value"
        }
      ],
      "lines": [
        {
          "quantity": 0,
          "barcode": "barcode",
          "category_code": "category_code",
          "colli": 0,
          "is_decimal": true,
          "parent_category_code": "parent_category_code",
          "product_name": "product_name",
          "product_number": "product_number",
          "stock_pool": "stock_pool",
          "store_walking_order": 0
        }
      ],
      "modified_on": "2019-12-27T18:11:19.117Z",
      "name": "name",
      "type_description": "type_description"
    }
  ],
  "list_body": {
    "foo": "bar"
  },
  "list_filters": {
    "foo": [
      "string"
    ]
  },
  "next_page": 0,
  "previous_page": 0,
  "project_last_modified_date": "project_last_modified_date",
  "scroll_id": "scroll_id",
  "server_time": "server_time",
  "sort_column": "sort_column",
  "sort_order": "sort_order",
  "task_last_modified_date": "task_last_modified_date"
}
```

## Deletes a product list by id, optionally archiving it or removing only its header.

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

Deletes a product list by id, optionally archiving it or removing only its header.

### Path Parameters

- `store_number: string`

### Query Parameters

- `product_list_id: number`

  The product list identifier to delete.

- `is_archived: optional boolean`

  When true, archives the product list instead of permanently deleting it.

- `is_delete_header: optional boolean`

  When true, deletes only the product list header (and its lines).

### Header Parameters

- `"Accept-Language": optional string`

- `api_key: optional string`

### Example

```http
curl https://api.colleqtive.net/api/v2/public/stores/$STORE_NUMBER/productlists \
    -X DELETE \
    -H "Authorization: $COLLEQTIVE_BEARER_TOKEN"
```

#### Response

```json
true
```

## Adds or updates lines on an existing product list.

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

Adds or updates lines on an existing product list.

### Path Parameters

- `store_number: string`

- `id: number`

### Header Parameters

- `api_key: optional string`

### Body Parameters

- `lines: optional array of object { quantity, article_no, barcode, 2 more }`

  The product list lines to add or update.

  - `quantity: number`

    Quantity on the line.

  - `article_no: optional string`

    Deprecated. Use `product_number` instead. Still accepted on input for backwards compatibility.

  - `barcode: optional string`

    The product barcode.

  - `product_number: optional string`

    Product number identifying the line item.

  - `stock_pool: optional string`

    Stock pool the line targets.

### Returns

- `code: optional number`

- `data: optional string`

- `message: optional string`

- `status: optional string`

### Example

```http
curl https://api.colleqtive.net/api/v2/public/stores/$STORE_NUMBER/productlists/$ID \
    -X POST \
    -H "Authorization: $COLLEQTIVE_BEARER_TOKEN"
```

#### Response

```json
{
  "code": 0,
  "data": "data",
  "message": "message",
  "status": "status"
}
```

## Domain Types

### Product List Create Product List Response

- `ProductListCreateProductListResponse object { product_list_id }`

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

  - `product_list_id: number`

    Identifier of the newly created product list.

### Product List List Product Lists Response

- `ProductListListProductListsResponse object { page_size, page_start, total_count, 11 more }`

  Generic paginated response wrapper.

  - `page_size: number`

    Maximum number of items returned per page.

  - `page_start: number`

    Current page number (1-based).

  - `total_count: number`

    Total number of records matching the query across all pages.

  - `list: optional array of object { id, line_count, type, 6 more }`

    Collection of items for the current page.

    - `id: number`

      Unique identifier of the product list.

    - `line_count: number`

      Number of line items on the product list.

    - `type: number`

      Numeric product list type identifier.

    - `app_username: optional string`

      Name of the app user associated with the product list. Separate from the audit `created_by` / `modified_by` fields; this is the in-store app user the list belongs to.

    - `free_fields: optional array of object { key, value }`

      Custom free-field key/value pairs associated with the product list.

      - `key: optional string`

        Free-field key.

      - `value: optional string`

        Free-field value.

    - `lines: optional array of object { quantity, barcode, category_code, 7 more }`

      Line items belonging to the product list. Only populated when `show_lines=true` is passed on the request.

      - `quantity: number`

        Quantity on the line.

      - `barcode: optional string`

        The product barcode.

      - `category_code: optional string`

        Category code of the product.

      - `colli: optional number`

        Number of items per colli (case pack).

      - `is_decimal: optional boolean`

        Whether decimal quantities are allowed for the product.

      - `parent_category_code: optional string`

        Parent category code of the product.

      - `product_name: optional string`

        Display name of the product.

      - `product_number: optional string`

        The product number.

      - `stock_pool: optional string`

        Stock pool the line targets.

      - `store_walking_order: optional number`

        Order in which the product appears in the store walking sequence.

    - `modified_on: optional string`

      Date and time the product list was last modified.

    - `name: optional string`

      Name of the product list.

    - `type_description: optional string`

      Human-readable description of the product list type.

  - `list_body: optional map[unknown]`

    Additional body-level metadata for the list.

  - `list_filters: optional map[array of string]`

    Active filter criteria applied to the result set, keyed by field name.

  - `next_page: optional number`

    Next page number, or null when on the last page.

  - `previous_page: optional number`

    Previous page number, or null when on the first page.

  - `project_last_modified_date: optional string`

    Last modified date/time of the project.

  - `scroll_id: optional string`

    Opaque scroll identifier for deep-pagination scenarios.

  - `server_time: optional string`

    Server UTC date/time when the response was generated.

  - `sort_column: optional string`

    Column name the results are sorted by.

  - `sort_order: optional string`

    Sort direction (asc or desc).

  - `task_last_modified_date: optional string`

    Last modified date/time of the task.

### Product List Delete Product List Response

- `ProductListDeleteProductListResponse = boolean`

### Product List Update Product List Lines Response

- `ProductListUpdateProductListLinesResponse object { code, data, message, status }`

  - `code: optional number`

  - `data: optional string`

  - `message: optional string`

  - `status: optional string`
