Staff and Roles
Hyvä POS is on the App Store
The free app is out for iPhone, iPad and Mac: install it from the App Store, connect your Magento store and sell. PRO, the Magento module with a license per terminal, follows shortly. News and pricing are at hyva.io/pos.
POS staff are their own entity (hyva_pos_staff), separate from Magento admin users: a cashier signs in on the register with email + passcode and gets a role whose permission keys gate what the app lets them do. Merchants manage staff and roles in the admin; the device consumes them through the terminal config payload and the authentication endpoints below.
| Method | Route | ACL | Purpose |
|---|---|---|---|
GET |
/V1/pos/staff · /:staffId |
Hyva_Pos::staff_manage |
List (searchCriteria) and fetch staff |
POST / PUT |
/V1/pos/staff · /:staffId |
Hyva_Pos::staff_manage_edit |
Create / update |
DELETE |
/V1/pos/staff/:staffId |
Hyva_Pos::staff_manage_edit |
Delete |
GET |
/V1/pos/staff/:staffId/locations |
Hyva_Pos::staff_manage |
Locations the staff member may work at |
POST / DELETE |
/V1/pos/staff/:staffId/locations · /:locationId |
Hyva_Pos::staff_manage_edit |
Assign / unassign a location |
POST |
/V1/pos/staff/authenticate |
Hyva_Pos::staff_manage |
Email + passcode login |
POST |
/V1/pos/staff/session/validate |
Hyva_Pos::staff_manage |
Validate a session token |
POST |
/V1/pos/staff/:staffId/unlock |
Hyva_Pos::staff_manage_edit |
Clear a login lockout early |
GET |
/V1/pos/roles · /:roleId |
Hyva_Pos::staff_roles |
List (searchCriteria) and fetch roles |
POST / PUT / DELETE |
/V1/pos/roles · /:roleId |
Hyva_Pos::staff_roles_manage |
Create / update / delete |
Staff
Create and update take the entity wrapped in a staff key:
{
"staff": {
"first_name": "Anna",
"last_name": "de Vries",
"email": "anna@example.com",
"passcode": "482913",
"role_id": 2,
"all_locations": false,
"is_active": true
}
}
passcodeis write-only: it is bcrypt-hashed on save, and the data interface has no getter, so no read endpoint returns it. The staff rows in the terminal config payload strip the hash too.staff_codeis a server-generated 5-character identifier used for receipt-side staff identification (when the location's staff-name format isstaff_id); it is stable for the lifetime of the row.all_locations: truebypasses the per-location assignments below.
Errors: 404 unknown staff id, 400 on failed saves.
Passcode Watermark
Every passcode change stamps passcode_updated_at (UTC). Devices cache credentials so cashiers can sign in offline; they store this watermark alongside the cached passcode and compare it against the value in each synced staff row. A newer server-side watermark invalidates the cache and forces one online re-authentication. If you change passcodes through the API, do not set passcode_updated_at yourself; the module maintains it. A passcode change also moves the heartbeat's config_hash and staff_hash, so a register pulls the new staff rows at its next heartbeat.
Location Assignments
GET /V1/pos/staff/:staffId/locations returns the assigned location rows. Assign with POST /V1/pos/staff/:staffId/locations and body { "locationId": 1 }; unassign with DELETE /V1/pos/staff/:staffId/locations/:locationId. Both return true. Assigning a location the staff member already has leaves the row as it is, and unassigning one they do not have changes nothing. A staff member appears in a terminal's config payload when they are assigned to its location or have all_locations.
Authentication (POST /V1/pos/staff/authenticate)
Called by the register when a cashier signs in with email + passcode (the terminalId records which register the session belongs to):
On success the server creates a session row and returns it with the staff record and role embedded:
{
"session_id": 918,
"staff_id": 7,
"staff": {
"staff_id": 7,
"staff_code": "K4T2N",
"first_name": "Anna",
"last_name": "de Vries",
"email": "anna@example.com",
"passcode_updated_at": "2026-08-01 10:22:35",
"role_id": 2,
"all_locations": false,
"is_active": true
},
"role": { "role_id": 2, "name": "Cashier", "permissions": "{\"place_orders\":true,\"accept_cash\":true}", "is_active": true },
"token": "wJd8...64-character-random-string...Qz",
"expires_at": "2026-09-11 09:14:02"
}
Tokens are 64 random characters and expire after 30 days. Failures return 401 with Invalid credentials., the same message for unknown email and wrong passcode.
Session Storage
From module 1.7.0, hyva_pos_staff_session.token holds the SHA-256 digest of the token. The token itself is in the authenticate answer and is kept only by the register. The update converts the sessions open at the time, so they keep working, and deletes sessions that expired more than a day ago. Run setup:upgrade with the store in maintenance mode.
- A staff member's sessions end when their passcode is changed, when they are deactivated and when they are deleted, in the admin and over REST. The register asks for the passcode again.
- The cron job
hyva_pos_purge_expired_staff_sessions(04:15, default group) deletes the sessions whoseexpires_atpassed more than a day ago. A session that expired within the last day stays, so the register is told it expired rather than that nobody is signed in. - To put a store back on 1.6.0, empty
hyva_pos_staff_session(TRUNCATE TABLE hyva_pos_staff_session;, with the table prefix if the store has one) before 1.6.0 serves requests. Staff members then sign in again at the register.
Login Lockout
Failed attempts are counted per staff member (the count is kept until a day has passed without a wrong passcode) with a graduated cooldown:
| Cumulative failures | Cooldown |
|---|---|
| 3 | 15 seconds |
| 5 | 1 minute |
| 8 | 5 minutes |
| 12 | 30 minutes |
During a cooldown, authenticate returns 401 with Too many failed attempts. Please wait %1 or ask a manager to unlock your account. A manager clears the counter early via POST /V1/pos/staff/:staffId/unlock (empty body; the id in the path is enough), which returns true, or false when the staff id is unknown. A successful login also resets the counter.
From module 1.7.0:
- The count is kept in the database table
hyva_pos_rate_limit, under row locks, shared by every node. The passcode checks for one staff member run one at a time, so each wrong passcode counts before the next is checked. A cache flush no longer ends a lockout. A lockout that is running when the store updates ends with the update. - The refusal carries the wait in whole seconds as a second entry in
parameters, a string of digits the message does not show:["15 seconds", "15"]. A client reads it whatever language the message is in. - A wait that ends with its count's window is named in seconds when whole minutes would overstate it: 570 seconds left reads "570 seconds", not "10 minutes".
- Sign-ins for an email that matches no staff member are limited to 5 per email and 30 per client address in 10 minutes. A request whose client address cannot be read is counted per email only.
- A passcode check that times out waiting for the database is refused with the lockout answer and a wait of 5 seconds, not a server error.
The same counter applies to approverPasscode on POST /V1/pos/refund-approvals: a wrong approval passcode counts as a failed sign-in, and a locked-out staff member cannot approve. See Refund Authorization.
Session Validation (POST /V1/pos/staff/session/validate)
Called by the register when it comes back online or unlocks, to confirm a cached session still stands. Body: { "token": "wJd8...Qz" }. Returns the same session shape as authenticate, with the staff and role freshly loaded, so a role change takes effect on the next validation. Errors: 401 with Invalid session token., Session has expired., or Staff member not found..
Roles
A role is a name plus a permissions JSON string of boolean keys. Create and update take the entity wrapped in a role key:
{
"role": {
"name": "Cashier",
"permissions": "{\"place_orders\":true,\"apply_discounts\":false,\"accept_cash\":true,\"accept_card\":true,\"issue_refunds\":false}",
"is_active": true
}
}
permissions is a JSON string, not a nested object. Keys the app understands, grouped as in the admin role form:
- Sales:
place_orders,apply_discounts,apply_coupons,custom_line_items,issue_refunds,settle_payments,approve_rma,void_orders,price_override,tax_exempt_sales,reverse_charge - Payments:
accept_cash,accept_card,accept_split_payment,accept_store_credit,pay_by_invoice - Register:
open_register,close_register,cash_in_out,view_register_history - Customers:
view_customers,create_customers,edit_customers,edit_protected_customer_fields,assign_customer_group - Catalog:
view_products,view_stock_levels,manage_stock,assign_source_to_product,toggle_ship_together,edit_dashboard - Reporting:
view_reports,view_daily_summary,export_reports - Staff administration:
view_users,manage_users,assign_roles,view_audit_log - Settings:
access_settings,settings_view_all,settings_license,settings_scanner,settings_printers,settings_payment_terminal,settings_customer_display,settings_self_checkout,settings_appearance - Hardware:
open_cash_drawer,print_receipts,print_barcode_labels - Held transactions:
hold_cart,recall_any_cart
access_settings makes every section of Settings editable and settings_view_all makes every section visible, read-only where the role has no edit right. The seven settings_* section keys each open one part of Settings: a role with settings_printers alone sees the Settings menu with the printer sections in it and nothing else. settings_license and settings_payment_terminal are partial: the first shows the License & Subscription and terminal information and allows Reload but not Unregister or Reset Licence Clock, the second shows the payment settings with only the terminal selection and pairing editable.
configure_hardware is no longer offered on the role form. App versions released before the settings_* keys still read it from role blobs that carry it, where it stands for the printer, barcode scanner and terminal selection screens; a role saved through the current form no longer carries it, and an older app then applies its own role default for hardware configuration (managers and admins on, cashiers off), and a role that had it was migrated to settings_scanner, settings_printers and settings_payment_terminal when the module was upgraded.
Missing keys are treated as denied, with one exception: the register reads a role without settle_payments as granted. Module 1.7.0 adds settle_payments, on, to every existing role that does not carry it, and edit_protected_customer_fields, off, to every existing role that does not carry it. On a new install the default Manager and Admin roles carry edit_protected_customer_fields on, and the Cashier role carries view_customers and create_customers on.
The five customer keys are applied by the register (app 0.6.0 and later). The module's customer routes identify the staff member of the session the register sends and record them, but do not judge the role; see Register Marker and Staff Session. The app enforces permissions per signed-in cashier, and the Magento ACL resources above govern this REST API. Magento also checks one key itself: issue_refunds. A refund Magento pays out, or a payout the register authorizes, needs a staff session (staffSessionToken) whose active role grants issue_refunds, or a manager's approval from a staff member whose role grants it. See Refund Authorization. Errors: 404 unknown role id, 400 on failed saves.