Overview
The Image Upload API provides endpoints to upload images for tenant logos, hero banners, products, services, and gallery images. All uploads are processed and converted to WebP format for optimal performance.Image Processing
- Format: All images are converted to WebP
- Storage:
/storage/tenants/{tenantId}/ - URL Pattern:
https://example.com/storage/tenants/{tenantId}/{filename} - Validation: Files must be valid images
All image upload endpoints require authentication (
auth middleware).Upload Logo
Upload a logo image for a tenant. The logo is typically displayed in the header/navbar.Path Parameters
The ID of the tenant
Request Body
The logo image file (must be a valid image format)
Response
Whether the upload was successful
The generated filename (e.g.,
logo.webp)Full URL to access the uploaded image
Example
Upload Hero Image
Upload a hero banner image for the main landing page section.Path Parameters
The ID of the tenant
Request Body
The hero banner image file
Response
Whether the upload was successful
The generated filename (e.g.,
hero.webp)Full URL to access the uploaded image
Upload Product Image
Upload an image for a specific product. If the product already has an image, it will be deleted and replaced.Path Parameters
The ID of the tenant
The ID of the product
Request Body
The product image file
Filename Pattern
Generated filename:product_{index}.webp
Where index is calculated as:
- Product’s
positionfield (if set) - Or:
(product.id % 99) + 1
product_01.webpproduct_12.webp
Response
Whether the upload was successful
The generated filename
Full URL to access the uploaded image
Upload Service Image
Upload an image for a specific service. If the service already has an image, it will be deleted and replaced.Path Parameters
The ID of the tenant
The ID of the service
Request Body
The service image file
Filename Pattern
Generated filename:service_{index}.webp
Where index is calculated as:
- Service’s
positionfield (if set) - Or:
(service.id % 99) + 1
Response
Whether the upload was successful
The generated filename
Full URL to access the uploaded image
Upload About Image
Upload an image for the “About Us” section of the landing page.Path Parameters
The ID of the tenant
Request Body
The about section image file
Image Specifications
- Filename:
about.webp - Max Width: 1200px (automatically resized)
Response
Whether the upload was successful
Always
about.webpFull URL to access the uploaded image
Upload Product Gallery Image
Upload additional gallery images for a product. Each product can have up to 2 gallery images (plus the main product image = 3 total).Path Parameters
The ID of the tenant (must be Plan 3 / VISIÓN)
The ID of the product
Request Body
The gallery image file
Filename Pattern
product_{productIndex}_gallery_{position}.webp
Examples:
product_01_gallery_1.webpproduct_01_gallery_2.webp
Limits
- Max gallery images per product: 2
- Total images per product: 3 (1 main + 2 gallery)
Response
Whether the upload was successful
Database ID of the created ProductImage record
The generated filename
Full URL to access the uploaded image
Position index (0 or 1)
Total number of gallery images after upload
Delete Product Gallery Image
Delete a specific gallery image from a product. Remaining images are automatically reordered.Path Parameters
The ID of the tenant
The ID of the product
The ID of the ProductImage record to delete
Response
Whether the deletion was successful
Success message
Number of gallery images remaining after deletion
Auto-Reordering
After deletion, remaining gallery images are automatically reordered:Image Processing Details
ImageUploadService
All images are processed through theImageUploadService which:
- Validates the file is a valid image
- Resizes images to optimal dimensions
- Converts to WebP format for performance
- Stores in the tenant’s directory
- Returns the generated filename
Storage Structure
Public Access
Images are accessible via the public storage symlink:https://example.com/storage/tenants/{tenantId}/{filename}