openapi: 3.1.0 info: # Do not change the title, if the title changes, the import paths will be broken title: Api version: 0.1.0 description: Noorbelle API - Halal beauty product checker servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: analyze description: Ingredient analysis operations - name: auth description: Authentication operations - name: history description: Search history operations - name: stats description: ML model statistics paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /analyze: post: operationId: analyzeIngredients tags: [analyze] summary: Analyze ingredients for halal status requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AnalyzeRequest" responses: "200": description: Analysis result content: application/json: schema: $ref: "#/components/schemas/AnalysisResult" /scan: post: operationId: scanIngredients tags: [analyze] summary: Scan text (e.g. from image OCR) for ingredients and classify requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ScanRequest" responses: "200": description: Scan and analysis result content: application/json: schema: $ref: "#/components/schemas/AnalysisResult" /ingredients: get: operationId: getIngredients tags: [analyze] summary: Get the full ingredient database parameters: - name: status in: query schema: type: string enum: [halal, haram, mushbooh] description: Filter by status - name: search in: query schema: type: string description: Search ingredient by name responses: "200": description: List of ingredients content: application/json: schema: $ref: "#/components/schemas/IngredientsResponse" /products: get: operationId: getProducts tags: [analyze] summary: Get known beauty products from the database responses: "200": description: List of products content: application/json: schema: $ref: "#/components/schemas/ProductsResponse" /stats: get: operationId: getStats tags: [stats] summary: Get ML model statistics and dataset info responses: "200": description: ML stats content: application/json: schema: $ref: "#/components/schemas/MLStats" /auth/register: post: operationId: registerUser tags: [auth] summary: Register a new user requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/RegisterRequest" responses: "200": description: Registered successfully content: application/json: schema: $ref: "#/components/schemas/AuthResponse" "400": description: Validation error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /auth/login: post: operationId: loginUser tags: [auth] summary: Login a user requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/LoginRequest" responses: "200": description: Logged in successfully content: application/json: schema: $ref: "#/components/schemas/AuthResponse" "401": description: Invalid credentials content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /auth/me: get: operationId: getMe tags: [auth] summary: Get current user from session responses: "200": description: Current user content: application/json: schema: $ref: "#/components/schemas/UserResponse" "401": description: Not authenticated content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /auth/logout: post: operationId: logoutUser tags: [auth] summary: Logout current user responses: "200": description: Logged out content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /history: get: operationId: getHistory tags: [history] summary: Get search history for the authenticated user responses: "200": description: Search history content: application/json: schema: $ref: "#/components/schemas/HistoryResponse" "401": description: Not authenticated content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" post: operationId: saveHistory tags: [history] summary: Save a search to history requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/SaveHistoryRequest" responses: "200": description: Saved content: application/json: schema: $ref: "#/components/schemas/HistoryItem" /history/{id}: delete: operationId: deleteHistory tags: [history] summary: Delete a history entry parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/MessageResponse" components: schemas: HealthStatus: type: object properties: status: type: string required: [status] AnalyzeRequest: type: object properties: productName: type: string manufacturer: type: string ingredients: type: string description: Comma-separated or newline-separated ingredients list required: [ingredients] ScanRequest: type: object properties: text: type: string description: Raw text scanned from product label productName: type: string required: [text] IngredientClassification: type: object properties: name: type: string status: type: string enum: [halal, haram, mushbooh, unknown] reason: type: string confidence: type: number required: [name, status, confidence] AnalysisResult: type: object properties: overallStatus: type: string enum: [halal, haram, mushbooh] confidence: type: number productName: type: string manufacturer: type: string ingredients: type: array items: $ref: "#/components/schemas/IngredientClassification" summary: type: string halalCount: type: integer haramCount: type: integer mushboohCount: type: integer unknownCount: type: integer analyzedAt: type: string required: [overallStatus, confidence, ingredients, summary, halalCount, haramCount, mushboohCount, unknownCount, analyzedAt] Ingredient: type: object properties: id: type: integer name: type: string aliases: type: array items: type: string status: type: string enum: [halal, haram, mushbooh] category: type: string reason: type: string eNumber: type: string required: [id, name, status, category, reason] IngredientsResponse: type: object properties: ingredients: type: array items: $ref: "#/components/schemas/Ingredient" total: type: integer required: [ingredients, total] Product: type: object properties: id: type: integer name: type: string brand: type: string category: type: string status: type: string enum: [halal, haram, mushbooh] confidence: type: number required: [id, name, brand, category, status, confidence] ProductsResponse: type: object properties: products: type: array items: $ref: "#/components/schemas/Product" total: type: integer required: [products, total] MLStats: type: object properties: totalIngredients: type: integer halalCount: type: integer haramCount: type: integer mushboohCount: type: integer totalProducts: type: integer totalManufacturers: type: integer modelAccuracy: type: number categoryCounts: type: array items: type: object properties: category: type: string count: type: integer required: [category, count] topHaramIngredients: type: array items: type: string lastUpdated: type: string required: [totalIngredients, halalCount, haramCount, mushboohCount, totalProducts, totalManufacturers, modelAccuracy, categoryCounts, topHaramIngredients, lastUpdated] RegisterRequest: type: object properties: email: type: string name: type: string password: type: string required: [email, name, password] LoginRequest: type: object properties: email: type: string password: type: string required: [email, password] AuthResponse: type: object properties: user: $ref: "#/components/schemas/UserResponse" token: type: string required: [user, token] UserResponse: type: object properties: id: type: integer email: type: string name: type: string createdAt: type: string required: [id, email, name, createdAt] HistoryItem: type: object properties: id: type: integer productName: type: string ingredients: type: string overallStatus: type: string enum: [halal, haram, mushbooh] confidence: type: number createdAt: type: string required: [id, overallStatus, confidence, createdAt, ingredients] HistoryResponse: type: object properties: history: type: array items: $ref: "#/components/schemas/HistoryItem" total: type: integer required: [history, total] SaveHistoryRequest: type: object properties: productName: type: string ingredients: type: string overallStatus: type: string enum: [halal, haram, mushbooh] confidence: type: number required: [overallStatus, confidence, ingredients] MessageResponse: type: object properties: message: type: string required: [message] ErrorResponse: type: object properties: error: type: string required: [error]