SeloraXDEVELOPERS

Staff & Admins

Staff API

Access store staff (admin) data for the authenticated store. Use this to list team members, their roles, and contact details — useful for salary/expense mapping, task assignment, and team management integrations.

List Staff

Retrieve a paginated list of staff members assigned to the store.

GET /api/apps/v1/staff

Authentication

Required. Must include valid app credentials.

Scope

read:staff

Query Parameters

ParameterTypeDefaultDescription
pageinteger1Page number
limitinteger50Items per page (max 250)
role_idinteger--Filter by role ID (returns only staff who have this role, but shows all their roles)

Example Request

curl -X GET "https://api.selorax.io/api/apps/v1/staff?page=1&limit=50" \
  -H "Authorization: Bearer <token>"

Filter by role:

curl -X GET "https://api.selorax.io/api/apps/v1/staff?role_id=3" \
  -H "X-Client-Id: sx_app_..." \
  -H "X-Client-Secret: sx_secret_..." \
  -H "X-Store-Id: 22"

Response

{
  "data": [
    {
      "id": 45,
      "name": "Rahim Ahmed",
      "email": "[email protected]",
      "phone": "+88017XXXXXXXX",
      "designation": "Operations Manager",
      "role": "admin",
      "roles": [
        { "role_id": 3, "name": "Manager" },
        { "role_id": 5, "name": "Order Processing" }
      ],
      "created_at": "2025-03-10T08:00:00.000Z"
    },
    {
      "id": 52,
      "name": "Fatima Begum",
      "email": "[email protected]",
      "phone": "+88018XXXXXXXX",
      "designation": "Customer Support",
      "role": "admin",
      "roles": [
        { "role_id": 4, "name": "Support Agent" }
      ],
      "created_at": "2025-04-20T10:30:00.000Z"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 50,
    "total": 2
  },
  "status": 200
}

Response Fields

FieldTypeDescription
idintegerStaff member's user ID
namestring or nullFull name
emailstring or nullEmail address
phonestring or nullPhone number
designationstring or nullJob title / designation
rolestringStore-level role assignment (e.g. admin)
rolesarrayAll assigned roles. Each has role_id (integer) and name (string). Empty array [] if no roles assigned.
created_atstring (ISO 8601)When the staff account was created

Roles vs Role

The role field is the legacy store-level assignment (from store_admins_link). The roles array contains the granular role assignments from the admin roles system. A staff member can have multiple roles.

Node.js Example

const response = await fetch(
  "https://api.selorax.io/api/apps/v1/staff",
  { headers: { Authorization: "Bearer sx_at_..." } }
);
const { data, pagination } = await response.json();
console.log(`${pagination.total} staff members`);
data.forEach(s => {
  const roleNames = s.roles.map(r => r.name).join(", ") || "No roles";
  console.log(`${s.name}${roleNames}`);
});

Python Example

import requests
 
response = requests.get(
    "https://api.selorax.io/api/apps/v1/staff",
    headers={"Authorization": "Bearer sx_at_..."},
    params={"limit": 100},
)
data = response.json()
for staff in data["data"]:
    roles = ", ".join(r["name"] for r in staff["roles"]) or "No roles"
    print(f"{staff['name']} ({staff['designation']}) — {roles}")

Get Staff Member

Retrieve a single staff member by their user ID.

GET /api/apps/v1/staff/:id

Authentication

Required. Must include valid app credentials.

Scope

read:staff

Path Parameters

ParameterTypeDescription
idintegerStaff member's user ID

Example Request

curl -X GET "https://api.selorax.io/api/apps/v1/staff/45" \
  -H "Authorization: Bearer <token>"

Response

{
  "data": {
    "id": 45,
    "name": "Rahim Ahmed",
    "email": "[email protected]",
    "phone": "+88017XXXXXXXX",
    "designation": "Operations Manager",
    "role": "admin",
    "roles": [
      { "role_id": 3, "name": "Manager" },
      { "role_id": 5, "name": "Order Processing" }
    ],
    "created_at": "2025-03-10T08:00:00.000Z"
  },
  "status": 200
}

Error Responses

CodeStatusMeaning
invalid_token401Token is expired or invalid
insufficient_scope403App does not have read:staff scope

If the staff member does not exist or does not belong to the authenticated store:

{
  "message": "Staff member not found.",
  "status": 404
}