Skip to main content

List Users in Operating Unit

Retrieves a paginated list of users assigned to a specific operating unit, including their roles.

Path Parameters

id
integer
required
Operating unit ID

Query Parameters

per_page
integer
default:"15"
Number of items per page (1-100)

Response

data
array
Array of user objects
id
integer
User ID
name
string
User’s full name
email
string
User’s email address
roles
array
Array of role objects assigned to the user
id
integer
Role ID
name
string
Role name
pivot
object
Pivot table data for the user-operating unit relationship
operating_unit_id
integer
Operating unit ID
user_id
integer
User ID
assignment_role
string
Role specific to this assignment
is_active
boolean
Whether the assignment is active
meta
object
Additional assignment metadata
created_at
string
Assignment creation timestamp
updated_at
string
Assignment last update timestamp
current_page
integer
Current page number
per_page
integer
Items per page
total
integer
Total number of users
last_page
integer
Last page number

Example Request

curl -X GET "https://api.sushigo.local/api/v1/operating-units/1/users?per_page=10" \
  -H "Accept: application/json"

Example Response

{
  "data": [
    {
      "id": 3,
      "name": "John Smith",
      "email": "[email protected]",
      "roles": [
        {
          "id": 2,
          "name": "inventory-manager"
        }
      ],
      "pivot": {
        "operating_unit_id": 1,
        "user_id": 3,
        "assignment_role": null,
        "is_active": true,
        "meta": null,
        "created_at": "2026-02-10T08:15:00+00:00",
        "updated_at": "2026-02-10T08:15:00+00:00"
      }
    }
  ],
  "current_page": 1,
  "per_page": 10,
  "total": 1,
  "last_page": 1
}

Error Responses

404
object
Operating unit not found
{
  "message": "Not found"
}

Add User to Operating Unit

Assigns a user to an operating unit. Users must be assigned to an operating unit to perform inventory operations within that unit.

Path Parameters

id
integer
required
Operating unit ID

Request Body

user_id
integer
required
ID of the user to assign to the operating unit

Response

data
object
Assignment confirmation
message
string
Success message
operating_unit
object
Operating unit summary
id
integer
Operating unit ID
name
string
Operating unit name
type
string
Operating unit type
user
object
User summary
id
integer
User ID
name
string
User name
email
string
User email
status
integer
HTTP status code (200)
meta
object
Response metadata

Example Request

curl -X POST "https://api.sushigo.local/api/v1/operating-units/1/users" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "user_id": 3
  }'

Example Response

{
  "data": {
    "message": "User added to operating unit successfully",
    "operating_unit": {
      "id": 1,
      "name": "Main Kitchen",
      "type": "BRANCH_MAIN"
    },
    "user": {
      "id": 3,
      "name": "John Smith",
      "email": "[email protected]"
    }
  },
  "status": 200,
  "meta": {}
}

Error Responses

404
object
Operating unit or user not found
{
  "message": "Not found"
}
409
object
User already assigned to operating unit
{
  "status": 409,
  "message": "User is already assigned to this operating unit",
  "errors": []
}
422
object
Validation error
{
  "message": "The given data was invalid.",
  "errors": {
    "user_id": ["The user id field is required."]
  }
}

Remove User from Operating Unit

Removes a user assignment from an operating unit. This prevents the user from performing operations in this specific operating unit.

Path Parameters

id
integer
required
Operating unit ID
userId
integer
required
User ID to remove from the operating unit

Response

data
object
Removal confirmation
message
string
Success message
status
integer
HTTP status code (200)
meta
object
Response metadata

Example Request

curl -X DELETE "https://api.sushigo.local/api/v1/operating-units/1/users/3" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json"

Example Response

{
  "data": {
    "message": "User removed from operating unit successfully"
  },
  "status": 200,
  "meta": {}
}

Error Responses

404
object
Operating unit not found or user not assigned
{
  "status": 404,
  "message": "User is not assigned to this operating unit",
  "errors": []
}

Build docs developers (and LLMs) love