POST /api/customer/:branchSlug/:tableCode/register
This public endpoint allows customers to scan a table QR code and request access to dine. The request creates a pending session that staff must approve.
This endpoint is public and does not require authentication. The table code comes from the QR code.
URL Parameters
Branch slug identifier (e.g.,
downtown-lima)Unique table QR code in format
{branchSlug}-{tableNumber} (e.g., downtown-lima-15)Request Body
Customer’s full name (1-255 characters)
Customer’s phone number (optional, max 20 characters)
Customer’s email address (optional, enables loyalty tracking)
Customer’s birth date in ISO 8601 format (optional)
Response
Success (201 Created)
Always
true for successful requestsJWT token for customer authentication. Use this in the
Authorization: Bearer header for subsequent requests.Session UUID (same as
session.id)Only present if table already has an active session. When
true, the response returns the existing session and its token instead of creating a new one.Customer Access Flow
- Customer Scans QR Code: Table QR code contains the branch slug and table code
- Request Access: Customer fills out their information and submits
- Session Created: System creates a
pendingsession and customer record - Wait for Approval: Customer polls the session status or listens via WebSocket
- Staff Approves: Staff sees pending session notification and approves/rejects
- Customer Notified: Session status changes to
activeorrejected - Place Orders: With active session, customer can browse menu and place orders
Deduplication
The system automatically deduplicates customers based on email or phone number:- If a customer with the same email or phone exists, the existing record is used
- This enables loyalty points to accumulate across visits
- Without email/phone, a new customer record is created for each session
Session Constraints
Examples
Request
Response - New Session
Response - Existing Active Session
Error Responses
404 NOT_FOUND
Branch or table not found with the provided slug/code
409 SESSION_PENDING
Table has a pending session awaiting approval
Next Steps
After receiving the token:- Poll Session Status: Use
GET /api/customer/:branchSlug/:tableCode/session-status/:sessionIdto check if approved - WebSocket Connection: Connect to
session:{sessionId}channel to receive real-time approval notification - Browse Menu: Use
GET /api/customer/:branchSlug/:tableCode/menuto view available items - Place Orders: Once approved, use
POST /api/customer/orderswith the customer token
WebSocket Events
After registration, listen for these events on thesession:{sessionId} channel:
session:approved- Session was approved by staffsession:rejected- Session was rejected by staff