Skip to main content
POST
/
cases
/
create_case
Create Case
curl --request POST \
  --url https://api.example.com/cases/create_case \
  --header 'Content-Type: application/json' \
  --data '
{
  "user_id": "<string>",
  "patient_name": "<string>",
  "patient_age": 123,
  "patient_gender": "<string>",
  "case_summary": "<string>",
  "lab_files": [
    null
  ],
  "radiology_files": [
    null
  ]
}
'
{
  "message": "<string>",
  "case": {
    "case.case_id": "<string>",
    "case.user_id": "<string>",
    "case.patient_name": "<string>",
    "case.patient_age": 123,
    "case.patient_gender": "<string>",
    "case.case_summary": "<string>",
    "case.created_at": "<string>",
    "case.status": "<string>"
  },
  "uploaded_files": [
    {
      "uploaded_files[].file_id": "<string>",
      "uploaded_files[].file_name": "<string>",
      "uploaded_files[].file_type": "<string>",
      "uploaded_files[].file_size": 123,
      "uploaded_files[].file_url": "<string>",
      "uploaded_files[].file_category": "<string>"
    }
  ],
  "400 Bad Request": {},
  "500 Internal Server Error": {}
}

Authentication

This endpoint requires authentication. Include the user ID in the request body.

Request Body

This endpoint accepts multipart/form-data for file uploads.
user_id
string
required
The ID of the authenticated user (doctor) creating the case
patient_name
string
required
The full name of the patient
patient_age
integer
required
The age of the patient in years
patient_gender
string
required
The gender of the patient
case_summary
string
Optional summary or initial notes about the case from the doctor
lab_files
file[]
Optional array of laboratory report files (PDF, images, etc.)
radiology_files
file[]
Optional array of radiology report or imaging files

Response

message
string
Success message indicating the case was created
case
object
The created case object with all details
case.case_id
string
Unique UUID identifier for the case
case.user_id
string
ID of the doctor who created the case
case.patient_name
string
Patient’s full name
case.patient_age
integer
Patient’s age
case.patient_gender
string
Patient’s gender
case.case_summary
string
Case summary or notes
case.created_at
string
Timestamp when the case was created
case.status
string
Current status of the case (e.g., “pending”, “analyzing”)
uploaded_files
array
Array of uploaded file objects
uploaded_files[].file_id
string
Unique identifier for the file
uploaded_files[].file_name
string
Original filename
uploaded_files[].file_type
string
MIME type of the file
uploaded_files[].file_size
integer
File size in bytes
uploaded_files[].file_url
string
URL path to access the file
uploaded_files[].file_category
string
Category of the file (“lab” or “radiology”)

Example Request

curl -X POST https://api.medmitra.com/cases/create_case \
  -H "Content-Type: multipart/form-data" \
  -F "user_id=b8acad4b-4944-4d66-b405-de70886e7248" \
  -F "patient_name=John Doe" \
  -F "patient_age=45" \
  -F "patient_gender=male" \
  -F "case_summary=Patient presents with chest pain and shortness of breath" \
  -F "lab_files=@/path/to/lab_report.pdf" \
  -F "radiology_files=@/path/to/xray.jpg"

Example Response

{
  "message": "Case created successfully",
  "case": {
    "case_id": "a1b2c3d4-5678-90ab-cdef-1234567890ab",
    "user_id": "b8acad4b-4944-4d66-b405-de70886e7248",
    "patient_name": "John Doe",
    "patient_age": 45,
    "patient_gender": "male",
    "case_summary": "Patient presents with chest pain and shortness of breath",
    "status": "analyzing",
    "created_at": "2026-03-04T10:30:00Z"
  },
  "uploaded_files": [
    {
      "file_id": "f1e2d3c4-5678-90ab-cdef-1234567890ab",
      "file_name": "lab_report.pdf",
      "file_type": "application/pdf",
      "file_size": 245678,
      "file_url": "lab_files/a1b2c3d4-5678-90ab-cdef-1234567890ab/lab_report.pdf",
      "file_category": "lab"
    },
    {
      "file_id": "a9b8c7d6-5432-10fe-dcba-0987654321ab",
      "file_name": "xray.jpg",
      "file_type": "image/jpeg",
      "file_size": 1234567,
      "file_url": "radiology_files/a1b2c3d4-5678-90ab-cdef-1234567890ab/xray.jpg",
      "file_category": "radiology"
    }
  ]
}

Error Responses

400 Bad Request
error
Invalid request data or Supabase client error
{
  "detail": "Error message describing the validation failure"
}
500 Internal Server Error
error
Server error during case creation
{
  "detail": "Internal server error: {error details}"
}

Background Processing

After successful case creation, an AI-powered analysis task is automatically triggered in the background to:
  • Extract text from uploaded documents
  • Analyze lab results and radiology reports
  • Generate medical insights and recommendations
  • Update the case with AI-generated analysis
You can retrieve the analysis results using the Get Case by ID endpoint once processing is complete.

Build docs developers (and LLMs) love