Skip to main content

Base URL

All API requests should be made to:
http://localhost:3001

Available Endpoints

The MediGuide API provides the following endpoint categories:

User Authentication

Signup, login, and password recovery endpoints

Medical Records

Store and retrieve patient health data

Response Format

All API responses are returned in JSON format.

Successful Response

{
  "message": "Operation successful",
  "userId": 123,
  "username": "john_doe"
}

Error Response

{
  "error": "Error message describing what went wrong"
}

HTTP Status Codes

The API uses standard HTTP status codes:
Status CodeDescription
200Success - Request completed successfully
201Created - Resource created successfully
400Bad Request - Invalid input or missing required fields
401Unauthorized - Invalid credentials or expired token
404Not Found - Resource not found
500Internal Server Error - Server encountered an error

Error Handling

All errors follow a consistent format with descriptive messages:

Validation Errors (400)

{
  "error": "Usuario ya está registrado"
}
{
  "error": "La contraseña debe tener al menos 6 caracteres"
}

Authentication Errors (401)

{
  "error": "Usuario o contraseña incorrectos"
}
{
  "error": "El código de recuperación ha expirado"
}

Not Found Errors (404)

{
  "error": "No medical records found"
}

Server Errors (500)

{
  "error": "Detailed error message"
}

Core Endpoints

User Management

  • POST /api/users/signup - Register a new user
  • POST /api/users/login - Authenticate user
  • POST /api/users/forgot-password - Request password reset code
  • POST /api/users/verify-reset-code - Verify reset code
  • POST /api/users/reset-password - Reset user password
  • POST /api/users - Alternative user registration endpoint

Medical Records

  • POST /api/medical-info - Create a new medical record
  • GET /api/medical-info/latest - Get latest medical record for a user

Health Check

  • GET /api/health - Check API and database connectivity

Quick Start

Test the API connection:
curl http://localhost:3001/api/health
Response:
{
  "message": "Database connected",
  "time": {
    "now": "2026-03-05T10:30:00.000Z"
  }
}

Build docs developers (and LLMs) love