Skip to main content
GET
/
cases
/
files
/
{case_id}
Get Case Files
curl --request GET \
  --url https://api.example.com/cases/files/{case_id}
{
  "files": [
    {
      "files[].file_id": "<string>",
      "files[].case_id": 123,
      "files[].file_name": "<string>",
      "files[].file_type": "<string>",
      "files[].file_size": 123,
      "files[].file_url": "<string>",
      "files[].file_category": "<string>",
      "files[].uploaded_at": "<string>"
    }
  ],
  "404 Not Found": {},
  "400 Bad Request": {},
  "500 Internal Server Error": {}
}

Authentication

This endpoint requires authentication. The user_id is automatically retrieved from the authenticated session.

Path Parameters

case_id
integer
required
The unique identifier of the case whose files to retrieve

Response

files
array
Array of file objects associated with the case
files[].file_id
string
Unique identifier for the file
files[].case_id
integer
ID of the case the file belongs to
files[].file_name
string
Original filename
files[].file_type
string
MIME type of the file
files[].file_size
integer
File size in bytes
files[].file_url
string
URL path to access the file
files[].file_category
string
Category of the file (“lab” or “radiology”)
files[].uploaded_at
string
ISO 8601 timestamp when the file was uploaded

Example Request

curl -X GET "https://api.medmitra.com/cases/files/12345" \
  -H "Authorization: Bearer YOUR_TOKEN"

Example Response

{
  "files": [
    {
      "file_id": "f1e2d3c4-5678-90ab-cdef-1234567890ab",
      "case_id": 12345,
      "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",
      "uploaded_at": "2026-03-04T10:30:15Z"
    },
    {
      "file_id": "a9b8c7d6-5432-10fe-dcba-0987654321ab",
      "case_id": 12345,
      "file_name": "chest_xray.jpg",
      "file_type": "image/jpeg",
      "file_size": 1234567,
      "file_url": "radiology_files/a1b2c3d4-5678-90ab-cdef-1234567890ab/chest_xray.jpg",
      "file_category": "radiology",
      "uploaded_at": "2026-03-04T10:31:20Z"
    },
    {
      "file_id": "c8d7e6f5-4321-09ed-cba9-876543210fed",
      "case_id": 12345,
      "file_name": "ecg_report.pdf",
      "file_type": "application/pdf",
      "file_size": 98765,
      "file_url": "/files/12345/ecg_report.pdf",
      "file_category": "lab",
      "uploaded_at": "2026-03-04T11:15:45Z"
    }
  ]
}

Error Responses

404 Not Found
error
Case with the specified ID was not found or does not belong to the user
{
  "detail": "Case not found"
}
400 Bad Request
error
Invalid request or Supabase client error
{
  "detail": "Error message describing the issue"
}
500 Internal Server Error
error
Server error during file retrieval
{
  "detail": "Internal server error: {error details}"
}

Notes

  • This endpoint returns all files associated with a specific case
  • Files are categorized as either “lab” or “radiology” documents
  • The endpoint verifies that the case exists and belongs to the authenticated user
  • Files are returned in the order they were uploaded
  • Empty array is returned if the case has no files
  • Use the file_url to download or display the actual file content

Build docs developers (and LLMs) love