List Photos
curl -X GET https://your-domain.com/api/photos \
-H "Cookie: your-session-cookies"
Retrieves all photos for the authenticated user, ordered by creation date (most recent first).
Response
Array of photo objects
Unique identifier for the photo
ID of the user who owns the photo
ID of the album containing this photo, or null if not in an album
Public URL of the photo stored in Vercel Blob
Original filename of the uploaded photo
MIME type of the file (e.g., “image/jpeg”)
Width of the image in pixels, or null if not set
Height of the image in pixels, or null if not set
ISO 8601 timestamp when the photo was uploaded
Response Example
[
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"user_id": "user-123",
"album_id": "album-456",
"blob_url": "https://blob.vercel-storage.com/photos/user-123/1709550000000-vacation.jpg",
"file_name": "vacation.jpg",
"file_size": 2458624,
"file_type": "image/jpeg",
"width": 1920,
"height": 1080,
"created_at": "2026-03-04T10:30:00.000Z"
}
]
Error Responses
{
"error": "No autorizado"
}
User is not authenticated.Show 500 Internal Server Error
{
"error": "Error al obtener fotos"
}
Server error occurred while fetching photos.
Upload Photo
curl -X POST https://your-domain.com/api/photos/upload \
-H "Cookie: your-session-cookies" \
-F "file=@/path/to/photo.jpg" \
-F "album_id=album-456"
Uploads a new photo to Vercel Blob storage and creates a database record.
Request Body
Content-Type: multipart/form-data
The image file to upload. Supported formats: JPEG, PNG, GIF, WebP, etc.
Optional. ID of the album to add this photo to. If not provided or null, the photo will not be assigned to any album.
Response
Returns the created photo object:
Unique identifier for the uploaded photo
ID of the user who owns the photo
ID of the album, or null if not assigned
Public URL of the uploaded photo
Initially null (can be updated later)
Initially null (can be updated later)
ISO 8601 timestamp when uploaded
Response Example
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"user_id": "user-123",
"album_id": "album-456",
"blob_url": "https://blob.vercel-storage.com/photos/user-123/1709550000000-vacation.jpg",
"file_name": "vacation.jpg",
"file_size": 2458624,
"file_type": "image/jpeg",
"width": null,
"height": null,
"created_at": "2026-03-04T10:30:00.000Z"
}
Error Responses
{
"error": "No se proporciono archivo"
}
No file was provided in the request.
{
"error": "No autorizado"
}
User is not authenticated.Show 500 Internal Server Error
{
"error": "Error al subir"
}
Server error occurred during upload.
Delete Photo
curl -X DELETE https://your-domain.com/api/photos/delete \
-H "Cookie: your-session-cookies" \
-H "Content-Type: application/json" \
-d '{"id": "123e4567-e89b-12d3-a456-426614174000"}'
Deletes a photo from both Vercel Blob storage and the database.
Request Body
The unique identifier of the photo to delete
Request Example
{
"id": "123e4567-e89b-12d3-a456-426614174000"
}
Response
Returns true when deletion is successful
Response Example
Error Responses
{
"error": "No se proporciono ID"
}
Photo ID was not provided.
{
"error": "No autorizado"
}
User is not authenticated.
{
"error": "Foto no encontrada"
}
Photo with the given ID does not exist or does not belong to the user.Show 500 Internal Server Error
{
"error": "Error al eliminar"
}
Server error occurred during deletion.
Move Photo
curl -X PATCH https://your-domain.com/api/photos/move \
-H "Cookie: your-session-cookies" \
-H "Content-Type: application/json" \
-d '{"id": "123e4567-e89b-12d3-a456-426614174000", "album_id": "album-789"}'
Moves a photo to a different album or removes it from an album.
Request Body
The unique identifier of the photo to move
The ID of the destination album. Set to null or omit to remove the photo from all albums.
Request Example
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"album_id": "album-789"
}
To remove from album:
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"album_id": null
}
Response
Returns the updated photo object:
The complete photo object with updated album_id
Response Example
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"user_id": "user-123",
"album_id": "album-789",
"blob_url": "https://blob.vercel-storage.com/photos/user-123/1709550000000-vacation.jpg",
"file_name": "vacation.jpg",
"file_size": 2458624,
"file_type": "image/jpeg",
"width": 1920,
"height": 1080,
"created_at": "2026-03-04T10:30:00.000Z"
}
Error Responses
{
"error": "No se proporciono ID"
}
Photo ID was not provided.
{
"error": "No autorizado"
}
User is not authenticated.Show 500 Internal Server Error
{
"error": "Error al mover foto"
}
Server error occurred while moving the photo.
Update Photo Dimensions
curl -X PATCH https://your-domain.com/api/photos/dimensions \
-H "Cookie: your-session-cookies" \
-H "Content-Type: application/json" \
-d '{"id": "123e4567-e89b-12d3-a456-426614174000", "width": 1920, "height": 1080}'
Updates the width and height metadata for a photo.
Request Body
The unique identifier of the photo to update
Width of the image in pixels
Height of the image in pixels
Request Example
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"width": 1920,
"height": 1080
}
Response
Returns the updated photo object:
The complete photo object with updated dimensions
Response Example
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"user_id": "user-123",
"album_id": "album-456",
"blob_url": "https://blob.vercel-storage.com/photos/user-123/1709550000000-vacation.jpg",
"file_name": "vacation.jpg",
"file_size": 2458624,
"file_type": "image/jpeg",
"width": 1920,
"height": 1080,
"created_at": "2026-03-04T10:30:00.000Z"
}
Error Responses
{
"error": "No se proporciono ID"
}
Photo ID was not provided.
{
"error": "No autorizado"
}
User is not authenticated.Show 500 Internal Server Error
{
"error": "Error al actualizar dimensiones"
}
Server error occurred while updating dimensions.