Velora API Documentation

RESTful API untuk Platform Kesehatan Ibu Hamil

Version 1.0.0 Express.js Supabase JWT Auth

📋 API Overview

Base URL:

https://api-velora.vercel.app
http://localhost:5000 (Development)

Features

Response Format

{
  "success": true,
  "message": "Request berhasil",
  "data": { ... },
  "timestamp": "2025-01-28T10:00:00Z"
}

🔐 Authentication

API menggunakan JWT (JSON Web Tokens) untuk authentication. Include token di header:

Authorization: Bearer YOUR_JWT_TOKEN

Getting Started

  1. Register akun baru via /api/auth/register
  2. Login untuk mendapatkan access token via /api/auth/login
  3. Include token di header untuk protected endpoints
  4. Refresh token saat expired via /api/auth/refresh

Rate Limiting

Limit Window Scope
100 requests 15 minutes Per IP Address

🌐 API Endpoints

Core System

GET / No Auth
GET https://api-velora.vercel.app/

Welcome message & API information

GET /health No Auth
GET https://api-velora.vercel.app/health

Health check & system status

GET /docs No Auth
GET https://api-velora.vercel.app/docs

Interactive API documentation (this page)

Authentication 🔐

POST /api/auth/register No Auth
POST https://api-velora.vercel.app/api/auth/register

Registrasi pengguna baru

Body: name, email, password, phone

POST /api/auth/login No Auth
POST https://api-velora.vercel.app/api/auth/login

Login pengguna & mendapatkan JWT token

Body: email, password

POST /api/auth/refresh Auth Required
POST https://api-velora.vercel.app/api/auth/refresh

Refresh JWT token

User Management 👤

GET /api/users/profile Auth Required
GET https://api-velora.vercel.app/api/users/profile

Get user profile & pregnancy data

PUT /api/users/profile Auth Required
PUT https://api-velora.vercel.app/api/users/profile

Update user profile information

Health Prediction 🏥

POST /api/health/predict Auth Required
POST https://api-velora.vercel.app/api/health/predict

Prediksi risiko kesehatan menggunakan AI (84.21% akurasi)

Body: age, systolic_bp, diastolic_bp, bs, body_temp, heart_rate

GET /api/health/history Auth Required
GET https://api-velora.vercel.app/api/health/history

Riwayat prediksi kesehatan pengguna

Gallery Management 📸

GET /api/gallery Auth Required
GET https://api-velora.vercel.app/api/gallery

Get all user photos/videos

POST /api/gallery/upload Auth Required
POST https://api-velora.vercel.app/api/gallery/upload

Upload foto/video baru (max 10MB)

Content-Type: multipart/form-data

DELETE /api/gallery/:id Auth Required
DELETE https://api-velora.vercel.app/api/gallery/:id

Hapus foto/video tertentu

Timeline Tracking 📅

GET /api/timeline Auth Required
GET https://api-velora.vercel.app/api/timeline

Get pregnancy timeline & milestones

Diagnosis & Recommendations 🔍

POST /api/diagnosa/analyze Auth Required
POST https://api-velora.vercel.app/api/diagnosa/analyze

Analyze symptoms & get recommendations

💻 Code Examples

User Registration

curl -X POST https://api-velora.vercel.app/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Jane Doe",
    "email": "jane@example.com",
    "password": "securePassword123",
    "phone": "+628123456789"
  }'

User Login

curl -X POST https://api-velora.vercel.app/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "jane@example.com",
    "password": "securePassword123"
  }'

Health Prediction

curl -X POST https://api-velora.vercel.app/api/health/predict \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -d '{
    "age": 28,
    "systolic_bp": 120,
    "diastolic_bp": 80,
    "bs": 6.5,
    "body_temp": 98.6,
    "heart_rate": 76
  }'

Response Example

{
  "success": true,
  "message": "Prediksi berhasil",
  "data": {
    "risk_level": "low",
    "probability": 0.15,
    "recommendations": [
      "Pertahankan pola makan sehat",
      "Lakukan olahraga ringan secara teratur",
      "Kontrol rutin setiap bulan"
    ]
  },
  "timestamp": "2025-01-28T10:00:00Z"
}

📊 API Status

Service Status Response Time Uptime
API Server Healthy < 200ms 99.9%
Database Connected < 50ms 99.99%
ML API Available < 500ms 99.5%

Environment Info

Property Value
Version 1.0.0
Environment Production
Last Deploy 2025-01-28 10:00:00 UTC
Region Singapore (sin1)