# Product

## Create Product

<mark style="color:green;">`POST`</mark> `‎https://<domain>/<api prefix>/<version>/commerce/product/create/`

This API endpoint will create a product under an external-api-product type.

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access token |

#### Request Body

| Name                                                               | Type   | Description                                                                                                                                                                                                                                               |
| ------------------------------------------------------------------ | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| bundle\_id<mark style="color:red;">\*</mark>                       | string | Bundle id(bundle unique id)                                                                                                                                                                                                                               |
| name<mark style="color:red;">\*</mark>                             | string | Product bundle name                                                                                                                                                                                                                                       |
| bundle\_name\_translations<mark style="color:red;">\*</mark>       | string | <p>Translations for a product bundle.<br>A Bundle name in English is required.</p>                                                                                                                                                                        |
| description\_translations<mark style="color:red;">\*</mark>        | string | <p>Product description,<br>Description in English is required.</p>                                                                                                                                                                                        |
| short\_description\_translations<mark style="color:red;">\*</mark> | string | <p>Product short description,<br>A short description in English is required.</p>                                                                                                                                                                          |
| varients<mark style="color:red;">\*</mark>                         | string | <p>At least one varient is required.<br>Varient must contain price, product-name, and whole-sale-price. and ensure that the selected product type only contains these three varients. <br>Additionally, add a key product-sku (product unique sku).  </p> |
| attributes<mark style="color:red;">\*</mark>                       | string | The attribute must contain business-volume, points,  and, cumulative-volume.                                                                                                                                                                              |

{% tabs %}
{% tab title="200 " %}

```markup
​HTTP/1.1 200 OK
Content-Type: application/json
​
Body:
{
    "status_code": 200,
    "errors": {},
    "data": {}
}
```

{% endtab %}
{% endtabs %}

**Note**:-

By using this API endpoint you can create a product under product type external-api-product.

Body Parameters are JSON.stringify, Refer below block for the body parameter structure, and also refer sample code.

```markup
{
    "bundle_id":"<bundle_id>",
    "name":"<bundle_name>",
    "bundle_name_translations":{"en": "<bundle_name_en>","de": "<bundle_name_de>"},
    "description_translations":{"en": "<description_en>","de": "<description_dn>"},
    "short_description_translations":{"en": "<short_description_en>","de": "<short_description_de>"},
    "varients":[{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sku>"},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sku>"}],
    "attributes":{"business-volume":<business-volume>, "points":<reward_point>, "cumulative-volume":<cumulative_volume>}
}
```

#### Sample Code

**Node**

```javascript
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://<domain>/<api prefix>/<version>/commerce/product/create/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access token>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "bundle_id":"<bundle_id>",
    "name":"<bundle_name>",
    "bundle_name_translations":{"en": "<bundle_name_en>","de": "<bundle_name_de>"},
    "description_translations":{"en": "<description_en>","de": "<description_dn>"},
    "short_description_translations":{"en": "<short_description_en>","de": "<short_description_de>"},
    "varients":[{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sku>"},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sku>"}],
    "attributes":{"business-volume":<business-volume>, "points":<reward_point>, "cumulative-volume":<cumulative_volume>}
  })

};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

```

