openapi: 3.1.0 info: title: Api version: 0.1.0 description: Boxleo Courier & Fulfillment API servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: services description: Service management - name: testimonials description: Testimonial management - name: tracking description: Order tracking - name: orders description: Order management - name: leads description: Lead/contact management - name: pricing description: Pricing management - name: warehouse description: Warehouse management - name: admin description: Admin operations paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /services: get: operationId: listServices tags: [services] summary: List all services responses: "200": description: List of services content: application/json: schema: type: array items: $ref: "#/components/schemas/Service" post: operationId: createService tags: [services, admin] summary: Create a service requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateServiceBody" responses: "201": description: Created service content: application/json: schema: $ref: "#/components/schemas/Service" /services/{id}: get: operationId: getService tags: [services] summary: Get a service by ID parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Service details content: application/json: schema: $ref: "#/components/schemas/Service" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/Error" put: operationId: updateService tags: [services, admin] summary: Update a service parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateServiceBody" responses: "200": description: Updated service content: application/json: schema: $ref: "#/components/schemas/Service" delete: operationId: deleteService tags: [services, admin] summary: Delete a service parameters: - name: id in: path required: true schema: type: integer responses: "204": description: Deleted /testimonials: get: operationId: listTestimonials tags: [testimonials] summary: List all testimonials responses: "200": description: List of testimonials content: application/json: schema: type: array items: $ref: "#/components/schemas/Testimonial" post: operationId: createTestimonial tags: [testimonials, admin] summary: Create a testimonial requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateTestimonialBody" responses: "201": description: Created testimonial content: application/json: schema: $ref: "#/components/schemas/Testimonial" /testimonials/{id}: put: operationId: updateTestimonial tags: [testimonials, admin] summary: Update a testimonial parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateTestimonialBody" responses: "200": description: Updated testimonial content: application/json: schema: $ref: "#/components/schemas/Testimonial" delete: operationId: deleteTestimonial tags: [testimonials, admin] summary: Delete a testimonial parameters: - name: id in: path required: true schema: type: integer responses: "204": description: Deleted /tracking/{trackingId}: get: operationId: trackOrder tags: [tracking] summary: Track an order by tracking ID parameters: - name: trackingId in: path required: true schema: type: string responses: "200": description: Order tracking details content: application/json: schema: $ref: "#/components/schemas/TrackingResult" "404": description: Order not found content: application/json: schema: $ref: "#/components/schemas/Error" /orders: get: operationId: listOrders tags: [orders] summary: List all orders parameters: - name: status in: query schema: type: string enum: [pending, processing, shipped, delivered, cancelled] - name: page in: query schema: type: integer default: 1 - name: limit in: query schema: type: integer default: 20 responses: "200": description: List of orders content: application/json: schema: $ref: "#/components/schemas/OrderList" post: operationId: createOrder tags: [orders] summary: Create a new order requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateOrderBody" responses: "201": description: Created order content: application/json: schema: $ref: "#/components/schemas/Order" /orders/{id}: get: operationId: getOrder tags: [orders] summary: Get an order by ID parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Order details content: application/json: schema: $ref: "#/components/schemas/Order" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/Error" put: operationId: updateOrderStatus tags: [orders, admin] summary: Update order status parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateOrderStatusBody" responses: "200": description: Updated order content: application/json: schema: $ref: "#/components/schemas/Order" /leads: post: operationId: submitLead tags: [leads] summary: Submit a contact/lead form requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateLeadBody" responses: "201": description: Lead submitted content: application/json: schema: $ref: "#/components/schemas/Lead" get: operationId: listLeads tags: [leads, admin] summary: List all leads responses: "200": description: List of leads content: application/json: schema: type: array items: $ref: "#/components/schemas/Lead" /pricing: get: operationId: listPricing tags: [pricing] summary: List all pricing plans responses: "200": description: List of pricing plans content: application/json: schema: type: array items: $ref: "#/components/schemas/PricingPlan" post: operationId: createPricingPlan tags: [pricing, admin] summary: Create a pricing plan requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreatePricingPlanBody" responses: "201": description: Created pricing plan content: application/json: schema: $ref: "#/components/schemas/PricingPlan" /pricing/{id}: put: operationId: updatePricingPlan tags: [pricing, admin] summary: Update a pricing plan parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreatePricingPlanBody" responses: "200": description: Updated pricing plan content: application/json: schema: $ref: "#/components/schemas/PricingPlan" delete: operationId: deletePricingPlan tags: [pricing, admin] summary: Delete a pricing plan parameters: - name: id in: path required: true schema: type: integer responses: "204": description: Deleted /warehouse/inventory: get: operationId: listInventory tags: [warehouse] summary: List warehouse inventory responses: "200": description: Inventory list content: application/json: schema: type: array items: $ref: "#/components/schemas/InventoryItem" post: operationId: addInventoryItem tags: [warehouse] summary: Add inventory item requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateInventoryItemBody" responses: "201": description: Added inventory item content: application/json: schema: $ref: "#/components/schemas/InventoryItem" /warehouse/inventory/{id}: put: operationId: updateInventoryItem tags: [warehouse] summary: Update inventory item parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateInventoryItemBody" responses: "200": description: Updated inventory item content: application/json: schema: $ref: "#/components/schemas/InventoryItem" /admin/stats: get: operationId: getAdminStats tags: [admin] summary: Get admin dashboard statistics responses: "200": description: Admin statistics content: application/json: schema: $ref: "#/components/schemas/AdminStats" components: schemas: HealthStatus: type: object properties: status: type: string required: - status Error: type: object properties: message: type: string required: - message Service: type: object properties: id: type: integer name: type: string slug: type: string description: type: string longDescription: type: string icon: type: string features: type: array items: type: string isActive: type: boolean createdAt: type: string format: date-time required: - id - name - slug - description - longDescription - icon - features - isActive - createdAt CreateServiceBody: type: object properties: name: type: string slug: type: string description: type: string longDescription: type: string icon: type: string features: type: array items: type: string isActive: type: boolean required: - name - slug - description - longDescription - icon - features Testimonial: type: object properties: id: type: integer name: type: string role: type: string company: type: string content: type: string rating: type: integer photoUrl: type: string isActive: type: boolean createdAt: type: string format: date-time required: - id - name - content - rating - isActive - createdAt CreateTestimonialBody: type: object properties: name: type: string role: type: string company: type: string content: type: string rating: type: integer photoUrl: type: string isActive: type: boolean required: - name - content - rating TrackingEvent: type: object properties: id: type: integer status: type: string description: type: string location: type: string timestamp: type: string format: date-time required: - id - status - description - timestamp TrackingResult: type: object properties: trackingId: type: string status: type: string enum: [pending, processing, shipped, in_transit, out_for_delivery, delivered, failed] estimatedDelivery: type: string format: date-time origin: type: string destination: type: string currentLocation: type: string events: type: array items: $ref: "#/components/schemas/TrackingEvent" required: - trackingId - status - events Order: type: object properties: id: type: integer trackingId: type: string customerName: type: string customerEmail: type: string customerPhone: type: string origin: type: string destination: type: string status: type: string enum: [pending, processing, shipped, in_transit, out_for_delivery, delivered, cancelled, failed] serviceType: type: string weight: type: number dimensions: type: string description: type: string specialInstructions: type: string estimatedDelivery: type: string format: date-time deliveredAt: type: string format: date-time createdAt: type: string format: date-time events: type: array items: $ref: "#/components/schemas/TrackingEvent" required: - id - trackingId - customerName - customerEmail - origin - destination - status - serviceType - createdAt CreateOrderBody: type: object properties: customerName: type: string customerEmail: type: string customerPhone: type: string origin: type: string destination: type: string serviceType: type: string weight: type: number dimensions: type: string description: type: string specialInstructions: type: string estimatedDelivery: type: string format: date-time required: - customerName - customerEmail - origin - destination - serviceType UpdateOrderStatusBody: type: object properties: status: type: string enum: [pending, processing, shipped, in_transit, out_for_delivery, delivered, cancelled, failed] location: type: string description: type: string required: - status OrderList: type: object properties: orders: type: array items: $ref: "#/components/schemas/Order" total: type: integer page: type: integer limit: type: integer required: - orders - total - page - limit Lead: type: object properties: id: type: integer name: type: string email: type: string phone: type: string company: type: string service: type: string message: type: string country: type: string status: type: string enum: [new, contacted, qualified, closed] createdAt: type: string format: date-time required: - id - name - email - message - status - createdAt CreateLeadBody: type: object properties: name: type: string email: type: string phone: type: string company: type: string service: type: string message: type: string country: type: string required: - name - email - message PricingPlan: type: object properties: id: type: integer name: type: string description: type: string price: type: number currency: type: string period: type: string features: type: array items: type: string isPopular: type: boolean isActive: type: boolean serviceId: type: integer createdAt: type: string format: date-time required: - id - name - description - price - currency - period - features - isPopular - isActive - createdAt CreatePricingPlanBody: type: object properties: name: type: string description: type: string price: type: number currency: type: string period: type: string features: type: array items: type: string isPopular: type: boolean isActive: type: boolean serviceId: type: integer required: - name - description - price - currency - period - features InventoryItem: type: object properties: id: type: integer sku: type: string name: type: string description: type: string quantity: type: integer unit: type: string location: type: string warehouseZone: type: string clientName: type: string weight: type: number dimensions: type: string status: type: string enum: [in_stock, low_stock, out_of_stock, reserved] createdAt: type: string format: date-time updatedAt: type: string format: date-time required: - id - sku - name - quantity - status - createdAt - updatedAt CreateInventoryItemBody: type: object properties: sku: type: string name: type: string description: type: string quantity: type: integer unit: type: string location: type: string warehouseZone: type: string clientName: type: string weight: type: number dimensions: type: string required: - sku - name - quantity AdminStats: type: object properties: totalOrders: type: integer ordersToday: type: integer pendingOrders: type: integer deliveredOrders: type: integer totalLeads: type: integer newLeads: type: integer totalInventoryItems: type: integer lowStockItems: type: integer activeTestimonials: type: integer activeServices: type: integer deliverySuccessRate: type: number onTimeDeliveryRate: type: number required: - totalOrders - ordersToday - pendingOrders - deliveredOrders - totalLeads - newLeads - totalInventoryItems - lowStockItems - activeTestimonials - activeServices - deliverySuccessRate - onTimeDeliveryRate