---
title: create
slug: docs/1eIW-create
docTags: 
createdAt: 2021-08-04T18:23:39.000Z
---

This call creates a product. The arguments that would be included in the doc are described below:

# Basic parameters

| Name       | Type    | Required | Description                                                        |
| ---------- | ------- | -------- | ------------------------------------------------------------------ |
| `action`   | string  | true     | `create`                                                           |
| `group_id` | integer | true     | This designates which project the action should be applied towards |
| `doc`      | array   | true     | See doc parameters below                                           |

# General Doc Parameters

Note that the descriptions are of the `True` statement. So for instance, `only_one` means that "\[If the variable is passed as True...] Only a single unit can be added per user". The boolean defaults are `False` unless otherwise noted.&#x20;

| Name                          | Type             | Required | Description                                                                                                                                                                                                                             |
| ----------------------------- | ---------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `base_product_type`           | integer          | true     | 1 - event<br />2 - discount<br />3 - session holder<br />4 - session <br />5 - days within a session (these are created automatically, not via the api)<br />6 - subscription<br />7 - merchandise                                      |
| `product_name`                | string           | true     | The name for the product visible to users                                                                                                                                                                                               |
| `product_price`               | float            | true     | The price, which can be zero for any products which are not discounts. Limited to two decimals                                                                                                                                          |
| `cat_id`                      | string           | true     | The category the product appears in                                                                                                                                                                                                     |
| `product_type`                | integer          | false    | This determines whether a product can be added to a cart at either the parent level, the child level, or both:<br />0 - both a parent and child level product, this is the default<br />1 - parent level only<br />2 - child level only |
| `product_start_date`          | string           | false    | The date the product becomes available to users for selection. Unavailable products cannot be triggered or added manually to a user. This is an option for all product types except merchandise                                         |
| `product_end_date`            | string           | false    | The date the product becomes unavailable to users for selection. This is an option for all product types except merchandise                                                                                                             |
| `product_short_remarks`       | string           | false    | The text description presented to users                                                                                                                                                                                                 |
| `location`                    | string           | false    | A text description of location                                                                                                                                                                                                          |
| `internalid`                  | string           | false    | A text field intended for including external codes                                                                                                                                                                                      |
| `misc1`                       | string           | false    | Text field for miscallaneous use                                                                                                                                                                                                        |
| `misc2`                       | string           | false    | A second text field for miscallaneous use                                                                                                                                                                                               |
| `lock_once_funds_allocated`   | boolean          | false    | Locks product if any funds are allocated, useful for partial payments in the context of autobill                                                                                                                                        |
| `lock_after_paid`             | boolean          | false    | Locks product after the product is paid in full. `True` is the default                                                                                                                                                                  |
| `lock_in_cart`                | boolean          | false    | Locks once added to the cart, irrespective of payment status. Typically used for mandatory products which are added automatically                                                                                                       |
| `only_one`                    | boolean          | false    | Only a single unit can be added per user. `True` is the default                                                                                                                                                                         |
| `visible_to_users`            | boolean          | false    | If the product should appear to users for selection. If `False`, it is set as an admin only product. Note that products not visible to users can still be added to users either via triggers or manually. `True` is the default         |
| `force_paid_first`            | boolean          | false    | Payments will be applied towards this product before others. If multiple prodcuts are marked this way, it respects the order in which they appear on the products page                                                                  |
| `quota_cart`                  | integer          | false    | How many of a product can be ordered before it becomes unavialble to users for selection. When a quota is reached, if `allow_waitlist` is `True` a waitlist option will present.                                                        |
| `allow_waitlist`              | boolean          | false    | A waitlist option will appear once the quota is met                                                                                                                                                                                     |
| `waitlist_presentation`       | boolean          | false    | Presents the default text: "Waitlist"                                                                                                                                                                                                   |
| `waitlist_present_text_value` | string           | false    | Include if `waitlist_presentation` is `False`. This is the text presented to the user when the waitlist option is presented to them.                                                                                                    |
| `zero_product_presentation`   | boolean          | false    | Allows you to provide a value to `zero_product_presentation`. Only works if the product price is zero                                                                                                                                   |
| `zero_product_presentation`   | string           | false    | Text presented to users when a product has a zero price. Defaults to $0.                                                                                                                                                                |
| `product_assigned_admins`     | array of strings | false    | Provide an array of admin id's for the admin's you would like assigned to the product. These are visible on the admin management page                                                                                                   |

# Product Specific Parameters

There are some product types that have unique parameters. Make sure to only pass them when you are creating the appropriate product type.&#x20;

## Subscription Parameters

| Name                                  | Type    | Required | Description                                                                                                                                          |
| ------------------------------------- | ------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `recurring_by_user`                   | boolean | false    | The user can choose whether to make this a recurring charge                                                                                          |
| `recurring_by_user_auto_on`           | boolean | false    | This is an opt-out version, where the user has the option to opt-out of a recurring charge                                                           |
| `recurring_allow_user_disable`        | boolean | false    | The user can choose to unsubscribe                                                                                                                   |
| `recurring_enable_autocharge`         | boolean | false    | The system will automatically try to charge the user for the subscription, the user initiates each payment manually for this subscription if `False` |
| `recurring_allow_upgrade`             | boolean | false    | Allows the user to upgrade to different subscription level                                                                                           |
| `recurring_allow_auto_upgrade`        | boolean | false    | Allows the product to be automatically upgraded to a higher level after a certain number of instances                                                |
| `recurring_upgrade_prorate`           | boolean | false    | Enable prorating for incomplete subscription periods                                                                                                 |
| `recurring_allow_autorenew`           | boolean | false    | The subscription will automatically renew at each renewal period                                                                                     |
| `recurring_limit_autorenew`           | boolean | false    | Limits the number of times a subscription will renew                                                                                                 |
| `recurring_limit_autorenew_num_field` | boolean | false    | If `recurring_limit_autorenew` is `True`, then this is number of times it should renew automatically                                                 |

