Skip to main content

Create an Inventory Adjustment

Endpoint Overview​

This API endpoint provides a detailed overview of the endpoint responsible for creating an inventory adjustment (starting a stock count) within the Inventory module of the Juleb ERP. Creating one immediately starts it — its lines are generated for the selected product_ids (or all products if omitted) and it moves to the confirm state, ready for counting.

Endpoint Details​

  • Method: POST
  • URL: /api/v1/inventory/inventory-adjustments

Parameters​

  • Path Parameters: None
  • Query Parameters: None

Request Body​

{
"adjustment_type": "quantity",
"name": string,
"company_id": integer,
"product_ids": integer[],
"prefill_counted_quantity": boolean,
"accounting_date": string,
"date": string
}

Field Reference​

FieldTypeRequiredDescription
adjustment_typestringYesOne of quantity, sales, or cost — what aspect of stock is being adjusted.
namestringYesA label for this adjustment/count session.
company_idintegerYesThe company the adjustment belongs to.
product_idsinteger[]NoProduct template IDs to include in the count. If omitted, the adjustment covers all products.
prefill_counted_quantitybooleanNo (default false)Automation field. When true, each line's counted quantity is pre-filled with the current theoretical on-hand quantity (counted). When false, lines start counted at 0 (zero) so you must enter every count manually.
accounting_datestringNoAccounting date to post the resulting stock valuation entries on.
datestringNoThe date of the physical count.

Errors​

  • Product ids {ids} are not found — one or more product_ids didn't match a product template.

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/inventory-adjustments`, {
adjustment_type: 'quantity',
name: 'Cycle count - Branch 1',
company_id: 1,
product_ids: [9123, 9124],
prefill_counted_quantity: true
}, {
headers: {
accept: '*/*',
Authorization: `TOKEN`,
'Content-Type': 'application/json'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error('Error:', error);
});

Response​

{
"data": {
"id": 44,
"name": "Cycle count - Branch 1",
"state": "confirm",
"company_id": 1
}
}