Skip to main content
DELETE
/
documents
/
{id}
curl -X DELETE \
  'https://app.medisync.me/api/documents/66a3f1c2b8e4d21f9c0a7b31' \
  -H 'Authorization: Bearer your_jwt_token_here'
const response = await fetch(
  'https://app.medisync.me/api/documents/66a3f1c2b8e4d21f9c0a7b31',
  {
    method: 'DELETE',
    headers: { Authorization: 'Bearer your_jwt_token_here' },
  }
);

const result = await response.json();
import requests

response = requests.delete(
    'https://app.medisync.me/api/documents/66a3f1c2b8e4d21f9c0a7b31',
    headers={'Authorization': 'Bearer your_jwt_token_here'},
)

result = response.json()
{
  "success": true,
  "data": {}
}

Overview

Permanently deletes a document. The id in the path is the document ID (Document._id), not an appointment ID. The document must be owned by the authenticated doctor; a document that does not exist or is owned by someone else returns 404.
This action is irreversible. The file is removed from storage and the record is removed from the database.
This endpoint is plan-gated by the documents.attach_additional feature. Accounts whose plan does not include it receive 403 FEATURE_NOT_AVAILABLE.

Authentication

Authorization
string
required
Bearer token for authenticated access. The doctor’s ID is extracted from the JWT token and used to scope ownership.
Authorization: Bearer your_jwt_token_here

Path Parameters

id
string
required
The document ID (Document._id, ObjectId) to delete. Must be owned by the authenticated doctor, otherwise a 404 is returned.

Response

success
boolean
Whether the deletion was successful
data
object
Empty object ({}) on successful deletion
error
string
Error message (only present when success is false)

Example Request

curl -X DELETE \
  'https://app.medisync.me/api/documents/66a3f1c2b8e4d21f9c0a7b31' \
  -H 'Authorization: Bearer your_jwt_token_here'
const response = await fetch(
  'https://app.medisync.me/api/documents/66a3f1c2b8e4d21f9c0a7b31',
  {
    method: 'DELETE',
    headers: { Authorization: 'Bearer your_jwt_token_here' },
  }
);

const result = await response.json();
import requests

response = requests.delete(
    'https://app.medisync.me/api/documents/66a3f1c2b8e4d21f9c0a7b31',
    headers={'Authorization': 'Bearer your_jwt_token_here'},
)

result = response.json()

Example Response

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

Error Responses

{
  "success": false,
  "error": "Document not found for deletion"
}
{
  "success": false,
  "error": "Error deleting document from storage"
}
{
  "success": false,
  "error": "Error deleting document from database"
}
{
  "success": false,
  "code": "FEATURE_NOT_AVAILABLE",
  "feature": "documents.attach_additional",
  "message": "This feature is not included in your current plan."
}
{
  "success": false,
  "message": "Unauthorized"
}

Behavior

  • Two-phase deletion: the file is deleted from storage first, then the database record. If storage deletion fails, the database record is not removed and a 400 is returned.