Branches (Branch) represent operational warehouses, regional distribution centers (CDs), and retail store locations. They tie directly into SAP Business One warehouses (OWHS), delivery zones, and fiscal receipt series (NNM1).
/v1/base/master/branchs
| 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 | Current operational company ID. |
view |
string |
A |
State filter: A (Active), I (Inactive), D (Trashed), ALL (All). |
search |
string |
- | Search query by code or name. |
Retrieve branches configured for the company.
GET /v1/base/master/branchs?companyId=1&view=A
200 OK{
"success": true,
"message": "Proceso realizado correctamente",
"data": [
{
"id": 1,
"company_id": 1,
"code": "SUC-CENTRAL",
"name": "PLANTA Y CD HUACHIPA",
"address": "Av. Las Torres 1000, Lurigancho-Chosica",
"whs_code": "01",
"sap_bpl_id": 1,
"phone": "+5113620000",
"latitude": -12.012543,
"longitude": -76.924876,
"status": "A"
}
]
}
Returns branches structured with subordinate warehouses and satellite points.
GET /v1/base/master/branchs/with-children?companyId=1
Lightweight dataset for forms, order entry, and filter select elements.
GET /v1/base/master/branchs/simple-list?companyId=1
Query live SAP Business One branch profile.
GET /v1/base/master/branchs/1/sap-branch-details?companyId=1
Fetch commercial distribution zones assigned to this branch in SAP B1.
GET /v1/base/master/branchs/1/sap-zones-for-branch?companyId=1
Fetch authorized electronic invoice and receipt series assigned to this branch (B001, F001, T001).
GET /v1/base/master/branchs/1/sap-receipt-series?companyId=1
GET /v1/base/master/branchs/config?companyId=1
POST /v1/base/master/branchs/1/upload-image?companyId=1
Content-Type: multipart/form-data
POST /v1/base/master/branchs?companyId=1
PUT /v1/base/master/branchs/1?companyId=1
DELETE /v1/base/master/branchs/1?companyId=1
PUT /v1/base/master/branchs/1/restore?companyId=1
On create, update, delete, and restore, GOAL pushes extension fields to SAP dbo.OLCT when a row is found by, in order: CeDivision = branches.code, then Code = branches.remote_id, then Location = branches.name (trimmed). The sync also sets CeDivision on the matched OLCT row to branches.code. GOAL is saved even if OLCT sync fails; the API message may include (OLCT: …) and data.olct_sync when sync ran.
Example update response when OLCT sync ran:
{
"success": true,
"message": "Registro se actualizó correctamente",
"data": {
"branch": { "id": 1, "code": "IC", "sub_region_id": 42, "remote_id": "01" },
"olct_sync": {
"success": true,
"sync": { "updated": ["IC"], "remote_codes": { "IC": "01" } }
}
}
}
Branch payloads may include:
| Field | Description |
|---|---|
sub_region_id |
GOAL territory level 2 (territories.id) for SAP sub_region_id on OLCT |
cost_price_list_id |
GOAL price list; remote_id maps to OLCT cost_price_list_id |
remote_id |
Set after sync: SAP OLCT.Code (match key: branches.code = OLCT.CeDivision) |
Updates native dbo.OLCT rows resolved by branch code / remote_id / name (see §6), setting GOAL extension columns (region_id, sub_region_id, cost_price_list_id) from the branch's sub-region hierarchy and cost list.
POST /v1/base/master/branchs/sync-to-sap
Content-Type: application/json
{
"companyId": 19,
"branchIds": [12, 15]
}
Omit branchIds to sync all branches for the company.
200 OK{
"success": true,
"message": "Sincronización OLCT: 2 actualizadas, 0 sin fila OLCT",
"data": {
"updated": ["IC", "NZ"],
"skipped": [],
"errors": [],
"remote_codes": { "IC": "01", "NZ": "02" }
},
"stage": "dev"
}