The Warehouses API manages storage depots, central distribution centers (CDs), regional satellite warehouses, transit locations, and physical stock balances mapping directly to SAP Business One OWHS records.
/v1/inventory/warehouses
| Header | Type | Description |
|---|---|---|
Authorization |
string |
Bearer <token> OAuth2 token. |
x-app-stage |
string |
Current tenant stage (dev, staging, prod). |
x-app-uid |
string |
Authenticated user UUID. |
| Parameter | Type | Default | Description |
|---|---|---|---|
companyId |
integer |
Required | Active operating company ID. |
view |
string |
A |
State: A (Active), I (Inactive), D (Trashed), ALL. |
search |
string |
- | Search query for warehouse code or name. |
Retrieve all storage facilities registered for the company.
GET /v1/inventory/warehouses?companyId=1&view=A
200 OK{
"success": true,
"message": "Proceso realizado correctamente",
"data": [
{
"id": 1,
"company_id": 1,
"code": "01",
"name": "ALMACÉN CENTRAL HUACHIPA",
"location": "Av. Las Torres 1000, Lurigancho",
"sap_whs_code": "01",
"branch_id": 1,
"is_main": true,
"is_transit": false,
"is_quarantine": false,
"status": "A",
"created_at": "2026-01-10T10:00:00.000Z"
},
{
"id": 2,
"company_id": 1,
"code": "02",
"name": "ALMACÉN SUCURSAL NORTE",
"location": "Av. Alfredo Mendiola 3600, Independencia",
"sap_whs_code": "02",
"branch_id": 2,
"is_main": false,
"is_transit": false,
"is_quarantine": false,
"status": "A",
"created_at": "2026-01-10T10:00:00.000Z"
}
]
}
GET /v1/inventory/warehouses/1?companyId=1
Queries inventory levels across all active SKUs in this warehouse.
GET /v1/inventory/warehouses/1/stock?companyId=1
200 OK{
"success": true,
"data": [
{
"product_id": 1042,
"sku": "CERV-PIL-355",
"product_name": "CERVEZA PILSEN CALLAO LATA 355ML",
"on_hand": 4500.0,
"committed": 820.0,
"on_order": 1200.0,
"available": 3680.0,
"unit": "UND"
}
]
}
Returns recent rows from SAP ERP gproc.incoming_costs for the warehouse (last 20 days by document date), enriched with product name, document type label, and exclusion flags for cost calculation.
GET /v1/inventory/warehouses/24/incomings?companyId=8
200 OK{
"success": true,
"message": "Ingresos cargados del almacén",
"data": [
{
"id": 12045,
"itemcode": "YIC016123",
"ItemName": "PRODUCTO DEMO",
"documentName": "Recepción",
"cardcode": "P00001",
"cardname": "PROVEEDOR SAC",
"docdate": "2026-11-15",
"createdate": "2026-11-15T10:30:00",
"whscode": "05AYPR1",
"transtype": 20,
"docnum": 1405036,
"docentry": 89856,
"doclinenum": 0,
"quantity": 48,
"price_before_discount": "10.500000",
"price": "10.000000",
"discount": "0.047619",
"total": "480.0000",
"memo": "",
"canceled": "N",
"excluded_from_cost": false
}
]
}
| Code | When |
|---|---|
200 |
List loaded (may be empty array). |
401 |
Missing or invalid Authorization. |
404 |
Company or warehouse not found. |
500 |
ERP connection or query failure. |
Returns rows from gproc.cost_exclusions linked to this warehouse’s incoming cost lines (same 20-day window as incomings).
GET /v1/inventory/warehouses/24/cost-exclusions?companyId=8
200 OK{
"success": true,
"message": "Exclusiones de costo cargadas",
"data": [
{
"id": 501,
"itemcode": "YIC016123",
"ItemName": "PRODUCTO DEMO",
"documentName": "Recepción",
"transtype": 20,
"createdby": 1,
"base_ref": 1405036,
"createdate": "2026-11-16T14:22:00",
"createUser": "jdoe",
"whscode": "05AYPR1",
"docdate": "2026-11-15"
}
]
}
Marks an incoming cost line as excluded from last-cost calculation: inserts gproc.cost_exclusions from inventory transactions, deletes matching gproc.sub_region_costs, and sets gproc.incoming_costs.canceled = 'Y'.
Requires permission to update warehouse master data (same as warehouse PUT).
POST /v1/inventory/warehouses/24/incomings/12045/exclude-from-cost?companyId=8
No request body.
200 OK (first call){
"success": true,
"message": "Entrada excluida del cálculo de último costo",
"data": {
"id": 12045,
"itemcode": "YIC016123",
"excluded_from_cost": true,
"canceled": "Y",
"docnum": 1405036,
"transtype": 20
}
}
200 OK (idempotent){
"success": true,
"message": "La entrada ya está excluida del cálculo de costo",
"data": { "id": 12045, "excluded_from_cost": true, "canceled": "Y" }
}
| Code | When |
|---|---|
200 |
Excluded or already excluded. |
401 |
Missing or invalid Authorization. |
404 |
Company, warehouse, or incoming row not found. |
422 |
Incoming row does not belong to the warehouse (whscode mismatch). |
400 |
No matching oivl transactions or ERP error from exclude pipeline. |
Synchronize warehouse master entities and bin location flags from SAP Business One OWHS.
POST /v1/inventory/warehouses/sync?companyId=1
200 OK{
"success": true,
"message": "Almacenes sincronizados correctamente desde SAP B1",
"data": {
"synced_count": 8,
"updated_count": 2
}
}
POST /v1/inventory/warehouses?companyId=1
Content-Type: application/json
{
"code": "03",
"name": "ALMACÉN DE TRÁNSITO RUTA SUR",
"branch_id": 3,
"is_transit": true,
"is_main": false
}
PUT /v1/inventory/warehouses/3?companyId=1
Content-Type: application/json
{
"name": "ALMACÉN DE TRÁNSITO CHINCHA / PISCO"
}
POST /v1/inventory/warehouses/1/upload-image?companyId=1
Content-Type: multipart/form-data
DELETE /v1/inventory/warehouses/3?companyId=1