DELETE
/
api
/
v1
/
current-home
/
me
/
photos
/
{photoId}
Delete a photo
curl --request DELETE \
  --url https://api.example.com/api/v1/current-home/me/photos/{photoId}
import requests

url = "https://api.example.com/api/v1/current-home/me/photos/{photoId}"

response = requests.delete(url)

print(response.text)
const options = {method: 'DELETE'};

fetch('https://api.example.com/api/v1/current-home/me/photos/{photoId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/current-home/me/photos/{photoId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://api.example.com/api/v1/current-home/me/photos/{photoId}"

req, _ := http.NewRequest("DELETE", url, nil)

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.delete("https://api.example.com/api/v1/current-home/me/photos/{photoId}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/api/v1/current-home/me/photos/{photoId}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)

response = http.request(request)
puts response.read_body

Overview

Removes the embedded photo identified by photoId 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

FieldTypeRequiredNotes / ConstraintsExample
photoIdstringyes24-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.
{
  "home": {
    "id": "66400a8f1c2b4d5e6f7a8c00",
    "photos": [
      {
        "id": "66400a8f1c2b4d5e6f7a8d01",
        "url": "https://cdn.swappr.co.uk/listings/.../photo1.jpg",
        "thumbnailUrl": "https://cdn.swappr.co.uk/listings/.../photo1.jpg",
        "orderIndex": 0,
        "isCover": true,
        "fileSizeBytes": 2500000,
        "width": 0,
        "height": 0,
        "blurhash": "",
        "createdAt": "2026-05-22T14:32:08.412Z"
      }
      // ...remaining photos
    ]
    // ...rest of the home shape (see GET /current-home/me)
  }
}

Error responses

StatusCodeMeaning
400VALIDATION_FAILEDphotoId 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).
401UNAUTHENTICATEDMissing, malformed, or expired access token.
404NOT_FOUNDThe user has no current_homes listing, or photoId does not match any photo on this listing.

Example error — 400

{
  "type": "https://api.swappr.co.uk/errors/validation-failed",
  "title": "Validation failed",
  "status": 400,
  "code": "VALIDATION_FAILED",
  "detail": "cannot delete the only remaining photo; add another first",
  "instance": "/api/v1/current-home/me/photos/66400a8f1c2b4d5e6f7a8d01",
  "requestId": "01HZQ7K3M4N5P6Q7R8S9T0V1W2"
}

Side effects

  • $pulls the matching subdocument out of current_homes.photos[].
  • If the deleted photo was the cover, the next photo by orderIndex is promoted to isCover: true in the same write.
  • updatedAt is bumped.
  • The underlying Spaces object is not removed (Phase 7 cleanup sweep).
  • No match.recompute is triggered.

See also

curl

curl -X DELETE https://api.swappr.co.uk/api/v1/current-home/me/photos/66400a8f1c2b4d5e6f7a8d02 \
  -H "Authorization: Bearer $ACCESS_TOKEN"