## Session Parameters

| Name                       | Type    | Required | Description                                                                                                            |
| -------------------------- | ------- | -------- | ---------------------------------------------------------------------------------------------------------------------- |
| `session_start_date`       | string  | true     | The start time of the session in the form `"yyyy-mm-dd"`                                                               |
| `session_end_date`         | string  | true     | The end time of the session in the form `"yyyy-mm-dd"`. Must be greater than or equal to `product_activity_start_date` |
| `disable_time_conflict`    | boolean | false    | Users will be able to select this product despite time conflicts                                                       |
| `min_session_num`          | integer | false    | The minimum amount of sessions a user must select                                                                      |
| `max_session_num`          | integer | false    | The maximum amount of sessions a user can select                                                                       |
| `allow_partial_enrollment` | boolean | false    | Allows a user to select days within a session                                                                          |
| `min_partial_selection`    | integer |          | If `allow_partial_enrollment` is `True`, the minimum number of days a user can select                                  |
| `max_partial_selection`    |         |          | If `allow_partial_enrollment` is `True`, the maximum number of days a user can select                                  |

## Event Parameters

| Name                          | Type    | Required | Description                                                                                                          |
| ----------------------------- | ------- | -------- | -------------------------------------------------------------------------------------------------------------------- |
| `product_activity_start_date` | string  | true     | The start time of the event in the form `"yyyy-mm-dd"`                                                               |
| `product_activity_end_date`   | string  | true     | The end time of the event in the form `"yyyy-mm-dd"`. Must be greater than or equal to `product_activity_start_date` |
| `disable_time_conflict`       | boolean | false    | Users will be able to select this product despite time conflicts                                                     |

## Discount Parameters

| Name                | Type    | Required | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| ------------------- | ------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `percent_product`   | boolean | true     | Allows you to provide a percentage value as a string to `product_price`, for example `"33.33"`. Note that all values passed to `product_price`, regardless if it's a fixed value or a percentage, will be interpreted as negative (ie -1 \* \|`product_price`\|)                                                                                                                                                                                                                                                               |
| `selected_products` | array   | false    | Allows you to provide a list with two optional nested lists of either product id's (`product`), category id's (`category`), or both. The id's you include indicate towards which product or category a discount applies. Id's can be found in the back end of the system by editing either the product or category and looking in the top right of the window.                                                                                                                                                                 |
| `products`          | array   | false    | This is a list of product id's nested within `selected_products`. Including product id's ensures the discount applies towards the product's specified. The only exception is if the product belongs to a category whose id is included in `category`. In this case, Including a product id will *exclude&#x20;*&#x74;hat product, while ensuring the discount will apply to the *remaining* products within that category. <br />For example: <br />"selected\_products": \{<br />    "products": \{ "3625251": True} <br />}  |
| `categories`        | array   | false    | This is a list of category id's nested within `selected_products`. Including category id's ensures that the the discount will apply towards all products within those categories, unless you choose to exclude a product by providing it's id in `product`.<br />For example: <br />"selected\_products": \{<br />   "categories": \{"25141"\:True }    <br />}                                                                                                                                                                |

#

# Example

## Create a new product

This is an example which would create a new product.

### Call

:::CodeblockTabs
```curl
curl -X POST "https://www.regpack.com/reg/api2/products/" \ 
     -H "Content-Type: application/json" \ 
     -H "Accept: application/json" \ 
     -H "Api-Id: 15263" \ 
     -H "Api-user: api_admin@regpacks.com" \ 
     -H "Api-Token: cd2e514f-7gab-3cde-62fg-51abcd4e7362" \ 
     -d '{
    "action": "create",
    "group_id": 100909072,
    "doc": {
        "base_product_type": 1,
        "product_name": "The Village Vanguard Presents: Bill Evans Trio",
        "product_price": "10",
        "product_activity_start_date": "1961-06-21",
        "product_activity_end_date": "1961-06-21",
        "product_short_remarks": "This event will be recorded for later release"
    }
}
```

```python
import requests
import json
status_endpoint = https://www.regpack.com/reg/api2/products/
headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Api-Id": "15263",
    "Api-user": "api_admin@regpacks.com",
    "Api-Token": "cd2e514f-7gab-3cde-62fg-51abcd4e7362",
}

payload = {
    "action": "create",
    "group_id": 100909072,
    "doc": {
        "base_product_type": 1,
        "product_name": "The Village Vanguard Presents: Bill Evans Trio",
        "product_price": "10",
        "product_activity_start_date": "1961-06-21",
        "product_activity_end_date": "1961-06-21",
        "product_short_remarks": "This event will be recorded for later release"

    }
}

create_product_json = json.dumps(payload)
create_product_response = requests.post(url=product_endpoint,
                                        data=create_product_json,
                                        headers=headers,
                                        timeout=10)

```
:::

### Response

```json
{
    "msg": "Product created successfully.",
    "msg_type": "info",
    "success": true
}
```