**PHP**

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/commerce/product/create/',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "bundle_id":"<bundle_id>",
    "name":"<bundle_name>",
    "bundle_name_translations":{"en": "<bundle_name_en>","de": "<bundle_name_de>"},
    "description_translations":{"en": "<description_en>","de": "<description_dn>"},
    "short_description_translations":{"en": "<short_description_en>","de": "<short_description_de>"},
    "varients":[{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sku>"},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sku>"}],
    "attributes":{"business-volume":<business-volume>, "points":<reward_point>, "cumulative-volume":<cumulative_volume>}
}',
  CURLOPT_HTTPHEADER => array(
    'apikey: <apikey>',
    'Authorization: Bearer <access token>',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

#### Error Responses

| Status Code | Error Type       | FIeld                            | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ----------- | ---------------- | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 401         | Request Failed   |                                  | Required product type for creating product using api is not created.                                                                                                                                                                                                                                                                                                                                                                                                                                |
| 400         | Validation Error | bundle\_id                       | <p>Bundle id is required.</p><p>This field may not be blank.</p><p>Produt with same bundle id is already exist.</p>                                                                                                                                                                                                                                                                                                                                                                                 |
| 400         | Validation Error | name                             | <p>This field is required.</p><p>This field may not be blank.</p><p>Ensure this field has no more than 200 characters.</p>                                                                                                                                                                                                                                                                                                                                                                          |
| 400         | Validation Error | bundle\_name\_translations       | <p>This field is required.</p><p>Bundle Name for en language is required.</p>                                                                                                                                                                                                                                                                                                                                                                                                                       |
| 400         | Validation Error | description\_translations        | <p>This field is required.</p><p>Description of en language is required.</p>                                                                                                                                                                                                                                                                                                                                                                                                                        |
| 400         | Validation Error | short\_description\_translations | <p>This field is required.</p><p>A short description of en language is required.</p>                                                                                                                                                                                                                                                                                                                                                                                                                |
| 400         | Validation Error | varients                         | <p>This field is required.</p><p>You can't possible add a product under the requested product type. Select a product type have only Price, Whole sale price and Product name as varients.</p><p>One of the varient object is not valid, check each varient objects contains price,product-name,whole-sale-price and product-sku.</p><p>At least one varient is required.</p><p>Product id should be a unique value.</p><p>Product id may not be a null value. Same product id's recieved.</p>       |
| 400         | Validation Error | attributes                       | <p>This field is required.</p><p>You cant possible to add product under the requested product type. Select a product type have only Business-volume, Pointes and Cumulative-volume as attributes.</p><p>Attribute should contains Business-volume, Points and Cumulative-volume, not include another attributes.</p><p>Business-volume is required.</p><p>Points is required.</p><p>Cumulative-volume is required.</p><p>Attribute must contains Business-volume, Points and Cumulative-volume.</p> |

## Update Product

<mark style="color:green;">`POST`</mark> `‎https://<domain>/<api prefix>/<version>/commerce/product/update/`

This API endpoint will update a product bundle if it's an external-api-product type .

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| apikey<mark style="color:red;">\*</mark>        | string | apikey       |
| Authorization<mark style="color:red;">\*</mark> | string | Access token |

#### Request Body

| Name                                                               | Type   | Description                                                                                                                                                                                                                   |
| ------------------------------------------------------------------ | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| bundle\_id<mark style="color:red;">\*</mark>                       | string | Product bundle unique id                                                                                                                                                                                                      |
| name<mark style="color:red;">\*</mark>                             | string | New name or existing name for bundle.                                                                                                                                                                                         |
| bundle\_name\_translations<mark style="color:red;">\*</mark>       | string | Existing  or New Translations for a product bundle.                                                                                                                                                                           |
| description\_translations<mark style="color:red;">\*</mark>        | string | Existing or New Translations for Product description                                                                                                                                                                          |
| short\_description\_translations<mark style="color:red;">\*</mark> | string | Existing or New Translations for Product short description,                                                                                                                                                                   |
| varients<mark style="color:red;">\*</mark>                         | string | Varient must contain price, product-name, and whole-sale-price. Additionally, add a key product-sku with aexisting sku as a value if u want to update existing variant or give new sku as a value to add new product varient. |
| attributes<mark style="color:red;">\*</mark>                       | string | The attribute must contain business-volume, points, and, cumulative-volume.                                                                                                                                                   |

{% tabs %}
{% tab title="200 " %}

```markup
​HTTP/1.1 200 OK
Content-Type: application/json
​
Body:
{
    "status_code": 200,
    "errors": {},
    "data": {}
}
```

{% endtab %}
{% endtabs %}

**Note**:-

By using this API endpoint you can update a product that is under external-api-product.

Additionally, add a key  product-sku with a existing id as a value if you want to update the existing varien&#x74;*.* Give new id as a value of product-sku for adding a new product varient.&#x20;

Body Parameters are JSON.stringify, Refer below block for the body parameter structure, and also refer sample code.

```markup
{
    "bundle_id":"<bundle_id>",
    "name":"<bundle_name>",
    "bundle_name_translations":{"en": "<bundle_name_en>","de": "<bundle_name_de>"},
    "description_translations":{"en": "<description_en>","de": "<description_dn>"},
    "short_description_translations":{"en": "<short_description_en>","de": "<short_description_de>"},
    "varients":[{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":<product_sku>},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":<product_sku>}],
    "attributes":{"business-volume":<business-volume>, "points":<reward_point>, "cumulative-volume":<cumulative_volume>}
}
```

#### Sample Code

**Node**

```php
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://<domain>/<api prefix>/<version>/commerce/product/update/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access token>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "bundle_id":"<bundle_id>",
    "name":"<bundle_name>",
    "bundle_name_translations":{"en": "<bundle_name_en>","de": "<bundle_name_de>"},
    "description_translations":{"en": "<description_en>","de": "<description_dn>"},
    "short_description_translations":{"en": "<short_description_en>","de": "<short_description_de>"},
    "varients":[{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":<product_sku>},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":<product_sku>}],
    "attributes":{"business-volume":<business-volume>, "points":<reward_point>, "cumulative-volume":<cumulative_volume>}
})

};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

```

**PHP**

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/commerce/product/update/',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "bundle_id":"<bundle_id>",
    "name":"<bundle_name>",
    "bundle_name_translations":{"en": "<bundle_name_en>","de": "<bundle_name_de>"},
    "description_translations":{"en": "<description_en>","de": "<description_dn>"},
    "short_description_translations":{"en": "<short_description_en>","de": "<short_description_de>"},
    "varients":[{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":<product_sku>},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":<product_sku>}],
    "attributes":{"business-volume":<business-volume>, "points":<reward_point>, "cumulative-volume":<cumulative_volume>}
}',
  CURLOPT_HTTPHEADER => array(
    'apikey: <apikey>',
    'Authorization: Bearer <access token>',
    'Content-Type: application/json',
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

#### Error Responses

| Status Code | Error Type       | FIeld                            | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ----------- | ---------------- | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 400         | Invalid Input    | bundle\_id                       | <p>Bundle id is required.</p><p>This field may not be blank.</p><p>Bundle does not exist.</p><p>Requested bundle is not under the external api product category.</p>                                                                                                                                                                                                                                                                                                  |
| 400         | Validation Error | name                             | <p>This field is required.</p><p>This field may not be blank.</p><p>Ensure this field has no more than 200 characters.</p>                                                                                                                                                                                                                                                                                                                                            |
| 400         | Validation Error | description\_translations        | <p>This field is required.</p><p>Description of en language is required.</p>                                                                                                                                                                                                                                                                                                                                                                                          |
| 400         | Validation Error | short\_description\_translations | <p>This field is required.</p><p>A short description of en language is required.</p>                                                                                                                                                                                                                                                                                                                                                                                  |
| 400         | Validation Error | varients                         | <p>You can't possible add a product under the requested product type. Select a product type have only Price, Whole sale price and Product name as varients.</p><p>One of the varient object is not valid, check each varient objects contains price,product-name,whole-sale-price and product-sku.</p><p>At least one varient is required.</p><p>Product sku should be a unique value. Product sku may not be a null value. Same product sku's recieved.</p>          |
| 400         | Validation Error | attributes                       | <p>You cant possible to add product under the requested product type. Select a product type have only Business-volume, Pointes and Cumulative-volume as attributes.</p><p>Attribute should contains Business-volume, Points and Cumulative-volume, not include another attributes.</p><p>Business-volume is required.</p><p>Points is required.</p><p>Cumulative-volume is required.</p><p>Attribute must contains Business-volume, Points and Cumulative-volume.</p> |

## Delete Product Bundle

<mark style="color:red;">`DELETE`</mark> `‎https://<domain>/<api prefix>/<version>/commerce/product/delete/`

This API endpoint will delete a product bundle if it's an external-api-product type.

#### Query Parameters

| Name                                         | Type   | Description |
| -------------------------------------------- | ------ | ----------- |
| bundle\_id<mark style="color:red;">\*</mark> | string | Bundle id   |

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access token |

{% tabs %}
{% tab title="200 " %}

```markup
​HTTP/1.1 200 OK
Content-Type: application/json
​
Body:
{
    "status_code": 200,
    "errors": {},
    "data": {}
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

**Node**

```php
var request = require('request');
var options = {
  'method': 'DELETE',
  'url': 'https://<domain>/<api prefix>/<version>/commerce/product/delete/?bundle_id=<bundle_id>',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access token>'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

```

**PHP**

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/commerce/product/delete/?bundle_id=<bundle_id>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'DELETE',
  CURLOPT_HTTPHEADER => array(
    'apikey: <apikey>',
    'Authorization: Bearer <access token>'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

#### Error Responses

| Status Code | Error Type     | FIeld      | Description                                                                                                                                                    |
| ----------- | -------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 400         | Invalid Input  | bundle\_id | <p>Bundle id is required.</p><p>This field may not be blank.</p><p>Product Bundle does not exist.</p><p>Product Bundle is not a external-api-product type.</p> |
| 401         | Request Failed |            | <p>The product contains in a order that is not completed yet.</p><p>The package purchased by some users.</p>                                                   |

## Delete Product Varient

<mark style="color:red;">`DELETE`</mark> `‎https://<domain>/<api prefix>/<version>/commerce/product/delete/product-varient/`

This API endpoint will delete a varient (product) from the product bundle if it's an external-api-product type.&#x20;

#### Query Parameters

| Name                                           | Type   | Description  |
| ---------------------------------------------- | ------ | ------------ |
| bundle\_id<mark style="color:red;">\*</mark>   | string | Bundle id    |
| product\_sku<mark style="color:red;">\*</mark> | string | Product sku. |

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access token |

{% tabs %}
{% tab title="200 " %}

```
​HTTP/1.1 200 OK
Content-Type: application/json
​
Body:
{
    "status_code": 200,
    "errors": {},
    "data": {}
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

#### Node

```php
var request = require('request');
var options = {
  'method': 'DELETE',
  'url': 'https://<domain>/<api prefix>/<version>/commerce/product/delete/product-varient/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access token>'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

```

#### PHP

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/commerce/product/delete/product-varient/',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'DELETE',
  CURLOPT_HTTPHEADER => array(
    'apikey: <apikey>',
    'Authorization: Bearer <access token>',
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

#### Error Responses

| Status Code | Error Type       | FIeld        | Description                                                                                                                                                                                                                             |
| ----------- | ---------------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 400         | Validation Error | product\_sku | <p>This field is required.</p><p>This field may not be blank.</p><p>Product sku is not valid.</p><p>Product does not exist.</p>                                                                                                         |
| 400         | Validation Error | bundle\_id   | <p>This field is required.</p><p>This field may not be blank.</p>                                                                                                                                                                       |
| 401         | Request Failed   |              | <p>Only one varient left under the product bundle, can't delete it.</p><p>You can delete a product under the external-api-product not athor category product.</p><p>Only one varient left under the prouct bundle, can't delete it.</p> |

## List Products

<mark style="color:blue;">`GET`</mark> `‎https://<domain>/<api prefix>/<version>/commerce/product/list/`

This API endpoint List product bundle with product details.

#### Query Parameters

| Name     | Type   | Description         |
| -------- | ------ | ------------------- |
| offset   | string |                     |
| limit    | string |                     |
| name     | string | Product Bundle name |
| category | string | Product type        |

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access token |

{% tabs %}
{% tab title="200 " %}

```markup
​HTTP/1.1 200 OK
Content-Type: application/json
​
Body:
{
    "status_code": 200,
    "errors": {},
    "data": {
        "results": [
             {
                "name": "<bundli_name>",
                "product_type": "<product_type>",
                "status": <status>,
                "products": [
                    {
                        "product_id": "<product_id>",
                        "name": "<product_name>",
                        "product_type": "<product_type_name>",
                        "base_price": "<product_price>",
                        "status": <status>,
                        "image": "<image>"
                    }
                ],
                "bundle_id": "<bundle_id>"
            },
            ...
        ],
        "count": <list_count>,
        "previous": <previous_page_url>,
        "next": <next_page_url>
    }
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

**Node**

```php
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://<domain>/<api prefix>/<version>/commerce/product/list/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access token>'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

```

**PHP**

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/commerce/product/list/',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'apikey: <apikey>',
    'Authorization: Bearer <access token>'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

## Create Bulk Products

<mark style="color:green;">`POST`</mark> `‎https://<domain>/<api prefix>/<version>/commerce/product/bulk/create/`

This API endpoint will create bulk product.

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | Apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access token |

{% tabs %}
{% tab title="200 " %}

```markup
​HTTP/1.1 200 OK
Content-Type: application/json
​
Body:
{
    "status_code": 200,
    "errors": {},
    "data": {
        "Product_creation_failed": {
            "same_bundle_id": [<return if already exist product with same bundle id.>],
            "bundle_id_null": [<return if bunle is a null value.>],
            "bundle_id_not_found": [<return if bundle id is not given.>]
        }
    }
}
```

{% endtab %}
{% endtabs %}

#### Body params :- JSON.stringify

```php
[
    {
        "bundle_id":"<bundle_id>",
        "name":"<bundle_name>",
        "bundle_name_translations":{"en": "<bundle_name_en>","de": "<bundle_name_de>"},
        "description_translations":{"en": "<description_en>","de": "<description_dn>"},
        "short_description_translations":{"en": "<short_description_en>","de": "<short_description_de>"},
        "varients":[{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sku>"},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sk>"}],
        "attributes":{"business-volume":<business-volume>, "points":<reward_point>, "cumulative-volume":<cumulative_volume>}
    },
    {
        "bundle_id":"<bundle_id>",
        "name":"<bundle_name>",
        "bundle_name_translations":{"en": "<bundle_name_en>","de": "<bundle_name_de>"},
        "description_translations":{"en": "<description_en>","de": "<description_dn>"},
        "short_description_translations":{"en": "<short_description_en>","de": "<short_description_de>"},
        "varients":[{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sju>"},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sku>"}],
        "attributes":{"business-volume":<business-volume>, "points":<reward_point>, "cumulative-volume":<cumulative_volume>}
    },
    ...
]
```

#### Sample Code

**Node**

```javascript
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://<domain>/<api prefix>/<version>/commerce/product/bulk/create/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access token>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify([{
        "bundle_id":"<bundle_id>",
        "name":"<bundle_name>",
        "bundle_name_translations":{"en": "<bundle_name_en>","de": "<bundle_name_de>"},
        "description_translations":{"en": "<description_en>","de": "<description_dn>"},
        "short_description_translations":{"en": "<short_description_en>","de": "<short_description_de>"},
        "varients":[{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sku>"},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sku>"}],
        "attributes":{"business-volume":<business-volume>, "points":<reward_point>, "cumulative-volume":<cumulative_volume>}
     },
     {
        "bundle_id":"<bundle_id>",
        "name":"<bundle_name>",
        "bundle_name_translations":{"en": "<bundle_name_en>","de": "<bundle_name_de>"},
        "description_translations":{"en": "<description_en>","de": "<description_dn>"},
        "short_description_translations":{"en": "<short_description_en>","de": "<short_description_de>"},
        "varients":[{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sku>"},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sku>"}],
        "attributes":{"business-volume":<business-volume>, "points":<reward_point>, "cumulative-volume":<cumulative_volume>}
     },
    ...
    ])

};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

```

**PHP**

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/commerce/product/bulk/create/',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'[
   {
        "bundle_id":"<bundle_id>",
        "name":"<bundle_name>",
        "bundle_name_translations":{"en": "<bundle_name_en>","de": "<bundle_name_de>"},
        "description_translations":{"en": "<description_en>","de": "<description_dn>"},
        "short_description_translations":{"en": "<short_description_en>","de": "<short_description_de>"},
        "varients":[{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sku>"},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sku>"}],
        "attributes":{"business-volume":<business-volume>, "points":<reward_point>, "cumulative-volume":<cumulative_volume>}
   },
   {
        "bundle_id":"<bundle_id>",
        "name":"<bundle_name>",
        "bundle_name_translations":{"en": "<bundle_name_en>","de": "<bundle_name_de>"},
        "description_translations":{"en": "<description_en>","de": "<description_dn>"},
        "short_description_translations":{"en": "<short_description_en>","de": "<short_description_de>"},
        "varients":[{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sku>"},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sku>"}],
        "attributes":{"business-volume":<business-volume>, "points":<reward_point>, "cumulative-volume":<cumulative_volume>}
   },
    ...
  ]',
  CURLOPT_HTTPHEADER => array(
    'apikey: <apikey>',
    'Authorization: Bearer <access token>',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

#### Error Responses

| Status Code | Error Type     | FIeld | Description                                                                                                                |
| ----------- | -------------- | ----- | -------------------------------------------------------------------------------------------------------------------------- |
| 400         | Request Failed |       | <p>Required product type for creating product using api is not created.</p><p>Maximum bulk create product count is 50.</p> |

Check error responses of the create product endpoint.

## List API Product

<mark style="color:blue;">`GET`</mark> `‎https://<domain>/<api prefix>/<version>/commerce/product/list/api-products/`

This API endpoint will return a list of products that are created by api.

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | Apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access token |

{% tabs %}
{% tab title="200 " %}

```markup
​HTTP/1.1 200 OK
Content-Type: application/json
​
Body:
{
    "status_code": 200,
    "errors": {},
    "data": {
        "results": [
            {
                "bundle_id": "<bundle_id>",
                "bundle_name": "<bundle_name>",
                "products": [
                    {
                        "product_id": "<product_id>",
                        "name": "<product_name1>",
                        "base_price": <base_price>,
                        "status": <status>
                    },
                    ...
                ]
            },
            ...
        ],
        "count": <list_count>,
        "previous": <previous_page_url>,
        "next": <next_page_url>
    }
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

**Node**

```php
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://<domain>/<api prefix>/<version>/commerce/product/list/api-products/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access token>',
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

```

**PHP**

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/commerce/product/list/api-products/',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'apikey: <apikey>',
    'Authorization: Bearer <access token>',
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```
