Skip to main content

API Design Reference

Related docs: Payment Architecture · Data Models · Security Compliance


1. Conventions

ConventionValue
Base path/api/v1/
Data formatapplication/json
AuthenticationAuthorization: Bearer <accessToken>
Error format{ "success": false, "message": "..." }
Success format{ "success": true, "data": { ... } } or top-level object
CurrencyZMW; represented as number (decimal), displayed as K xxx.xx
DatesISO 8601 strings (2026-05-12T10:00:00.000Z)

2. Authentication Endpoints

MethodPathAuthDescription
POST/auth/registerNoneRegister with email + password
POST/auth/loginNoneLogin; returns accessToken + refreshToken
POST/auth/logoutRequiredInvalidate current session
POST/auth/refreshNoneExchange refreshToken for new accessToken
POST/auth/request-magic-linkNoneSend magic link to email
POST/auth/verify-magic-linkNoneVerify magic link token
POST/auth/request-password-resetNoneSend password reset email
POST/auth/reset-passwordNoneComplete password reset
POST/auth/verify-emailNoneVerify email with token
GET/auth/meRequiredGet authenticated user profile
GET/oauth/:providerNoneInitiate OAuth flow
GET/oauth/:provider/callbackNoneOAuth callback

3. Product Endpoints

MethodPathAuthDescription
GET/productsNoneList products with filters
GET/products/:idNoneSingle product with variants
GET/products/recommendationsOptionalPersonalised or popular products
GET/products/:productId/optionsNoneProduct option groups
GET/products/:productId/variantsNoneProduct variants

Query params for /products: category, search, minPrice, maxPrice, sort, page, limit, featured, shopId.


4. Shop Endpoints

MethodPathAuthDescription
GET/shopsNoneList approved shops
GET/shops/searchNoneFull-text shop search
GET/shops/slug/:slugNoneShop by slug
POST/shops/requestRequiredRequest new shop (legacy flow)
GET/shops/my-shopsRequiredAuthenticated user's shops
GET/shops/:shopId/statsRequiredShop analytics
POST/shops/:shopId/productsRequiredCreate product in shop
GET/shops/:shopId/productsRequiredList shop's own products
PUT/shops/:shopId/products/:idRequiredUpdate product
DELETE/shops/:shopId/products/:idRequiredSoft-delete product

5. Order Endpoints

MethodPathAuthDescription
POST/ordersRequiredCreate order
GET/orders/myRequiredAuthenticated user's orders
GET/orders/:idRequiredSingle order details
PATCH/orders/:id/cancelRequiredCancel order

POST /orders request includes:

  • items: array of products, quantities, and prices
  • shippingAddress: delivery contact and location details
  • paymentMethod: selected provider (MTN, AIRTEL, ZAMTEL, CARD)
  • total: order amount

6. Payment Endpoints

MethodPathAuthDescription
POST/payments/initiateRequiredInitiate payment for an order
GET/payments/status/:orderIdRequiredGet payment + settlement status
POST/payments/webhook/:providerNoneReceive gateway webhooks
POST/payments/release/:orderIdAdminManually release vendor funds

POST /payments/initiate

Request: Requires orderId, paymentMethod, and phoneNumber (for mobile money).
Response: Returns a transactionId and success message for mobile money, or a redirectUrl for card payments.

GET /payments/status/:orderId

Response: Returns the current settlementStatus (e.g., HELD, RELEASABLE) and a history of payment attempts with their captured status.



7. Notification Endpoints

MethodPathAuthDescription
GET/notificationsRequiredList user's notifications
PATCH/notifications/:id/readRequiredMark as read
PATCH/notifications/read-allRequiredMark all as read
GET/notifications/preferencesRequiredGet user preferences
PUT/notifications/preferencesRequiredUpdate preferences

8. Seller Application Endpoints

MethodPathAuthDescription
POST/seller-applicationsRequiredCreate application draft
GET/seller-applications/my-applicationRequiredGet own application
PUT/seller-applications/:id/phase/:phaseRequiredUpdate a phase
POST/seller-applications/:id/documentsRequiredUpload KYC documents
POST/seller-applications/:id/submitRequiredSubmit for review
GET/seller-applicationsAdminList all applications
PUT/seller-applications/:id/statusAdminUpdate application status
POST/seller-applications/:id/approveAdminApprove; create shop

9. Error Response Format

All errors return a consistent shape including a success flag (set to false), a human-readable message, and an optional error code for programmatic handling.

HTTP StatusMeaning
400Bad request / validation error
401Unauthenticated
403Unauthorised (wrong role)
404Resource not found
409Conflict (e.g., duplicate order)
429Rate limit exceeded
500Internal server error