Skip to main content
DELETE
/
api
/
photos
/
:id
Delete Photo
curl --request DELETE \
  --url https://api.example.com/api/photos/:id
{
  "success": true,
  "message": "<string>"
}

Overview

Delete a photo from the system. This performs both a soft delete in the database (sets status to DELETED) and removes the file from Supabase Storage.

Authentication

This endpoint requires a valid Bearer token in the Authorization header.
Authorization: Bearer YOUR_ACCESS_TOKEN

Path Parameters

id
string
required
Photo ID (UUID format)

Permissions

You can delete a photo if:
  • You are the owner of the photo, OR
  • You have the ADMIN role

Response

success
boolean
Indicates if the photo was deleted successfully
message
string
Success message: “Photo deleted successfully”

Error Responses

401 Unauthorized
Invalid or missing authentication token
403 Forbidden
You can only delete your own photos (unless you’re an admin)
404 Not Found
Photo not found

Example Request

curl --request DELETE \
  --url https://api.losinmaduros.com/api/photos/123e4567-e89b-12d3-a456-426614174000 \
  --header 'Authorization: Bearer YOUR_ACCESS_TOKEN'

Example Response

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

Deletion Process

When a photo is deleted:
  1. Permission check: Verifies you are the owner or an admin
  2. Storage deletion: Removes the file from Supabase Storage
  3. Database update: Sets the photo status to DELETED (soft delete)
This is a destructive operation. The file is permanently removed from storage, though the database record is preserved with DELETED status.

PhotoStatus Enum

Photos in the system can have the following statuses:
  • ACTIVE - Photo is visible in galleries
  • FLAGGED - Photo has been flagged for review
  • REJECTED - Photo was rejected by a moderator
  • DELETED - Photo has been deleted

PhotoContext Enum

Photos are categorized by context:
  • ROUTE_CALL_COVER - Cover photo for a route call
  • ROUTE_GALLERY - Photo in a route’s general gallery
  • ROUTE_CALL_GALLERY - Photo in a specific route call’s gallery

Build docs developers (and LLMs) love