Skip to main content

Overview

Delete the medical document associated with a specific appointment in MediSync. This operation permanently removes the document from both the database and secure storage.
Permanent Deletion: This operation cannot be undone. The document will be permanently removed from both the database and cloud storage.

Authentication

curl -X DELETE \
  'https://app.medisync.me/api/documents/65f1a2b3c4d5e6f7g8h9i0j1' \
  -H 'Authorization: Bearer YOUR_API_TOKEN'

Path Parameters

id
string
required
The appointment ID to delete the document for

Response

success
boolean
Whether the deletion was successful
data
object
Empty object returned on successful deletion
error
string
Error message if the deletion failed

Response Examples

Successful Deletion

{
  "success": true,
  "data": {}
}

Document Not Found Error

{
  "success": false,
  "error": "Document not found for deletion"
}

Storage Deletion Error

{
  "success": false,
  "error": "Error deleting document from storage"
}

Database Deletion Error

{
  "success": false,
  "error": "Error deleting document from database"
}

Business Logic

  1. Appointment-Based Deletion: Documents are deleted using the appointment ID, not the document ID directly.
  2. Two-Phase Deletion: The system first removes the file from cloud storage, then removes the database record.
  3. Complete Removal: Both the file content and all metadata are permanently deleted.
  4. Audit Logging: Deletion operations are logged for audit and compliance purposes.

Error Handling

  • 404 Not Found: No document exists for the specified appointment ID
  • 400 Bad Request:
    • Error deleting document from storage
    • Error deleting document from database
  • 401 Unauthorized: Invalid or missing authentication token
  • 500 Internal Server Error: Unexpected server error during deletion

Notes

  • This operation is irreversible - deleted documents cannot be recovered
  • Both storage and database records are removed completely
  • The operation succeeds only if both storage and database deletions are successful
  • Deletion is logged for audit and compliance tracking
  • No document ID is required - only the appointment ID