Skip to main content
PUT
/
stores
/
store-employees
/
{store_id}
Link User to Store
curl --request PUT \
  --url https://api-staging.luladelivery.store/stores/store-employees/{store_id} \
  --header 'Content-Type: application/json' \
  --data '{
  "user_id": 123,
  "employee_id": "<string>"
}'
{
  "success": true,
  "employee_relationship": {
    "store_id": "<string>",
    "user_id": 123,
    "employee_id": "<string>",
    "access_level": "<string>",
    "linked_at": "<string>",
    "linked_by": "<string>"
  }
}
This endpoint creates an employee relationship between an existing user and a store. It’s essential for managing store staff access and ensuring employees have the proper permissions to operate within their assigned stores.

Path Parameters

store_id
string
required
The unique identifier of the store to link the user to

Request Body

user_id
number
required
The ID of the existing user to link to the storeExample: 1000049
employee_id
string
required
The unique employee identifier (UUID format) for this user-store relationshipExample: “870a05c1-bbbf-48ab-a757-e28ae0a2b2a8”

Request Example

{
    "user_id": 1000049,
    "employee_id": "870a05c1-bbbf-48ab-a757-e28ae0a2b2a8"
}

Response

success
boolean
Indicates whether the user was successfully linked to the store
employee_relationship
object
Details of the created employee relationship

Response Example

{
    "success": true,
    "employee_relationship": {
        "store_id": "7669f473-6c40-45ee-8737-43c667407b3a",
        "user_id": 1000049,
        "employee_id": "870a05c1-bbbf-48ab-a757-e28ae0a2b2a8",
        "access_level": "store_employee",
        "linked_at": "2024-11-15T10:30:00.000Z",
        "linked_by": "1000001"
    }
}

Employee Access Levels

store_employee
access-level
Basic store employee access - can process orders and manage inventory
Standard access for front-line employees
store_manager
access-level
Store manager access - can manage employees and store settings
Elevated access for store management personnel
store_admin
access-level
Administrative access - full control over store operations
High-level access should be granted carefully
limited_access
access-level
Restricted access for specific functions only
Useful for part-time or specialized roles

Prerequisites

User Exists
prerequisite
The user_id must correspond to an existing user in the system
Users must be created before they can be linked to stores
Employee ID Valid
prerequisite
The employee_id should be a valid UUID format
Invalid UUID formats will be rejected
Store Active
prerequisite
The target store should be active and properly configured
Linking to inactive stores may cause access issues
Permission Check
prerequisite
Requesting user must have permission to manage store employees
Typically requires store manager or admin level access

Post-Linking Effects

Access Granted
effect
User gains access to store-specific functions and data
Access is immediate upon successful linking
Role Assignment
effect
User is assigned appropriate role-based permissions
Permissions are based on the assigned access level
Audit Trail
effect
Employee relationship is logged for compliance and tracking
All employee changes are tracked for security purposes
System Integration
effect
User appears in store employee lists and management interfaces
Integration with POS and management systems is automatic

Use Cases

New Employee Onboarding
use-case
Link new hires to their assigned store locations
Part of the standard employee onboarding process
Employee Transfer
use-case
Move existing employees between store locations
May require unlinking from previous store first
Temporary Assignment
use-case
Assign employees to stores for temporary coverage
Can be reversed when temporary assignment ends
Access Management
use-case
Grant specific users access to store operations
Ensure access levels match job responsibilities

Error Scenarios

User Not Found
error
The specified user_id doesn’t existStatus Code: 404Solution: Verify user ID or create user first
Store Not Found
error
The specified store_id doesn’t existStatus Code: 404
User is already linked to this storeStatus Code: 409Solution: Update existing relationship instead
Invalid Employee ID
error
The employee_id format is invalidStatus Code: 400Solution: Ensure employee_id is a valid UUID
Permission Denied
error
User lacks permission to link employees to storesStatus Code: 403
Immediate Access: Once successfully linked, users gain immediate access to store functions based on their assigned access level.
Security Consideration: Ensure employee IDs are unique and securely generated to prevent unauthorized access or conflicts.
Audit Compliance: All employee linking activities are logged for security audits and compliance requirements.
I