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
| Field | Type | Required | Description |
|---|---|---|---|
adjustment_type | string | Yes | One of quantity, sales, or cost — what aspect of stock is being adjusted. |
name | string | Yes | A label for this adjustment/count session. |
company_id | integer | Yes | The company the adjustment belongs to. |
product_ids | integer[] | No | Product template IDs to include in the count. If omitted, the adjustment covers all products. |
prefill_counted_quantity | boolean | No (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_date | string | No | Accounting date to post the resulting stock valuation entries on. |
date | string | No | The date of the physical count. |
Errors
Product ids {ids} are not found— one or moreproduct_idsdidn'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
- NodeJS
- curl
- python
- java
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);
});
curl -X POST \
-H "accept: */*" \
-H "Authorization: ******" \
-H "Content-Type: application/json" \
-d '{
"adjustment_type": "quantity",
"name": "Cycle count - Branch 1",
"company_id": 1,
"product_ids": [9123, 9124],
"prefill_counted_quantity": true
}' \
"https://$ACCOUNT_NAME.juleb.com/api/v1/inventory/inventory-adjustments"
import os
import requests
account_name = os.getenv('ACCOUNT_NAME')
api_key = os.getenv('API_KEY')
url = f'https://{account_name}.juleb.com/api/v1/inventory/inventory-adjustments'
headers = {
'accept': '*/*',
'Authorization': f'******',
'Content-Type': 'application/json'
}
data = {
'adjustment_type': 'quantity',
'name': 'Cycle count - Branch 1',
'company_id': 1,
'product_ids': [9123, 9124],
'prefill_counted_quantity': True
}
response = requests.post(url, headers=headers, json=data)
if response.status_code == 201:
print(response.json())
else:
print(f'Error: {response.status_code}', response.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
public class Main {
public static void main(String[] args) throws Exception {
String accountName = System.getenv("ACCOUNT_NAME");
String apiKey = System.getenv("API_KEY");
String json = "{"
+ "\"adjustment_type\": \"quantity\","
+ "\"name\": \"Cycle count - Branch 1\","
+ "\"company_id\": 1,"
+ "\"product_ids\": [9123, 9124],"
+ "\"prefill_counted_quantity\": true"
+ "}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(new URI("https://" + accountName + ".juleb.com/api/v1/inventory/inventory-adjustments"))
.header("accept", "*/*")
.header("Authorization", "Bearer " + apiKey)
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<String> response = client.send(request, BodyHandlers.ofString());
if (response.statusCode() == 201) {
System.out.println(response.body());
} else {
System.out.println("Error: " + response.statusCode() + ", " + response.body());
}
}
}
Response
{
"data": {
"id": 44,
"name": "Cycle count - Branch 1",
"state": "confirm",
"company_id": 1
}
}