REST API
CartUser exposes 72+ REST endpoints under /api. Same API powers the user app, seller app, delivery app, and your custom integrations. Auth via Laravel Sanctum bearer tokens.
In-app reference
Full endpoint list with parameters + example responses is built into admin panel: Admin โ API Documentation. This page is a high-level overview.
Full endpoint list with parameters + example responses is built into admin panel: Admin โ API Documentation. This page is a high-level overview.
Base URL
https://yourdomain.com/api
Authentication
Public endpoints
These work without token:
GET /api/configโ site settings, languages, currenciesGET /api/productsโ product listGET /api/product/{uid}โ product detailGET /api/category/products/{uid}โ products by categoryGET /api/brand/products/{uid}โ products by brandPOST /api/loginโ get tokenPOST /api/registerโ create account + get token
Protected endpoints (token required)
Include in header:
Authorization: Bearer {token}
Accept: application/json
Getting a token
POST /api/login
Content-Type: application/json
{
"username": "[email protected]",
"password": "123123"
}
Response:
{
"success": true,
"data": {
"access_token": "1|aBcD1234...",
"user": { ... }
}
}
Endpoint groups
Auth
POST /api/registerโ register customerPOST /api/loginโ login, returns tokenPOST /api/logoutโ invalidate tokenPOST /api/password/forgetโ send password reset OTPPOST /api/password/resetโ reset with OTPPOST /api/otp/verifyโ verify email/phone OTPPOST /api/otp/resendโ resend OTP
Config
GET /api/configโ settings, countries, currencies, languages, payment methods, frontend sections, onboarding pagesGET /api/translate/{key}โ translate string to current locale
Products
GET /api/productsโ list with filters (category, brand, price range, sort)GET /api/product/{uid}/{camp_uid?}โ product detailGET /api/category/products/{uid}โ by categoryGET /api/brand/products/{uid}โ by brandGET /api/campaigns/{uid}โ campaign productsPOST /api/product/reviewโ submit review (requires token)
Cart
GET /api/cartโ current cart itemsPOST /api/cart/addโ add productPOST /api/cart/updateโ change quantityPOST /api/cart/removeโ remove itemPOST /api/cart/clearโ empty cart
Wishlist
GET /api/wishlistPOST /api/wishlist/addPOST /api/wishlist/remove
Checkout
POST /api/checkoutโ place order- Required:
address_id,payment_id,delivery_option - Optional:
coupon_code,wallet_payment,order_notes
- Required:
POST /api/digital/checkoutโ digital product checkoutPOST /api/checkout/completeโ finalize after gateway redirectGET /api/payment/log/{trx_code}โ verify payment status
Orders
GET /api/ordersโ customer's order listGET /api/order/{uid}โ order detailPOST /api/order/cancelโ cancel orderPOST /api/order/returnโ request return
Profile
GET /api/profilePOST /api/profile/updatePOST /api/profile/passwordPOST /api/profile/imagePOST /api/profile/fcm-tokenโ register for push notifications
Addresses
GET /api/addressesPOST /api/address/storePOST /api/address/updatePOST /api/address/delete
Wallet & transactions
GET /api/walletPOST /api/wallet/rechargeGET /api/transactions
Reward points
GET /api/reward/logโ earned points historyPOST /api/reward/redeemโ redeem to wallet
Chat
GET /api/chat/conversationsPOST /api/chat/sendGET /api/chat/messages/{conversation_id}
Support tickets
GET /api/ticketsPOST /api/ticket/createPOST /api/ticket/reply
Shop / sellers
GET /api/shopโ seller listGET /api/shop/visit/{id}โ increment visit counter
Error responses
// Validation error (422)
{
"success": false,
"data": {
"errors": ["Email field is required"]
},
"message": "Validation failed"
}
// Auth error (401)
{
"success": false,
"message": "Unauthenticated"
}
// Not found (404)
{
"success": false,
"message": "Resource not found"
}
// Server error (500)
{
"success": false,
"message": "Server error message"
}
Standard success format
{
"success": true,
"data": {
"products": [ ... ],
"pagination": {
"current_page": 1,
"total": 50
}
},
"message": "Success"
}
Pagination
List endpoints use ?page=N query param. Page size set in admin (default 10). Response includes pagination meta.
Rate limits
Default: 60 requests/minute per IP. Adjust in kode/app/Providers/RouteServiceProvider.php.
CORS
CORS is enabled for all origins by default. Restrict in kode/config/cors.php:
'allowed_origins' => ['https://yourapp.com'],
Testing with curl
# Login
curl -X POST https://yourdomain.com/api/login \
-H "Content-Type: application/json" \
-d '{"username":"[email protected]","password":"123123"}'
# Use token
curl https://yourdomain.com/api/profile \
-H "Authorization: Bearer 1|aBcD1234..." \
-H "Accept: application/json"
Postman collection
Generate a Postman collection from your installation:
cd /home/user/public_html/kode
php artisan export:postman
Output: storage/app/cartuser.postman_collection.json. Import into Postman.