POST
Categories.Add
Create a product category in ec_categories. Matches the product-report Categories tab add form. Use parent=0 for a main category, or a parent category id for a subcategory. Child categories inherit the parent type.
Permissions
- User must be logged in with a valid bearer token.
- The user must be from the same company domain as the request Host (call the API on that account subdomain or allowed custom domain). A token from another company returns success=0, error user_not_in_company.
- Returned or changed records are limited by the user permissions, team access, folder access, and account settings.
Action
- Creates a Categories record or sends the requested data after validation.
Push Service
Pushes event categories.created to users who should see this change.
Automation
No automation is run for this function.
Special Instructions
- Send the bearer token on protected calls with Authorization: Bearer YOUR TOKEN.
- On a company subdomain (e.g. https://{user_domain}.bull36.com) the user must match that Host — Login and protected APIs reject another company with success=0, error user_not_in_company. On a main brand host (bull36.com, biz1.co.il, mastrocrm.com, …) the company domain gate is skipped.
- Send parameters as POST body fields exactly as documented.
- Send date/time values in UTC Y-m-d H:i:s format when a date or datetime field is used.
Required Parameters
| Name | Type | Sample | Explanation |
|---|---|---|---|
categorypost | string | Membership | Category title. Aliases: name, category_name, title. |
Optional Parameters
| Name | Type | Sample | What it gives |
|---|---|---|---|
descriptionpost | string | Membership products | Category description. |
parentpost | int | 0 | Parent category id. 0 creates a top-level category. |
imagepost | string | biz1upload/site/demo.png | Stored image path. Upload files with Files.Upload first when needed. |
typepost | string | products | products or insurance. Alias: insurance_prod_cate=1 sets insurance. |
in_stockpost | int | 1 | In-stock flag. Defaults to 1. |
team_memberpost | json | [47,48] | JSON array of team member ids. |
custom_field_listpost | json | [] | JSON custom field definitions for this category. |
discountpost | int | 0 | Max-discount enabled flag. Alias: max_discount_val. |
max_discountpost | number | 10 | Max discount amount/percent. Alias: discount_val. |
discount_typepost | string | percentage | Discount type when max discount is enabled. |
invoice_israel_categorypost | string | 00000 | Israel invoice category code when localization supports it. |
order_catpost | int | 1 | Optional display order. Server sets next order when omitted. |
Authentication
Send the bearer token returned by Login in the request header. The user must be from the same company domain as this Host — a token from another company is rejected (user_not_in_company).
Authorization: Bearer YOUR TOKEN
Sample Request
{
"url": "\/app\/Categories.Add",
"method": "POST",
"headers": {
"Authorization": "Bearer YOUR TOKEN"
},
"body": {
"category": "Membership",
"description": "Membership products",
"parent": "0",
"type": "products"
},
"url_user": "https:\/\/{user}.bull36.com\/app\/Categories.Add",
"url_domain": "https:\/\/{domain}\/app\/Categories.Add"
}Endpoint
POST /app/Categories.Add
POST https://{user}.bull36.com/app/Categories.Add
POST https://{domain}/app/Categories.AddSample Output
{
"success": 1,
"id": "123",
"category_id": "123",
"message": "Category added successfully.",
"automation_event": null,
"socket_event": "categories.created"
}JavaScript Example
const token = 'YOUR TOKEN';
const body = new URLSearchParams({
category: 'Membership',
description: 'Membership products',
parent: '0',
type: 'products'
});
const res = await fetch('/app/Categories.Add', { method: 'POST', headers: { Authorization: 'Bearer ' + token }, body });
const data = await res.json();
console.log(data);Error Example
{
"success": "0",
"message": "Missing required parameter: category"
}