# ALWS RESTRO Restaurants API > Connect a restaurant website to ALWS RESTRO (restaurant billing/POS by ALWS, Alightway Solutions Pvt. Ltd.): > live menu, cart pricing, pickup/delivery orders, order status, table availability and table booking. > Orders appear in ALWS RESTRO "Website Orders"; bookings appear in "Reservations". Base URL: https://restro.alws.in/api/v1 Machine-readable contract (OpenAPI 3.1): https://developers.alws.in/restaurants/openapi.json Human docs: https://developers.alws.in/restaurants/ Support: restro@alws.in ## Conventions - JSON request/response. Money in INR (rupees, numbers). Dates YYYY-MM-DD and times HH:mm (24h) in India Standard Time. - Every request except GET /health needs: Authorization: Bearer - Errors: HTTP status + { "error": { "type", "code", "message", "requestId", "details"? } }. Use `code` in logic, show `message`. - Every response has X-Request-Id. Key-authenticated responses have X-RateLimit-Limit / -Remaining / -Reset. ## Keys (created only by the business owner in ALWS RESTRO: Account Setting -> API Keys; full key shown once) - pk_live_... publishable: safe in browser code. Works only from the website origins listed for the key (otherwise 403 origin_not_allowed). Orders it creates always start unpaid. Reads/cancels an order or booking only with that record's accessToken (headers X-Order-Token / X-Reservation-Token). - sk_live_... secret: server only. Requests carrying a browser Origin header are refused (403 secret_key_in_browser). Can additionally list orders, read any order/booking of the business, and mark online orders paid. - Never place sk_ keys in browser code, mobile apps or repositories. ## Endpoints GET /health no key -> {status:"ok", version} GET /restaurant -> {name, address:{line,city,state}, phone, gstin} GET /menu -> {currency:"INR", categories:[{name,itemCount}], items:[{id,name,category,price,foodType:"veg"|"egg"|"nonveg"|null,specialMenu}]} Only items currently available at the counter (switched-off special menus are excluded). GET /tables -> {floors:[{floorId,floorName,tables:[{tableId,tableNumber}]}]} POST /orders/quote {items:[{itemId,quantity}], couponCode?} -> {items:[{itemId,name,category,foodType,unitPrice,quantity,lineTotal}], subtotal, discount|null, charges:[{name,percentage,amount}], chargesTotal, roundOff, total} Pricing = counter rules: subtotal; each charge = % of subtotal; coupon per unit of applicable items (percentage of price or flat per unit); total = round(subtotal - discount + charges) to nearest rupee. Duplicate itemIds are merged. quantity 1..999, up to 100 lines. POST /orders [Idempotency-Key] {items, couponCode?, orderType:"pickup"|"delivery", customer:{name,phone,email?}, deliveryAddress?:{line, landmark?, city?, pincode?(6 digits), location?:{lat,lng}} (required for delivery), scheduledFor?(ISO with offset, future, <=7 days), notes?(<=500), payment?:{method:"cash"|"online"} (default cash), expectedTotal?(recommended; 409 price_changed with details.quote if different)} Unknown fields -> 400. Website prices are never used. -> 201 Order + accessToken (returned only once). orderNumber is the short code to show the customer. GET /orders/{id} sk, or pk + X-Order-Token -> Order POST /orders/{id}/cancel sk, or pk + X-Order-Token; only while status is pending or pending_payment (else 409 cannot_cancel) POST /orders/{id}/payment sk only {provider, reference, amount(must equal total)} -> status pending, paymentStatus paid. Call only after YOUR server verified the payment with your gateway. Repeating for an already-paid order returns it unchanged. GET /orders?status=&since=&limit= sk only -> {data:[Order newest first], hasMore}; limit 1..100 (default 50) GET /reservations/availability?date=&from=&to= -> {date,from,to,availableCount,tables:[{tableId,tableNumber,floorId,floorName,available}]} POST /reservations [Idempotency-Key] {date, from, to, tableId?, partySize?(1..100), customer:{name,phone,email?}, notes?} -> 201 Reservation + accessToken. Without tableId the first free table is chosen. 409 table_unavailable / no_table_available. From now up to 60 days ahead; from < to, same day. Staff bookings in ALWS RESTRO count for availability. GET /reservations/{id} sk, or pk + X-Reservation-Token POST /reservations/{id}/cancel sk, or pk + X-Reservation-Token; until the start time; removes the booking. ## Order statuses (set by restaurant staff in ALWS RESTRO) pending_payment (online orders before payment is confirmed; hidden from the restaurant) -> pending -> processing -> shipped -> delivered; or cancelled. statusText: "Waiting for payment", "Received by the restaurant", "Being prepared", "Ready for pickup" / "Out for delivery", "Completed", "Cancelled". No webhooks yet: poll GET /orders/{id} (e.g. every 30 s while the customer's status page is open). ## Payments cash: order goes straight to the restaurant (payment shown as "Cash on delivery" or "Pay at pickup"). online: create order with payment.method "online" -> take payment with your own gateway -> verify on your server -> POST /orders/{id}/payment with the secret key. ALWS does not process, verify or refund payments. ## Reliability - Idempotency-Key (8-100 chars [A-Za-z0-9._:-]) on POST /orders and POST /reservations: the same key on a retry returns the first response (header Idempotent-Replayed: true); a different body -> 409 idempotency_conflict; still running -> 409 request_in_progress. Remembered 24 hours per API key. Use crypto.randomUUID() per new order; reuse it for retries. - Rate limits per key per minute: publishable 120 requests (20 creates), secret 600 requests (120 creates). 429 rate_limited + Retry-After. - Retry only network errors, 409 request_in_progress, 429 and 500, up to 3 times with backoff and the same Idempotency-Key. ## Error codes 400 invalid_request (details.fields), invalid_idempotency_key; 401 missing_api_key, invalid_api_key, api_key_revoked; 403 origin_not_allowed, secret_key_in_browser, secret_key_required, business_suspended; 404 not_found, route_not_found; 405 method_not_allowed; 409 price_changed, cannot_cancel, amount_mismatch, not_awaiting_payment, table_unavailable, no_table_available, idempotency_conflict, request_in_progress, busy; 413 body_too_large; 422 item_unavailable (details.itemIds), coupon_invalid (details.reason: not_found|inactive|expired|not_applicable), invalid_schedule, slot_in_past, slot_too_far, no_tables, table_not_found; 429 rate_limited; 500 internal_error.