Skip to main content

Create a batch

Endpoint Overview​

This API endpoint provides a detailed overview of the endpoint responsible for creating one or more batches/lots within the Inventory module of the Juleb ERP. The request body supports creating several batches in a single call by providing multiple entries in PickingLines.

Endpoint Details​

  • Method: POST
  • URL: /api/v1/inventory/batch

Parameters​

  • Path Parameters: None
  • Query Parameters: None

Request Body​

The request body must wrap the batch(es) to create under a PickingLines array — at least one entry is required:

{
"PickingLines": [
{
"name": string,
"product_id": integer,
"default_code": string,
"company_id": integer,
"life_date": string,
"production_date": string
}
]
}

Field Reference​

FieldTypeRequiredDescription
namestringYesThe batch/lot number (serial name).
product_idintegerNo*The product this batch belongs to. *Required unless default_code is provided instead.
default_codestringNo*The product's internal reference/code, used to look up product_id when it isn't provided directly.
company_idintegerYesThe company the batch belongs to.
life_datestringNoExpiry date, as a date (YYYY-MM-DD) or date-time string.
production_datestringNoProduction/manufacture date, as a date (YYYY-MM-DD) or date-time string.

At least one of product_id or default_code must resolve to a valid product, otherwise the request fails with product id or default_code is not valid.

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/batch`, {
PickingLines: [
{
name: "api test",
product_id: 7,
company_id: 1,
life_date: "2026-01-01",
production_date: "2023-01-01"
}
]
}, {
headers: {
'accept': '*/*',
'Authorization': `******`,
'Content-Type': 'application/json'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error('Error:', error);
});

Response​

{
"data": {
"id": 43737,
"message_main_attachment_id": null,
"name": "api test",
"ref": null,
"product_id": 7,
"product_uom_id": 1,
"note": null,
"company_id": 1,
"create_uid": 2,
"create_date": "2024-09-03T22:55:05.085Z",
"write_uid": 2,
"write_date": "2024-09-03T22:55:05.085Z",
"life_date": "2026-01-01T00:00:00.000Z",
"use_date": null,
"removal_date": null,
"alert_date": null,
"product_expiry_reminded": null,
"gti_number": null,
"production_date": "2023-01-01T00:00:00.000Z",
"batch_number": null,
"gl_number": null,
"serial_id": null,
"scanned_code": "5555012",
"scanned_code_numeric": null,
"lot_code": "012",
"lot_number": "5555012",
"batch_name": null,
"stock_inventory_tag_id": null,
"is_frozen": null,
"j_batch_qty": 0,
"is_frozen_transfer": null,
"j_life_date_str": "2026-01-01",
"product_package_id": null,
"j_sale_price": null
}
}