Overview
The Products API allows you to create, update, and delete products for a tenant. Products are the core items displayed on tenant websites, with support for pricing, images, badges, and featured status. Base Path:/tenant/{tenantId}/products
Authentication: Required (Laravel session auth)
Create Product
Path Parameters
The ID of the tenant
Request Body
Product name (max 100 characters)
Product description (max 500 characters)
Product price in USD (minimum 0, supports decimals)
Badge indicator for the productOptions:
hot, new, promoWhether the product is active and visible
Whether the product should be featured/highlighted
Validation Rules
- The tenant must have
activestatus - Blueprint-aware limits apply based on tenant plan
- Default plans allow 3-15 products depending on subscription tier
- Position is automatically assigned (next available position)
Response
Indicates if the operation was successful
Success or error message
The created product object
Update Product
Path Parameters
The ID of the tenant
The ID of the product to update
Request Body
All fields are the same as the Create Product endpoint. All fields are required when updating.Product name (max 100 characters)
Product description (max 500 characters)
Product price in USD (minimum 0)
Badge indicator:
hot, new, or promoActive status
Featured status
Validation Rules
- Product must belong to the specified tenant
- Tenant must have
activestatus - All create validation rules apply
Response
Indicates if the operation was successful
Success or error message
The updated product object (same structure as Create response)
Delete Product
Path Parameters
The ID of the tenant
The ID of the product to delete
Behavior
- Deletes the main product image file (if exists)
- Deletes all gallery images (Plan 3 feature)
- Gallery image database records are cascade-deleted via foreign key
- Removes the product record from the database
Response
Indicates if the operation was successful
Success or error message
Product Model
Database Schema
Products are stored in theproducts table with the following attributes:
| Field | Type | Description |
|---|---|---|
id | integer | Primary key |
tenant_id | integer | Foreign key to tenants table |
name | string(100) | Product name |
description | string(500) | Product description (nullable) |
price_usd | decimal(10,2) | Price in USD |
price_bs | decimal(10,2) | Price in Bolivares (nullable) |
image_filename | string | Main image filename (nullable) |
image_url | string | External image URL (nullable) |
position | integer | Display order |
is_active | boolean | Visibility status |
is_featured | boolean | Featured flag |
badge | enum | Badge type: hot, new, promo (nullable) |
created_at | timestamp | Creation date |
updated_at | timestamp | Last modification date |
Relationships
- Tenant: Each product belongs to one tenant (
tenant_idforeign key) - Gallery Images: Products can have multiple gallery images (Plan 3 only, max 2 per product)
Plan Limits
Product limits vary by subscription plan and blueprint:- Plan 1 (OPORTUNIDAD): 3 products
- Plan 2 (CRECIMIENTO): 10 products
- Plan 3 (VISIÓN): 15 products
- Blueprint-specific limits may override default plan limits
Features by Plan
| Feature | Plan 1 | Plan 2 | Plan 3 |
|---|---|---|---|
| Basic product info | ✓ | ✓ | ✓ |
| Main product image | ✓ | ✓ | ✓ |
| Badges (hot/new/promo) | ✓ | ✓ | ✓ |
| Featured products | ✓ | ✓ | ✓ |
| Gallery images (max 2) | ✗ | ✗ | ✓ |
Image Management
Product images are managed through separate upload endpoints:- Main Image:
POST /tenant/{tenantId}/upload/product/{productId} - Gallery Images:
POST /tenant/{tenantId}/upload/product/{productId}/gallery(Plan 3 only) - Delete Gallery Image:
DELETE /tenant/{tenantId}/upload/product/{productId}/gallery/{imageId}(Plan 3 only)
/storage/tenants/{tenantId}/ directory.
Error Codes
| HTTP Status | Description |
|---|---|
| 200 | Success |
| 422 | Validation error or business logic error |
| 401 | Unauthorized (not authenticated) |
| 403 | Forbidden (tenant inactive) |
| 404 | Product or tenant not found |
| 500 | Server error |