Skip to main content
PATCH
/
api
/
route-calls
/
:id
/
cover-photo
Update Cover Photo
curl --request PATCH \
  --url https://api.example.com/api/route-calls/:id/cover-photo \
  --header 'Content-Type: application/json' \
  --data '{}'
{
  "success": true,
  "data": {
    "id": "<string>",
    "context": "<string>",
    "routeCallId": "<string>",
    "userId": "<string>",
    "imageUrl": "<string>",
    "status": "<string>",
    "createdAt": "<string>",
    "updatedAt": "<string>"
  },
  "message": "<string>"
}

Overview

Update or set the cover photo for a route call. Only the route call organizer can perform this action. If a cover photo already exists, it will be replaced and the old file deleted from storage.

Authentication

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

Path Parameters

id
string
required
Route call ID (UUID format)

Request Body

This endpoint accepts multipart/form-data.
image
file
required
Image file to upload as cover photoAllowed formats: JPEG, JPG, PNG, GIF, WebPMaximum size: 5MBValidation:
  • MIME type must match file extension
  • Filename sanitized (only letters, numbers, dots, hyphens, underscores)
  • Maximum filename length: 255 characters

Response

success
boolean
Indicates if the cover photo was updated successfully
data
object
Updated photo details
id
string
Photo UUID
context
string
Always ROUTE_CALL_COVER
routeCallId
string
Route call ID
userId
string
Organizer’s user ID
imageUrl
string
Full URL to the new cover image
status
string
Always ACTIVE
createdAt
string
ISO 8601 timestamp
updatedAt
string
ISO 8601 timestamp of the update
message
string
Success message: “Cover photo updated successfully”

Error Responses

400 Bad Request
  • No file uploaded
  • Invalid file type
  • File size exceeds 5MB
  • File extension doesn’t match MIME type
401 Unauthorized
Invalid or missing authentication token
403 Forbidden
Only the organizer can update the cover photo
404 Not Found
Route call not found

Example Request

curl --request PATCH \
  --url https://api.losinmaduros.com/api/route-calls/123e4567-e89b-12d3-a456-426614174000/cover-photo \
  --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  --form 'image=@/path/to/cover.jpg'

Example Response

{
  "success": true,
  "data": {
    "id": "photo-uuid-here",
    "context": "ROUTE_CALL_COVER",
    "routeCallId": "123e4567-e89b-12d3-a456-426614174000",
    "userId": "user_2abc123def456",
    "imageUrl": "https://your-project.supabase.co/storage/v1/object/public/photos/route-calls/cover.jpg",
    "caption": null,
    "status": "ACTIVE",
    "createdAt": "2026-02-10T10:00:00Z",
    "updatedAt": "2026-02-10T11:30:00Z",
    "user": {
      "id": "user_2abc123def456",
      "name": "John",
      "imageUrl": "https://example.com/avatar.jpg"
    }
  },
  "message": "Cover photo updated successfully"
}

Behavior Notes

Replacing existing cover: If a cover photo already exists, the old file is deleted from Supabase Storage and the database record is updated with the new image URL.
First-time upload: If no cover photo exists, a new photo record is created with context ROUTE_CALL_COVER.

Build docs developers (and LLMs) love