Skip to main content
DELETE
/
api
/
agenda
/
bookings
/
{id}
Delete Booking
curl --request DELETE \
  --url https://api.example.com/api/agenda/bookings/{id}
{
  "success": true,
  "401 Unauthorized": {},
  "400 Bad Request": {},
  "404 Not Found": {}
}
Permanently deletes a booking from the system. This action cannot be undone.
This is a destructive operation. Consider updating the booking status to cancelled instead of deleting if you need to maintain historical records.

Authentication

This endpoint requires authentication via Bearer token in the Authorization header or auth_token cookie.
Authorization: Bearer YOUR_TOKEN

Path Parameters

id
string
required
The unique identifier (UUID) of the booking to deleteExample: abc123-def456-ghi789

Response

Returns a success confirmation object.
success
boolean
Indicates whether the deletion was successfulWill always be true if the request succeeds

Examples

curl -X DELETE 'https://api.beils.com/api/agenda/bookings/abc123-def456-ghi789' \
  -H 'Authorization: Bearer YOUR_TOKEN'

Response Example

{
  "success": true
}

Error Responses

401 Unauthorized
error
Missing or invalid authentication token
{
  "statusCode": 401,
  "statusMessage": "Unauthorized: Token is missing or invalid"
}
400 Bad Request
error
Missing or invalid booking ID
{
  "statusCode": 400,
  "statusMessage": "Booking ID is required"
}
404 Not Found
error
Booking with the specified ID does not existThis error occurs when:
  • The booking has already been deleted
  • The ID is invalid or doesn’t exist in the database
  • The booking belongs to a different organization (if multi-tenancy is implemented)

Best Practices

Consider Soft Deletes: Instead of permanently deleting bookings, consider updating the status to cancelled. This approach:
  • Maintains historical records for reporting
  • Prevents accidental data loss
  • Allows tracking of cancellation patterns
  • Supports potential booking restoration
Instead of deleting, update the booking status:
curl -X PUT 'https://api.beils.com/api/agenda/bookings/abc123-def456-ghi789' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "status": "cancelled",
    "notes": "Cancelled by client on 2024-03-05"
  }'

Use Cases for Deletion

Permanent deletion should typically only be used for:
  • Test Data Cleanup: Removing test bookings created during development or testing
  • Duplicate Entries: Eliminating accidental duplicate bookings
  • Data Privacy Compliance: Honoring user data deletion requests (GDPR, etc.)
  • Invalid Data: Removing bookings created with incorrect or corrupt data

Notes

  • This operation is irreversible - deleted bookings cannot be recovered
  • The deletion cascades based on database constraints defined in the Prisma schema
  • Consider implementing role-based access control to restrict deletion permissions to administrators only
  • Audit logging is recommended for tracking who deleted which bookings and when
  • For cancelled appointments, use the Update Booking endpoint with status: "cancelled" instead

Build docs developers (and LLMs) love