The Product Accounting Groups API manages the financial and General Ledger (GL) categorization of inventory items. In the GOAL and SAP Business One (SB1) architecture, each item group maps directly to SAP's OITB table (ItmsGrpCod / ItmsGrpNam), determining the automated debit/credit accounts for inventory balances, cost of goods sold (COGS), price variances, purchase offsets, and exchange rate gains/losses.
/v1/inventory/master/product-accounting-groupsApp\Http\Controllers\V1\Backend\Inventory\Master\ProductAccountingGroupControllerDomain\Inventory\Master\ProductAccountingGroup\Actions\*, Domain\Sync\Master\SyncProductAccountingGroupFromSapActionApp\Models\Inventory\Master\ProductAccountingGroup (product_accounting_groups)App\Models\SB1\Inventory\Master\SAPProductAccountingGroup (OITB)Authorization: Bearer <jwt-token>
x-app-stage: <stage-identifier>
x-app-uid: <application-uuid>
Content-Type: application/json
Accept: application/json
| Parameter | Type | Required | Description |
|---|---|---|---|
companyId |
integer |
Yes | Multi-tenant company context identifier (company-validator / company_id). |
| Method | Endpoint | Description |
|---|---|---|
GET |
/v1/inventory/master/product-accounting-groups |
List accounting groups with pagination, search, and GL accounts |
POST |
/v1/inventory/master/product-accounting-groups |
Create a new item accounting group |
POST |
/v1/inventory/master/product-accounting-groups/sync-sap |
Synchronize all item groups and GL definitions from SAP B1 (OITB) |
GET |
/v1/inventory/master/product-accounting-groups/{id} |
Get item accounting group details by ID |
PUT |
/v1/inventory/master/product-accounting-groups/{id} |
Update item accounting group attributes and GL account codes |
DELETE |
/v1/inventory/master/product-accounting-groups/{id} |
Soft delete an item accounting group |
GET /v1/inventory/master/product-accounting-groups
Retrieves a paginated list of product accounting groups for the current company.
| Parameter | Type | Required | Description |
|---|---|---|---|
companyId |
integer |
Yes | Company ID |
page |
integer |
No | Current page number (Default: 1) |
per_page |
integer |
No | Rows per page (Default: 15) |
query |
string |
No | Text search across group code or name |
status |
string |
No | Filter by active status: A (Active), I (Inactive) |
200 OK{
"success": true,
"message": "Operación exitosa.",
"data": {
"current_page": 1,
"data": [
{
"id": 1,
"uuid": "1fbf860e-a50e-454a-bb03-9b11cb90c308",
"company_id": 10,
"code": "100",
"name": "BEBIDAS Y GASEOSAS",
"remote_id": "100",
"status": "A",
"locked": "N",
"balance_inventory_account": "201111",
"sale_cost_account": "691111",
"transfer_account": "201119",
"revenues_account": "701111",
"variance_account": "611111",
"decrease_account": "659111",
"increase_account": "759111",
"return_account": "709111",
"expenses_account": "659112",
"purchase_account": "601111",
"purchase_return_account": "609111",
"purchasing_offset_account": "611112",
"created_at": "2026-01-15T08:00:00.000000Z",
"updated_at": "2026-03-20T12:00:00.000000Z"
}
],
"total": 1,
"per_page": 15,
"last_page": 1
}
}
POST /v1/inventory/master/product-accounting-groups
Manually creates an item accounting group when not synchronizing from ERP.
{
"code": "105",
"name": "CONFITERIA Y DULCES",
"status": "A",
"balance_inventory_account": "201112",
"sale_cost_account": "691112",
"revenues_account": "701112",
"variance_account": "611112",
"purchase_account": "601112"
}
| Field | Type | Required | Description |
|---|---|---|---|
code |
string |
Yes | Unique group code (corresponds to ItmsGrpCod in SAP B1) |
name |
string |
Yes | Accounting group description |
status |
string |
No | State code: 'A' (Active) or 'I' (Inactive). Default: 'A' |
balance_inventory_account |
string |
No | General Ledger balance inventory account |
sale_cost_account |
string |
No | General Ledger cost of goods sold account |
revenues_account |
string |
No | General Ledger revenue account |
variance_account |
string |
No | Cost variance account |
purchase_account |
string |
No | Direct purchase account |
201 Created{
"success": true,
"message": "Grupo contable creado exitosamente.",
"data": {
"id": 2,
"uuid": "4c9d57a2-bb12-4fe1-9f9b-1d7c0f18d721",
"company_id": 10,
"code": "105",
"name": "CONFITERIA Y DULCES",
"status": "A",
"balance_inventory_account": "201112",
"sale_cost_account": "691112",
"revenues_account": "701112"
}
}
POST /v1/inventory/master/product-accounting-groups/sync-sap
Invokes SyncProductAccountingGroupFromSapAction to pull all item groups from SAP Business One's OITB table into GOAL's PostgreSQL database for the current company. Updates existing groups by code or inserts newly configured groups.
| Parameter | Type | Required | Description |
|---|---|---|---|
companyId |
integer |
Yes | Company ID |
200 OK{
"success": true,
"message": "Grupos contables de productos sincronizados con SAP correctamente.",
"data": {
"synced_count": 14,
"created_count": 2,
"updated_count": 12
}
}
GET /v1/inventory/master/product-accounting-groups/{id}
Returns the full GL account configuration for a single group.
| Parameter | Type | Required | Description |
|---|---|---|---|
id |
integer |
Yes | Accounting group ID |
200 OK{
"success": true,
"message": "Operación exitosa.",
"data": {
"id": 1,
"uuid": "1fbf860e-a50e-454a-bb03-9b11cb90c308",
"company_id": 10,
"supplier_id": 42,
"supplier": {
"id": 42,
"code": "P-001",
"name": "Proveedor demo"
},
"code": "100",
"name": "BEBIDAS Y GASEOSAS",
"balance_inventory_account": "201111",
"sale_cost_account": "691111",
"transfer_account": "201119",
"revenues_account": "701111",
"variance_account": "611111",
"decrease_account": "659111",
"increase_account": "759111",
"return_account": "709111",
"expenses_account": "659112",
"price_difference_account": "659113",
"exchange_rate_differences_account": "776111",
"balance_account": "201111",
"purchase_account": "601111",
"purchase_return_account": "609111",
"purchasing_offset_account": "611112",
"status": "A",
"sales_purchasing_accounts": [
{
"internal_field_id": "sale_cost_account",
"display_name": "Cuenta Costo de Venta",
"account_code": "6911125",
"account_name": "Costo de ventas — ejemplo"
}
],
"stock_ledger_accounts": [
{
"internal_field_id": "balance_inventory_account",
"display_name": "Cuenta Saldo Inventario",
"account_code": "2011125",
"account_name": "Mercaderías — ejemplo"
}
]
}
}
sales_purchasing_accounts and stock_ledger_accounts are row lists for the product-accounting-group detail tabs. Each row: internal_field_id (GOAL column), display_name (UI label), account_code (SB1 AcctCode), account_name from OACT for the company SB1 connection (empty when SB1 is unavailable or the code is missing).
PUT /v1/inventory/master/product-accounting-groups/{id}
Modifies group description or accounts.
{
"name": "BEBIDAS Y REFRESCOS INDUSTRIALES",
"status": "A",
"supplier_id": 42,
"balance_inventory_account": "201111",
"sale_cost_account": "691111"
}
| Field | Type | Required | Description |
|---|---|---|---|
supplier_id |
integer\|null |
No | Default goods supplier for new/edited products when this accounting group (grupo de artículos) is selected. Must belong to the same company_id. |
200 OK{
"success": true,
"message": "Grupo contable actualizado correctamente.",
"data": {
"id": 1,
"code": "100",
"name": "BEBIDAS Y REFRESCOS INDUSTRIALES",
"status": "A"
}
}
DELETE /v1/inventory/master/product-accounting-groups/{id}
Soft deletes an accounting group. Products linked to this group will retain foreign key integrity if soft-deleted, but new products cannot be assigned to it.
200 OK{
"success": true,
"message": "Grupo contable eliminado correctamente.",
"data": true
}
| Status Code | Reason | Example Response |
|---|---|---|
401 Unauthorized |
Missing or invalid Bearer token | {"success": false, "message": "Unauthenticated."} |
404 Not Found |
Group ID not found or belongs to another company | {"success": false, "message": "Grupo contable no encontrado."} |
422 Unprocessable |
Validation failed or duplicate code | {"success": false, "message": "El código del grupo ya está registrado.", "errors": {"code": ["..."]}} |
500 Server Error |
Database or SAP B1 connection failure | {"success": false, "message": "Error al conectar con SAP Business One."} |