Skip to main content

Create a Product Template

Endpoint Overview​

This API endpoint provides a detailed overview of the endpoint responsible for creating a product template within the Inventory module of the Juleb ERP. A product template holds the generic information shared by a product (name, category, pricing, units of measure, tracking, classification, etc.) — the actual sellable variant(s) are managed separately under Product.

Endpoint Details​

  • Method: POST
  • URL: /api/v1/inventory/product-template

Parameters​

  • Path Parameters: None
  • Query Parameters: None

Request Body​

{
"type": "product",
"categ_id": integer,
"name": string,
"list_price": integer,
"taxes_id": integer[],
"supplier_taxes_id": integer[],
"j_active_ingredient": integer[],
"uom_id": integer,
"uom_po_id": integer,
"default_code": string,
"barcode": string,
"tracking": "none",
"gtin": string,
"is_rsd_product": boolean,
"j_name_ar": string,
"active": boolean,
"product_brand_id": integer,
"pos_categ_id": integer,
"j_manufacture_country": integer,
"j_category_2": integer,
"j_category_3": integer,
"j_category_4": integer,
"j_category_5": integer,
"j_category_6": integer,
"j_category_7": integer,
"j_brand": string,
"j_brand_ar": string,
"consumption_rule": "category",
"responsible_id": integer
}

Field Reference​

FieldTypeRequiredDescription
typestringNoProduct type: product, service, or consu. Defaults to product.
categ_idintegerYesProduct Category ID — see Product Category.
namestringYesProduct name.
list_priceintegerNoSales price.
taxes_idinteger[]NoCustomer taxes applied when selling. Defaults to [].
supplier_taxes_idinteger[]NoVendor taxes applied when buying. Defaults to [].
j_active_ingredientinteger[]NoActive Ingredient IDs — see Active Ingredient. Defaults to [].
uom_idintegerNoUnit of Measure ID. Defaults to 1.
uom_po_idintegerNoPurchase Unit of Measure ID. Defaults to 1.
default_codestringNoInternal reference/SKU. Omit or send null/false to auto-generate one.
barcodestringNoProduct barcode.
trackingstringNoStock tracking method. Accepted values are none (no lot/serial tracking) and lot (tracked by batch/lot number, required to use batch/lot_name elsewhere in the API). Defaults to none.
gtinstringNoGS1 GTIN code for the product, used for QR/barcode-based lookups (see POS Order's selectProductByGtin).
is_rsd_productbooleanNoMarks the product as tracked by the external RSD (track-and-trace) system. Defaults to false.
j_name_arstringNoArabic product name.
activebooleanNoWhether the product is active (false archives it). Defaults to true.
product_brand_idintegerNoProduct Brand ID — see Product Brand.
pos_categ_idintegerNoPOS Category ID the product is sold under in the POS app.
j_manufacture_countryintegerNoManufacturing country ID.
j_category_2 – j_category_7integerNoAdditional, business-defined classification category IDs (secondary through seventh category).
j_brandstringNoFree-text brand name.
j_brand_arstringNoFree-text brand name in Arabic.
consumption_rulestringNoHow the product is consumed: product or category. Defaults to category.
responsible_idintegerNoUser ID responsible for the product's logistics.

Response​

  • 201 OK: Successfully created the record.
  • 400 Bad Request: Bad request.
  • 401 Unauthorized: Unauthorized.

Response Body​

{
"data": {
...record fields
}
}

Example​

Request​

const axios = require('axios');
const accountName = process.env.ACCOUNT_NAME;
const apiKey = process.env.API_KEY;

axios.post(`https://${accountName}.juleb.com/api/v1/inventory/product-template`, {
type: 'product',
categ_id: 12,
name: 'Paracetamol 500mg',
list_price: 10,
uom_id: 1,
uom_po_id: 1,
tracking: 'lot',
barcode: '6281006280012',
is_rsd_product: true
}, {
headers: {
accept: '*/*',
Authorization: `TOKEN`,
'Content-Type': 'application/json'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error('Error:', error);
});

Response​

{
"data": {
"id": 9123,
"name": "Paracetamol 500mg",
"categ_id": 12,
"list_price": 10,
"default_code": "PROD9123",
"tracking": "lot",
"barcode": "6281006280012"
}
}