Create Operating Unit
Creates a new operating unit within a branch. Operating units represent operational contexts such as main branch inventory, buffer storage, return processing areas, or temporary event locations.
Request Body
ID of the branch this operating unit belongs to
Operating unit name (max 255 characters)
Operating unit type. Valid values:
BRANCH_MAIN - Main branch operating unit
BRANCH_BUFFER - Branch buffer storage
BRANCH_RETURN - Branch return processing
EVENT_TEMP - Temporary event unit
Start date in YYYY-MM-DD format
End date in YYYY-MM-DD format (must be after or equal to start_date). Used primarily for EVENT_TEMP types.
Whether the operating unit is active
Additional metadata as a JSON object
Response
Created operating unit objectStart date (YYYY-MM-DD format)
End date (YYYY-MM-DD format)
Associated branch details Creation timestamp (ISO 8601 UTC)
Last update timestamp (ISO 8601 UTC)
Example Request
curl -X POST "https://api.sushigo.local/api/v1/operating-units" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"branch_id": 1,
"name": "Main Kitchen",
"type": "BRANCH_MAIN",
"start_date": "2026-03-01",
"is_active": true
}'
const response = await fetch('https://api.sushigo.local/api/v1/operating-units', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json',
'Accept': 'application/json'
},
body: JSON.stringify({
branch_id: 1,
name: 'Main Kitchen',
type: 'BRANCH_MAIN',
start_date: '2026-03-01',
is_active: true
})
});
const data = await response.json();
Example Response
{
"message": "Operating unit created successfully",
"data": {
"id": 5,
"branch_id": 1,
"name": "Main Kitchen",
"type": "BRANCH_MAIN",
"start_date": "2026-03-01",
"end_date": null,
"is_active": true,
"meta": null,
"branch": {
"id": 1,
"name": "Downtown Branch"
},
"created_at": "2026-03-06T14:22:30+00:00",
"updated_at": "2026-03-06T14:22:30+00:00"
}
}
Error Responses
Validation error{
"message": "The given data was invalid.",
"errors": {
"branch_id": ["The branch id field is required."],
"name": ["The name field is required."],
"type": ["The selected type is invalid."]
}
}
Update Operating Unit
Updates an existing operating unit. All fields are optional; only provided fields will be updated.
Path Parameters
Request Body
ID of the branch this operating unit belongs to
Operating unit name (max 255 characters)
Operating unit type (BRANCH_MAIN, BRANCH_BUFFER, BRANCH_RETURN, EVENT_TEMP)
Start date in YYYY-MM-DD format
End date in YYYY-MM-DD format (must be after or equal to start_date)
Whether the operating unit is active
Additional metadata as a JSON object
Response
Updated operating unit object (same structure as create response)
Example Request
curl -X PUT "https://api.sushigo.local/api/v1/operating-units/5" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"name": "Updated Kitchen Name",
"is_active": false
}'
const response = await fetch('https://api.sushigo.local/api/v1/operating-units/5', {
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json',
'Accept': 'application/json'
},
body: JSON.stringify({
name: 'Updated Kitchen Name',
is_active: false
})
});
const data = await response.json();
Example Response
{
"message": "Operating unit updated successfully",
"data": {
"id": 5,
"branch_id": 1,
"name": "Updated Kitchen Name",
"type": "BRANCH_MAIN",
"start_date": "2026-03-01",
"end_date": null,
"is_active": false,
"meta": null,
"branch": {
"id": 1,
"name": "Downtown Branch"
},
"created_at": "2026-03-06T14:22:30+00:00",
"updated_at": "2026-03-06T14:35:10+00:00"
}
}
Error Responses
Operating unit not found{
"message": "Not found"
}
Validation error{
"message": "The given data was invalid.",
"errors": {
"end_date": ["The end date must be a date after or equal to start date."]
}
}
Delete Operating Unit
Soft deletes an operating unit. The unit will be marked as deleted but retained in the database for audit purposes.
Path Parameters
Response
Example Request
curl -X DELETE "https://api.sushigo.local/api/v1/operating-units/5" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Accept: application/json"
const response = await fetch('https://api.sushigo.local/api/v1/operating-units/5', {
method: 'DELETE',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Accept': 'application/json'
}
});
const data = await response.json();
Example Response
{
"message": "Operating unit deleted successfully"
}
Error Responses
Operating unit not found{
"message": "Not found"
}