# Create Product, Product Line Item

This tutorial should help you to Create Products (Upload Products to Pipeliner). Before moving forward, make sure your [**Authentication** ](https://developers.pipelinersales.com/api-docs/overview/authentication)works and you understand the [**Key Concepts**](https://developers.pipelinersales.com/api-docs/core-api-concepts/understanding-the-crm-concept) of the Pipeliner API, and make sure you know how to use [**API parameters**](https://developers.pipelinersales.com/api-docs/core-api-concepts/api-parameters)

**The Product** represents the physical or virtual thing that your company sells. Product is usually defined by name, by SKU (unique identification, stock-keeping unit), and by some other properties like category, unit, etc. **Products** and their management can be found in Administration.

**The Product Line item** represents specific relation between Product & Opportunity. At the moment when the Product is linked with the opportunity, we call this relation Product Line Item. On this relation, your salespeople define the Price, Discounts of the Product. **Product Line items** can be found on Opportunities

![Products: Management of Products is located in Admistration](https://3470708952-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFpjbhrh1xo0SPAbAc7Ny%2Fuploads%2F41luFnMmS1vBungRbDqB%2FProducts%20_%20Pipeliner%20CRM%20-%20Google%20Chrome%202022-01-0.png?alt=media\&token=d205e853-bb3a-48d8-a5bc-c370c330a00f)

![Product Line Items: Products can be used on Opportunities by salespeople, when selling to the Customers](https://3470708952-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFpjbhrh1xo0SPAbAc7Ny%2Fuploads%2FHTnO3pecvzPMawrSpluz%2FBruen%20Canada%20_%20Pipeliner%20CRM%20-%20Google%20Chrome%202022-.png?alt=media\&token=7cbe2a2f-18f5-49d5-b017-707e95c31c20)

## Products - Tutorial Assignment <a href="#tutorial-assignment" id="tutorial-assignment"></a>

Create new Products in Pipeliner with correct Product Properties like Product name, SKU, product category.

### 0. Required fields <a href="#id-0.-required-fields" id="id-0.-required-fields"></a>

<table><thead><tr><th width="251.76811427063683">Required API field Name</th><th>Description</th></tr></thead><tbody><tr><td>name</td><td>Name of the Account</td></tr><tr><td>allowed_pipelines</td><td>Select on which Opportunity Pipelines the product should be enabled. Use <code>1</code> for All Pipelines (recommended)</td></tr><tr><td>unit_symbol</td><td>The name of the unit of measure for the product. You can use custom values like pounds, hours, h, kgs , etc.</td></tr></tbody></table>

### 1.  Prepare Data

**Product\_*****category\_*****id**

It is optional to use the Product category when creating products. Product category helps to organize products to groups/product families with similar properties like (engines, wheels, etc.). Use the following reguest to retrieve ProductCategories

```
GET
{{baseUrl}}/entities/ProductCategories
```

### **2**.  Create products

We are going to use [**Bulk create method**](https://developers.pipelinersales.com/api-docs/core-api-concepts/bulk-create-update-delete) to create more Products in the Pipeliner application at once.

{% openapi src="<https://3470708952-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFpjbhrh1xo0SPAbAc7Ny%2Fuploads%2FOlNVdYj1h5GSxQmLHAjz%2Fopenapi%20(1).json?alt=media&token=4be07353-5170-4a95-9100-4f16545d47b0>" path="/entities/Products/batch-modify" method="post" %}
[openapi (1).json](https://3470708952-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFpjbhrh1xo0SPAbAc7Ny%2Fuploads%2FOlNVdYj1h5GSxQmLHAjz%2Fopenapi%20\(1\).json?alt=media\&token=4be07353-5170-4a95-9100-4f16545d47b0)
{% endopenapi %}

```json
[
    {
        "name": "Product 1",
        "allowed_pipelines": 1,
        "unit_symbol": "kg"
    },
    {
        "name": "Product 2",
        "allowed_pipelines": 1,
        "unit_symbol": "pcs"
    },
    {
        "name": "Product 3",
        "allowed_pipelines": 1,
        "unit_symbol": "hours"
    }
]
```

```json
{
    "success": true,
    "data": [
        "703c7426-c197-4441-beb7-201609ee47af",
        "c4d2428f-f8ef-4f27-abdb-aaf3fe626a89",
        "3648bf8a-6ad8-4057-b404-5d01bfac7dff"
    ]
}
```

![](https://3470708952-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFpjbhrh1xo0SPAbAc7Ny%2Fuploads%2Fa6DGWVavpBmwIO3XVkOm%2FProducts%20_%20Pipeliner%20CRM%20-%20Google%20Chrome%202022-01-0.png?alt=media\&token=eff431f4-6fd8-4c05-a68f-06325cf51b8f)

## Product Line Items - Tutorial Assignment <a href="#tutorial-assignment" id="tutorial-assignment"></a>

Create Opportunity with Product Line items (Product Line Items). Set a correct Price, discount for each of the Product Line items.

Before jumping to this tutorial, you should already understand the process of creating Opportunities inside the Pipeliner Application. If you don´t, read  [**Create Opportunity** ](https://developers.pipelinersales.com/api-docs/tutorials-and-articles/create-opportunity)tutorial beforehand.

{% hint style="success" %}
Working with Product Line items is supported by this Endpoint **{{baseURL}}/entities/OpptyProductRelations/**
{% endhint %}

### Basic Use Case: Create Product Line Items on Opportunity <a href="#id-0.-required-fields" id="id-0.-required-fields"></a>

We are going to use the Opportunity values that we prepared in the tutorial [**Create Opportunity**](https://developers.pipelinersales.com/api-docs/tutorials-and-articles/create-opportunity)**.** For Product Line items we need to specify a new attribute in the JSON body - `product_relations.` This attribute represents the list of products that are going to be linked with the Newly created Opportunity and newly created products from the previous tutorial [**Products - Tutorial Assignment**](#tutorial-assignment)**.**&#x20;

```json
{
    "closing_date": "2019-01-01",
    "name": "New Opportunity",
    "owner_id": "00000000-0000-0000-0000-000000011a7d",
    "step_id": "de115511-5dc1-46c3-86d9-f714457208dd",
    "value": {
        "base_value": 100,
        "currency_id": "c4ca4238-a0b9-0382-0dcc-509a6f75849b"
    },
    "account_relations": [
       {
           "account_id": "0bc376a4-c579-413a-9221-e86e4a134766",
           "is_primary": true
           
       }
    ],
    "contact_relations": [
       {
           "contact_id": "02bdc9f6-4dfb-479e-84ba-f6c3b96c39ba",
           "is_primary":true
       }
    ],
    "product_relations" : [
        {
            "product_id": "703c7426-c197-4441-beb7-201609ee47af",
            "price": 10
        },
        {
            "product_id": "c4d2428f-f8ef-4f27-abdb-aaf3fe626a89",
            "price": 20
        },
        {
            "product_id": "3648bf8a-6ad8-4057-b404-5d01bfac7dff",
            "price": 30
        }
    ]
}
```

![Example how the Product Line items look on Opportunity](https://3470708952-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFpjbhrh1xo0SPAbAc7Ny%2Fuploads%2Fq1pP7gCAmQNECjUIUX10%2FNew%20Opportunity%20_%20Pipeliner%20CRM%20-%20Google%20Chrome%2020.png?alt=media\&token=b2b391b3-a11c-4fe8-8c71-0bdde819a0bc)

### Other Use Cases

#### Automatically update the final Opportunity value from Products

This is really helpful when your business calculates Opportunity Values only from Products on Opportunity. Then define an opportunity attribute `"is_value_auto_calculate": true`

![Auto calculation of Price is Enabled](https://3470708952-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFpjbhrh1xo0SPAbAc7Ny%2Fuploads%2F0C3LZCsXdzJJSliUWFcm%2FNew%20Opportunity%20_%20Pipeliner%20CRM%20-%20Google%20Chrome%2020.png?alt=media\&token=1a50bd2d-0a31-46c7-8aad-8b8fd40731ef)

#### Use prices from Product Pricelist

When your sales team updates the pricelist frequently or you don´t know the actual price of the product, you can use Pricelist from Pipeliner to get the Prices automatically, by this opportunity attribute: `"product_price_list_id": "id of product pricelist"`

To get a product price list ID use this request

```
GET
{{baseURL}}/entities/ProductPriceLists
```

```json
{
    "closing_date": "2019-01-01",
    "product_price_list_id": "4c4cf9ab-972a-40bb-a749-74fc64289e52",
    "name": "New Opportunity",
    "owner_id": "00000000-0000-0000-0000-000000011a7d",
    "step_id": "de115511-5dc1-46c3-86d9-f714457208dd",
    "is_value_auto_calculate": true,
    "value": {
        "base_value": 100,
        "currency_id": "c4ca4238-a0b9-0382-0dcc-509a6f75849b"
    },
    "account_relations": [
       {
           "account_id": "0bc376a4-c579-413a-9221-e86e4a134766",
           "is_primary": true
           
       }
    ],
    "contact_relations": [
       {
           "contact_id": "02bdc9f6-4dfb-479e-84ba-f6c3b96c39ba",
           "is_primary":true
       }
    ],
    "product_relations" : [
        {
            "product_id": "703c7426-c197-4441-beb7-201609ee47af"
        },
        {
            "product_id": "c4d2428f-f8ef-4f27-abdb-aaf3fe626a89"
        },
        {
            "product_id": "3648bf8a-6ad8-4057-b404-5d01bfac7dff"
        }
    ]
}
```

![Product 1..3 prices in PriceList](https://3470708952-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFpjbhrh1xo0SPAbAc7Ny%2Fuploads%2FejDnKjyBm38SyxPETr2X%2FPrice%20Lists%20_%20Pipeliner%20CRM%20-%20Google%20Chrome%202022-0.png?alt=media\&token=311f18c9-55d9-4036-8b1b-f92416b94b48)

![Prices are automatically popupalted for a specified pricelist](https://3470708952-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFpjbhrh1xo0SPAbAc7Ny%2Fuploads%2F17SAjB1yIVs4VeQRJgHF%2FNew%20Opportunity%20_%20Pipeliner%20CRM%20-%20Google%20Chrome%2020.png?alt=media\&token=de88f97d-a783-47bd-8003-6f94c569f8b2)
