openapi: 3.1.0 info: title: Api version: 0.1.0 description: IA Boutique API - Formations & Prompts Premium servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: products description: Product management - name: orders description: Order management - name: posts description: Social feed posts - name: admin description: Admin dashboard operations - name: downloads description: File download access - name: payments description: Mobile Money payment operations paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" # ─── PRODUCTS ──────────────────────────────────────────────────────────────── /products: get: operationId: listProducts tags: [products] summary: List all products parameters: - name: category in: query schema: type: string - name: featured in: query schema: type: boolean - name: limit in: query schema: type: integer - name: offset in: query schema: type: integer responses: "200": description: Product list content: application/json: schema: $ref: "#/components/schemas/ProductList" post: operationId: createProduct tags: [products] summary: Create a product (admin) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ProductInput" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/Product" /products/{id}: get: operationId: getProduct tags: [products] summary: Get single product parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Product details content: application/json: schema: $ref: "#/components/schemas/Product" patch: operationId: updateProduct tags: [products] summary: Update a product (admin) parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ProductUpdate" responses: "200": description: Updated content: application/json: schema: $ref: "#/components/schemas/Product" delete: operationId: deleteProduct tags: [products] summary: Delete a product (admin) parameters: - name: id in: path required: true schema: type: integer responses: "204": description: Deleted /products/featured: get: operationId: getFeaturedProducts tags: [products] summary: Get featured products for homepage responses: "200": description: Featured products content: application/json: schema: $ref: "#/components/schemas/ProductList" /products/categories: get: operationId: listCategories tags: [products] summary: Get all product categories with counts responses: "200": description: Category list with counts content: application/json: schema: $ref: "#/components/schemas/CategoryList" # ─── ORDERS ────────────────────────────────────────────────────────────────── /orders: get: operationId: listOrders tags: [orders] summary: List orders (admin gets all, user gets own) parameters: - name: status in: query schema: type: string - name: userId in: query schema: type: string responses: "200": description: Order list content: application/json: schema: $ref: "#/components/schemas/OrderList" post: operationId: createOrder tags: [orders] summary: Create an order (purchase) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/OrderInput" responses: "201": description: Order created content: application/json: schema: $ref: "#/components/schemas/Order" /orders/{id}: get: operationId: getOrder tags: [orders] summary: Get order details parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Order details content: application/json: schema: $ref: "#/components/schemas/Order" patch: operationId: updateOrderStatus tags: [orders] summary: Update order status (admin) parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/OrderStatusUpdate" responses: "200": description: Updated content: application/json: schema: $ref: "#/components/schemas/Order" # ─── DOWNLOADS ─────────────────────────────────────────────────────────────── /downloads/{orderId}/{productId}: get: operationId: getDownloadUrl tags: [downloads] summary: Get a signed download URL for a purchased product parameters: - name: orderId in: path required: true schema: type: integer - name: productId in: path required: true schema: type: integer responses: "200": description: Download URL content: application/json: schema: $ref: "#/components/schemas/DownloadUrl" # ─── POSTS (SOCIAL FEED) ───────────────────────────────────────────────────── /posts: get: operationId: listPosts tags: [posts] summary: Get the social feed parameters: - name: type in: query schema: type: string - name: limit in: query schema: type: integer - name: offset in: query schema: type: integer responses: "200": description: Post feed content: application/json: schema: $ref: "#/components/schemas/PostList" post: operationId: createPost tags: [posts] summary: Publish a new post requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/PostInput" responses: "201": description: Post created content: application/json: schema: $ref: "#/components/schemas/Post" /posts/{id}: get: operationId: getPost tags: [posts] summary: Get a single post parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Post content: application/json: schema: $ref: "#/components/schemas/Post" patch: operationId: updatePost tags: [posts] summary: Update a post parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/PostUpdate" responses: "200": description: Updated post content: application/json: schema: $ref: "#/components/schemas/Post" delete: operationId: deletePost tags: [posts] summary: Delete a post parameters: - name: id in: path required: true schema: type: integer responses: "204": description: Deleted # ─── PAYMENTS (MOBILE MONEY) ───────────────────────────────────────────────── /payments: post: operationId: createPayment tags: [payments] summary: Initiate a Mobile Money payment requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/PaymentInput" responses: "201": description: Payment created content: application/json: schema: $ref: "#/components/schemas/Payment" /payments/my: get: operationId: getMyPayments tags: [payments] summary: Get current user's payments parameters: - name: userId in: query required: true schema: type: string responses: "200": description: User payment list content: application/json: schema: $ref: "#/components/schemas/PaymentList" /payments/{id}/screenshot: post: operationId: submitPaymentScreenshot tags: [payments] summary: Submit payment screenshot for validation parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ScreenshotInput" responses: "200": description: Screenshot submitted content: application/json: schema: $ref: "#/components/schemas/Payment" # ─── ADMIN ─────────────────────────────────────────────────────────────────── /admin/stats: get: operationId: getAdminStats tags: [admin] summary: Get admin dashboard stats responses: "200": description: Admin statistics content: application/json: schema: $ref: "#/components/schemas/AdminStats" /admin/recent-orders: get: operationId: getRecentOrders tags: [admin] summary: Get the 10 most recent orders responses: "200": description: Recent orders content: application/json: schema: $ref: "#/components/schemas/OrderList" /admin/sales-by-category: get: operationId: getSalesByCategory tags: [admin] summary: Revenue and sales count grouped by product category responses: "200": description: Sales breakdown content: application/json: schema: $ref: "#/components/schemas/SalesByCategoryList" /admin/payments: get: operationId: getAdminPayments tags: [admin] summary: List all payments with screenshots (admin) parameters: - name: status in: query schema: type: string responses: "200": description: Payment list content: application/json: schema: $ref: "#/components/schemas/PaymentList" /admin/payments/{id}: patch: operationId: updatePaymentStatus tags: [admin] summary: Validate or refuse a Mobile Money payment parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/PaymentStatusUpdate" responses: "200": description: Payment updated content: application/json: schema: $ref: "#/components/schemas/Payment" components: schemas: HealthStatus: type: object required: [status] properties: status: type: string # ── Product ──────────────────────────────────────────────────────────────── Product: type: object required: [id, title, price, category, type, createdAt] properties: id: type: integer title: type: string description: type: ["string", "null"] price: type: number category: type: string type: type: string description: "formation | prompt | guide | video" imageUrl: type: ["string", "null"] fileUrl: type: ["string", "null"] previewUrl: type: ["string", "null"] featured: type: boolean salesCount: type: integer createdAt: type: string ProductList: type: object required: [products, total] properties: products: type: array items: $ref: "#/components/schemas/Product" total: type: integer ProductInput: type: object required: [title, price, category, type] properties: title: type: string description: type: string price: type: number category: type: string type: type: string imageUrl: type: string fileUrl: type: string previewUrl: type: string featured: type: boolean ProductUpdate: type: object properties: title: type: string description: type: string price: type: number category: type: string type: type: string imageUrl: type: string fileUrl: type: string previewUrl: type: string featured: type: boolean CategoryStat: type: object required: [category, count] properties: category: type: string count: type: integer CategoryList: type: array items: $ref: "#/components/schemas/CategoryStat" # ── Order ────────────────────────────────────────────────────────────────── Order: type: object required: [id, productId, userId, status, amount, createdAt] properties: id: type: integer productId: type: integer userId: type: string userEmail: type: ["string", "null"] status: type: string description: "pending | paid | cancelled" amount: type: number productTitle: type: ["string", "null"] createdAt: type: string OrderList: type: object required: [orders, total] properties: orders: type: array items: $ref: "#/components/schemas/Order" total: type: integer OrderInput: type: object required: [productId, userId, amount] properties: productId: type: integer userId: type: string userEmail: type: string amount: type: number OrderStatusUpdate: type: object required: [status] properties: status: type: string # ── Download ─────────────────────────────────────────────────────────────── DownloadUrl: type: object required: [url, expiresAt] properties: url: type: string expiresAt: type: string # ── Post ────────────────────────────────────────────────────────────────── Post: type: object required: [id, type, createdAt] properties: id: type: integer type: type: string description: "text | image | video | tip | prompt" content: type: ["string", "null"] mediaUrl: type: ["string", "null"] title: type: ["string", "null"] isPinned: type: boolean likesCount: type: integer createdAt: type: string PostList: type: object required: [posts, total] properties: posts: type: array items: $ref: "#/components/schemas/Post" total: type: integer PostInput: type: object required: [type] properties: type: type: string content: type: string mediaUrl: type: string title: type: string isPinned: type: boolean PostUpdate: type: object properties: content: type: string mediaUrl: type: string title: type: string isPinned: type: boolean # ── Payment (Mobile Money) ───────────────────────────────────────────────── Payment: type: object required: [id, userId, productId, amount, paymentMethod, status, createdAt, updatedAt] properties: id: type: integer userId: type: string userName: type: ["string", "null"] userEmail: type: ["string", "null"] productId: type: integer productTitle: type: ["string", "null"] amount: type: number paymentMethod: type: string description: "orange | moov" phoneNumber: type: ["string", "null"] status: type: string description: "pending | validated | refused" screenshotData: type: ["string", "null"] adminNote: type: ["string", "null"] createdAt: type: string updatedAt: type: string PaymentList: type: object required: [payments, total] properties: payments: type: array items: $ref: "#/components/schemas/Payment" total: type: integer PaymentInput: type: object required: [userId, productId, amount, paymentMethod] properties: userId: type: string userName: type: string userEmail: type: string productId: type: integer productTitle: type: string amount: type: number paymentMethod: type: string description: "orange | moov" phoneNumber: type: string ScreenshotInput: type: object required: [screenshotData] properties: screenshotData: type: string PaymentStatusUpdate: type: object required: [status] properties: status: type: string description: "validated | refused" adminNote: type: string # ── Admin ────────────────────────────────────────────────────────────────── AdminStats: type: object required: [totalRevenue, totalOrders, totalProducts, totalUsers, pendingOrders, paidOrders, pendingPayments, validatedPayments] properties: totalRevenue: type: number totalOrders: type: integer totalProducts: type: integer totalUsers: type: integer pendingOrders: type: integer paidOrders: type: integer pendingPayments: type: integer validatedPayments: type: integer SalesByCategory: type: object required: [category, revenue, count] properties: category: type: string revenue: type: number count: type: integer SalesByCategoryList: type: array items: $ref: "#/components/schemas/SalesByCategory"