# Vend\ProductsApi

Product operations

All URIs are relative to https://example.retail.lightspeed.app/api/2026-07, except if the operation defines another base path.

| Method | HTTP request | Description |
| ------------- | ------------- | ------------- |
| [**createProduct()**](ProductsApi.md#createProduct) | **POST** /products | Create product |
| [**deleteProduct()**](ProductsApi.md#deleteProduct) | **DELETE** /products/{product_id} | Delete a single product |
| [**deleteProductFamily()**](ProductsApi.md#deleteProductFamily) | **DELETE** /products/{product_id}/all | Delete a product family |
| [**getPriceBooksForProduct()**](ProductsApi.md#getPriceBooksForProduct) | **GET** /products/{product_id}/price_book_products | Get a list of price books the given product is in |
| [**getProductByID()**](ProductsApi.md#getProductByID) | **GET** /products/{product_id} | Get a single product |
| [**listProducts()**](ProductsApi.md#listProducts) | **GET** /products | List products |
| [**updateProduct()**](ProductsApi.md#updateProduct) | **PUT** /products/{product_id} | Update a product |
| [**uploadImage()**](ProductsApi.md#uploadImage) | **POST** /products/{product_id}/actions/image_upload | Upload an image |


## `createProduct()`

```php
createProduct($product_create_body)
```

Create product

Creates a new product.  🔒 Requires: `products:write` scope

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer (JWT) authorization: bearerAuth
$config = Vend\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Vend\Api\ProductsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$product_create_body = new \Vend\Model\ProductCreateBody(); // \Vend\Model\ProductCreateBody | **Note**: You cannot include both `price_including_tax` and `price_excluding_tax`.

try {
    $apiInstance->createProduct($product_create_body);
} catch (Exception $e) {
    echo 'Exception when calling ProductsApi->createProduct: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **product_create_body** | [**\Vend\Model\ProductCreateBody**](../Model/ProductCreateBody.md)| **Note**: You cannot include both &#x60;price_including_tax&#x60; and &#x60;price_excluding_tax&#x60;. | |

### Return type

void (empty response body)

### Authorization

[bearerAuth](../../README.md#bearerAuth)

### HTTP request headers

- **Content-Type**: `application/json`
- **Accept**: `Example`, `application/json`

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

## `deleteProduct()`

```php
deleteProduct($product_id)
```

Delete a single product

Deletes a single product. If a variant ID is provided, that single variant is removed.  🔒 Requires: `products:write` scope

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer (JWT) authorization: bearerAuth
$config = Vend\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Vend\Api\ProductsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$product_id = 'product_id_example'; // string | The product id

try {
    $apiInstance->deleteProduct($product_id);
} catch (Exception $e) {
    echo 'Exception when calling ProductsApi->deleteProduct: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **product_id** | **string**| The product id | |

### Return type

void (empty response body)

### Authorization

[bearerAuth](../../README.md#bearerAuth)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: Not defined

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

## `deleteProductFamily()`

```php
deleteProductFamily($product_id)
```

Delete a product family

Deletes a product family. The /all suffix is provided to delete an entire variant family.  🔒 Requires: `products:write` scope

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer (JWT) authorization: bearerAuth
$config = Vend\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Vend\Api\ProductsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$product_id = 'product_id_example'; // string | The product id of a family member

try {
    $apiInstance->deleteProductFamily($product_id);
} catch (Exception $e) {
    echo 'Exception when calling ProductsApi->deleteProductFamily: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **product_id** | **string**| The product id of a family member | |

### Return type

void (empty response body)

### Authorization

[bearerAuth](../../README.md#bearerAuth)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: Not defined

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

## `getPriceBooksForProduct()`

```php
getPriceBooksForProduct($product_id): \Vend\Model\PriceBookProductCollection
```

Get a list of price books the given product is in

This endpoint returns the list of price books the given product is in.  🔒 Requires: `products:read:price_books` scope

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer (JWT) authorization: bearerAuth
$config = Vend\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Vend\Api\ProductsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$product_id = 'product_id_example'; // string | The product id to find in the Price Books

try {
    $result = $apiInstance->getPriceBooksForProduct($product_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ProductsApi->getPriceBooksForProduct: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **product_id** | **string**| The product id to find in the Price Books | |

### Return type

[**\Vend\Model\PriceBookProductCollection**](../Model/PriceBookProductCollection.md)

### Authorization

[bearerAuth](../../README.md#bearerAuth)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/json`

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

## `getProductByID()`

```php
getProductByID($product_id): \Vend\Model\ProductResponse
```

Get a single product

Returns a single product object with a given ID.  🔒 Requires: `products:read` scope

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer (JWT) authorization: bearerAuth
$config = Vend\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Vend\Api\ProductsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$product_id = 'product_id_example'; // string | The product id

try {
    $result = $apiInstance->getProductByID($product_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ProductsApi->getProductByID: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **product_id** | **string**| The product id | |

### Return type

[**\Vend\Model\ProductResponse**](../Model/ProductResponse.md)

### Authorization

[bearerAuth](../../README.md#bearerAuth)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/json`

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

## `listProducts()`

```php
listProducts($after, $before, $deleted, $page_size, $sku, $name, $family_name, $includes, $include_images): \Vend\Model\ProductCollection
```

List products

Returns a paginated list of products.  To search for products, please have a look at our [Search endpoint](/reference/search-1) on what is supported.  🔒 Requires: `products:read` scope

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer (JWT) authorization: bearerAuth
$config = Vend\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Vend\Api\ProductsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$after = 56; // int | The lower limit for the version numbers to be included in the response.
$before = 56; // int | The upper limit for the version numbers to be included in the response.
$deleted = True; // bool | Indicates whether deleted items should be included in the response.
$page_size = 56; // int | The maximum number of items to be returned in the response.
$sku = 'sku_example'; // string | Allows loading a product by one of its SKUs. Note that all other query params are ignored if this is provided.
$name = 'name_example'; // string | Allows loading products with the name provided in this parameter. This query typically retrieves all products from the product family with the provided name. Note that all other query parameters are ignored if this is provided.
$family_name = 'family_name_example'; // string | Alias for 'name'. Allows loading products that belong to the family with the name provided in this parameter. Note that all other query parameters are ignored if this is provided.
$includes = array('includes_example'); // string[] | Side-load related entities. Supported value 'composite_products'.
$include_images = True; // bool | Whether to include product image fields in the response. Defaults to true.

try {
    $result = $apiInstance->listProducts($after, $before, $deleted, $page_size, $sku, $name, $family_name, $includes, $include_images);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ProductsApi->listProducts: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **after** | **int**| The lower limit for the version numbers to be included in the response. | [optional] |
| **before** | **int**| The upper limit for the version numbers to be included in the response. | [optional] |
| **deleted** | **bool**| Indicates whether deleted items should be included in the response. | [optional] |
| **page_size** | **int**| The maximum number of items to be returned in the response. | [optional] |
| **sku** | **string**| Allows loading a product by one of its SKUs. Note that all other query params are ignored if this is provided. | [optional] |
| **name** | **string**| Allows loading products with the name provided in this parameter. This query typically retrieves all products from the product family with the provided name. Note that all other query parameters are ignored if this is provided. | [optional] |
| **family_name** | **string**| Alias for &#39;name&#39;. Allows loading products that belong to the family with the name provided in this parameter. Note that all other query parameters are ignored if this is provided. | [optional] |
| **includes** | [**string[]**](../Model/string.md)| Side-load related entities. Supported value &#39;composite_products&#39;. | [optional] |
| **include_images** | **bool**| Whether to include product image fields in the response. Defaults to true. | [optional] |

### Return type

[**\Vend\Model\ProductCollection**](../Model/ProductCollection.md)

### Authorization

[bearerAuth](../../README.md#bearerAuth)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/json`

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

## `updateProduct()`

```php
updateProduct($product_id, $product_update21_request): object
```

Update a product

Update an existing product.  🔒 Requires: `products:write` scope

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer (JWT) authorization: bearerAuth
$config = Vend\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Vend\Api\ProductsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$product_id = 'product_id_example'; // string | The object identifier of the Product to update.
$product_update21_request = new \Vend\Model\ProductUpdate21Request(); // \Vend\Model\ProductUpdate21Request

try {
    $result = $apiInstance->updateProduct($product_id, $product_update21_request);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ProductsApi->updateProduct: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **product_id** | **string**| The object identifier of the Product to update. | |
| **product_update21_request** | [**\Vend\Model\ProductUpdate21Request**](../Model/ProductUpdate21Request.md)|  | |

### Return type

**object**

### Authorization

[bearerAuth](../../README.md#bearerAuth)

### HTTP request headers

- **Content-Type**: `application/json`
- **Accept**: `application/json`

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

## `uploadImage()`

```php
uploadImage($product_id, $upload_image_request): \Vend\Model\ImageResponse
```

Upload an image

Upload a binary file with an image to be used for a product. This request should be encoded as `multipart/form-data`.  > **Please Note** If you are reading this on https://x-series-api.lightspeedhq.com then the `Try It!` generated code will not work as the underlying code generator assumes the image will be base64 encoded, which the API does not support. Please have a look at https://x-series-api.lightspeedhq.com/docs/products_image_upload_basics instead.  🔒 Requires: `products:write` scope

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer (JWT) authorization: bearerAuth
$config = Vend\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Vend\Api\ProductsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$product_id = 'product_id_example'; // string | The product id
$upload_image_request = new \Vend\Model\UploadImageRequest(); // \Vend\Model\UploadImageRequest

try {
    $result = $apiInstance->uploadImage($product_id, $upload_image_request);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ProductsApi->uploadImage: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **product_id** | **string**| The product id | |
| **upload_image_request** | [**\Vend\Model\UploadImageRequest**](../Model/UploadImageRequest.md)|  | |

### Return type

[**\Vend\Model\ImageResponse**](../Model/ImageResponse.md)

### Authorization

[bearerAuth](../../README.md#bearerAuth)

### HTTP request headers

- **Content-Type**: `application/octet-stream`
- **Accept**: `application/json`

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)
