> ## Documentation Index
> Fetch the complete documentation index at: https://docs.medisync.me/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete Appointment

> Permanently delete an appointment you own by its ID

## Overview

Permanently deletes an appointment. Access is owner-only: the appointment's
`doctor_id` must match the caller, otherwise a `403 Forbidden` is returned.

<Warning>
  This action is irreversible. The appointment and every document attached to it
  are permanently removed.
</Warning>

## Authentication

<ParamField header="Authorization" type="string" required>
  Bearer token for authenticated access.

  ```
  Authorization: Bearer <JWT>
  ```
</ParamField>

## Path Parameters

<ParamField path="id" type="string" required>
  Appointment ObjectId to delete. Owner-only. A malformed value fails with a
  `400` cast error.
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Whether the deletion succeeded. On success the body is `{ "success": true }`
  with no `data`.
</ResponseField>

## Example Request

<RequestExample>
  ```bash curl theme={null}
  curl -X DELETE "https://app.medisync.me/api/appointments/65f8a1b2c3d4e5f6789012ef" \
    -H "Authorization: Bearer <JWT>"
  ```
</RequestExample>

## Example Response

<ResponseExample>
  ```json Success theme={null}
  {
    "success": true
  }
  ```
</ResponseExample>

## Error Responses

<ResponseExample>
  ```json 404 Not Found theme={null}
  {
    "success": false,
    "error": "Appointment not found"
  }
  ```

  ```json 403 Forbidden theme={null}
  {
    "success": false,
    "error": "Forbidden"
  }
  ```

  ```json 400 Malformed ID theme={null}
  {
    "success": false,
    "error": "Cast to ObjectId failed for value \"abc\" (type string) at path \"_id\" for model \"Appointment\""
  }
  ```

  ```json 401 Unauthorized theme={null}
  {
    "success": false,
    "message": "Unauthorized"
  }
  ```
</ResponseExample>

<Note>
  `403 Forbidden` is returned when the appointment is owned by a different
  doctor. A missing or invalid Bearer token returns `401` with a `message` key.
</Note>

## Side Effects

* Every document attached to the appointment is cascade-deleted along with it.
* Other appointments that share the same `case_id` are **not** affected.
