Delete a photo
Current Home
Delete a photo
Remove a photo from the caller’s listing. Must keep at least one photo.
DELETE
Delete a photo
Overview
Removes the embedded photo identified byphotoId from the caller’s current-home listing. Returns the updated listing.
The server enforces a minimum of one photo per listing: attempting to delete the last remaining photo returns 400 VALIDATION_FAILED. The client should add a replacement first (via POST /current-home/me/photos) and then delete.
If the deleted photo was the cover, the next remaining photo by orderIndex becomes the new cover automatically. The remaining photos keep their orderIndex values — there is no compaction; the client can call Reorder photos afterwards if it wants a contiguous 0..N-1 sequence.
The underlying object in DigitalOcean Spaces is not deleted by this endpoint. Storage-side cleanup of orphaned objects is part of the Phase 7 retention sweep.
Authentication
Bearer <accessToken> required. Scope: user.
Path parameters
| Field | Type | Required | Notes / Constraints | Example |
|---|---|---|---|---|
photoId | string | yes | 24-char ObjectId of an existing embedded photo on the caller’s listing. | 66400a8f1c2b4d5e6f7a8d02 |
Query parameters
None.Request body
None.Response — 200 OK
Returns the updated Home object.photos no longer contains the deleted entry.
Error responses
| Status | Code | Meaning |
|---|---|---|
| 400 | VALIDATION_FAILED | photoId is not a 24-char hex ObjectId, OR deletion would drop the listing below one photo (cannot delete the only remaining photo; add another first). |
| 401 | UNAUTHENTICATED | Missing, malformed, or expired access token. |
| 404 | NOT_FOUND | The user has no current_homes listing, or photoId does not match any photo on this listing. |
Example error — 400
Side effects
$pulls the matching subdocument out ofcurrent_homes.photos[].- If the deleted photo was the cover, the next photo by
orderIndexis promoted toisCover: truein the same write. updatedAtis bumped.- The underlying Spaces object is not removed (Phase 7 cleanup sweep).
- No
match.recomputeis triggered.
See also
- Add listing photos — add a replacement first if you have only one photo.
- Reorder photos
- Set cover photo
- Get my current home