Authentication Flow
- Register - Create a new organization and user account
- Login - Authenticate with email and password to receive tokens
- Use Access Token - Include the access token in the
Authorizationheader for API requests - Refresh - Use the refresh token to obtain a new access token when it expires
Token Types
Access Token
- Short-lived token used to authenticate API requests
- Include in the
Authorizationheader asBearer {accessToken} - Contains user ID, organization ID, role, and branch access
Refresh Token
- Long-lived token (7 days) used to obtain new access tokens
- Store securely on the client
- Can be revoked by logging out
Making Authenticated Requests
Include the access token in theAuthorization header:
User Roles
The API supports the following user roles with different permission levels:org_admin- Full access to all organization resourcesbranch_manager- Manage specific branchescashier- Process payments and orderswaiter- Take and manage orderskitchen- View and update order preparation status
Error Codes
Authentication endpoints return the following error codes:401 UNAUTHORIZED- Invalid credentials or expired token409 CONFLICT- Email or organization slug already exists404 NOT_FOUND- User not found