Welcome to the MedMitra API
The MedMitra API is a RESTful service that powers the MedMitra medical case management platform. It provides endpoints for managing patient cases, uploading medical documents, and accessing AI-powered insights for diagnosis support.Base URL
The API is built with FastAPI and runs on:API Version
Current version: 1.0.0 The API version follows semantic versioning. Breaking changes will result in a major version bump.API Architecture
Technology Stack
- Framework: FastAPI (Python)
- Database: Supabase (PostgreSQL)
- Storage: Supabase Storage for file uploads
- Authentication: Supabase Auth with JWT tokens
- AI Processing: Background task processing with async workers
Core Capabilities
The MedMitra API enables you to:- Case Management: Create, retrieve, update, and delete patient cases
- Document Processing: Upload and manage lab reports and radiology images
- AI Insights: Access automated case summaries, SOAP notes, and diagnostic suggestions
- File Management: Handle multi-file uploads with categorization
- Background Processing: AI analysis runs asynchronously after case creation
Request Format
Content Types
The API accepts different content types depending on the endpoint:- JSON:
application/jsonfor most GET requests and data queries - Form Data:
multipart/form-datafor file uploads and case creation - URL Parameters: Query parameters for filtering and pagination
Headers
All authenticated requests require:Response Format
Success Responses
Successful responses return JSON with appropriate HTTP status codes:Error Responses
Error responses include detailed error messages:Status Codes
The API uses standard HTTP status codes:| Code | Description |
|---|---|
| 200 | Success - Request completed successfully |
| 201 | Created - Resource created successfully |
| 400 | Bad Request - Invalid parameters or request body |
| 401 | Unauthorized - Missing or invalid authentication |
| 404 | Not Found - Resource does not exist |
| 500 | Internal Server Error - Server-side error |
API Features
Background Processing
When you create a case with files, the API:- Immediately creates the case record (returns 201)
- Uploads files to storage
- Starts AI processing in the background
- Updates the case with insights when analysis completes
File Categories
Uploaded files are categorized as:- lab: Laboratory reports, blood tests, pathology results
- radiology: X-rays, CT scans, MRI images, ultrasounds
Case Status Flow
- processing: Case is created, AI analysis is running
- completed: Analysis finished successfully
- failed: Analysis encountered an error
Rate Limits
Currently, the API does not enforce rate limits. However, for production deployments, consider implementing:- Per-user rate limiting
- File size restrictions
- Concurrent request limits
API Playground
Test API endpoints using:- FastAPI Docs: Available at
http://localhost:8000/docs(Swagger UI) - ReDoc: Available at
http://localhost:8000/redoc(alternative documentation)
Getting Started
To start using the MedMitra API:- Set up authentication - See the Authentication guide
- Create your first case - Use the Create Case endpoint
- Retrieve AI insights - Query the Get Case by ID endpoint
Need Help?
For support and questions:- Check the endpoint documentation for detailed examples
- Review error messages in responses
- Consult the GitHub repository for code examples
