---
title: create_category
slug: docs/createcategory
docTags: 
createdAt: 2021-08-04T18:23:39.000Z
---

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

# Basic parameters

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

# General Doc Parameters



| Name                     | Type    | Required | Description                                                                                                                 |
| ------------------------ | ------- | -------- | --------------------------------------------------------------------------------------------------------------------------- |
| `category_name`          | string  | true     | The name for the category visible to users                                                                                  |
| `category_top_remark`    | string  | false    | A brief description at the top of the category visible to users                                                             |
| `category_bottom_remark` | string  | false    | A brief description at the bottom of the category visible to users                                                          |
| `category_quota_ordered` | integer | false    | The amount of products within a category that a user can order. The default has no limit.                                   |
| `interchange_category`   | boolean | false    | `True` if only a single product in the category should be able to be orderered. Default is `False`.                         |
| `mandatory_category`     | boolean | false    | `True` if a product needs to be ordered from that category in order for the form to be marked complete. Default is `False`. |



# Example

## Create a new category

This is an example which would create a new category.

### 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_category",
    "group_id": 100909072,
    "doc": {
        "category_name": "Fall Performances",
        "category_top_remark": "Fall Performances are below",
        "category_bottom_remark": "Please note that if you must miss an event, tickets are only transferable to future performances",
        "category_quota_ordered": 12,
        "interchange_category": False,
        "mandatory_category": False
    }
}
```

```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_category",
    "group_id": 100909072,
    "doc": {
        "category_name": "Fall Performances",
        "category_top_remark": "Fall Performances are below",
        "category_bottom_remark": "Please note that if you must miss an event, tickets are only transferable to future performances",
        "category_quota_ordered": 12,
        "interchange_category": False,
        "mandatory_category": False

    }
}

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

```
:::

### Response

```json
{
    'success': true, 
    'doc': {
        'cat_id': 251125, 
        'msg': 'Category created successfully', 
        'msg_type': 'success'
        }
}

```






