Skip to main content
DELETE
/
api
/
properties
/
:id
Delete Property
curl --request DELETE \
  --url https://api.example.com/api/properties/:id \
  --header 'Authorization: <authorization>'
{
  "success": true,
  "message": "<string>"
}

Overview

Permanently delete a property and all associated data including images, location, and characteristics. This operation cannot be undone.

Authentication

Authorization
string
required
Bearer token. Admin role required.

Path Parameters

id
number
required
The property ID to delete.

Response

success
boolean
Indicates if the property was deleted successfully.
message
string
Success or error message.

Example Request

curl -X DELETE "https://api.example.com/api/properties/123" \
  -H "Authorization: Bearer YOUR_ADMIN_TOKEN"

Example Response

{
  "success": true,
  "message": "Property deleted successfully"
}

Error Responses

Not Found (404)

{
  "success": false,
  "message": "Property not found"
}

Invalid ID (400)

{
  "success": false,
  "message": "Invalid property ID"
}

Unauthorized (401)

{
  "success": false,
  "message": "Unauthorized"
}

Cascading Deletes

When a property is deleted, the following related records are automatically removed:
  • Property Location: The location record for the property
  • Property Images: All image records (metadata)
  • Storage Files: Physical image files (both large and thumbnail variants)
  • Characteristics: All property characteristics and values
  • User Favorites: Any user favorites referencing this property

Notes

  • This operation is permanent and cannot be undone
  • All associated database records are deleted via cascading foreign keys
  • Physical image files are deleted from storage (best-effort)
  • If image deletion fails, the database records are still removed (orphaned files may remain)
  • Consider implementing a “soft delete” (status change) instead for recoverable deletions

Build docs developers (and LLMs) love