Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/JuanSCaicedo/Api-Ecommerce/llms.txt

Use this file to discover all available pages before exploring further.

All endpoints under /api/admin/ require an admin JWT obtained via POST /api/auth/login with a user account where type_user=1. Products are the core resource in API Ecommerce — each product carries a cover image (portada/imagen), a gallery of additional images, associations to categories (up to three levels), a brand, variations, and specifications.
Mutating operations — store, update, destroy, and delete_imagen — are throttled at 10 requests per minute per token. Exceeding this limit returns HTTP 429.

Authentication

Obtain an admin token before calling any admin endpoint:
curl -s -X POST https://your-domain.com/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email": "admin@example.com", "password": "secret"}'
{
  "access_token": "eyJ0eXAiOiJKV1QiLC...",
  "token_type": "bearer",
  "expires_in": 3600
}
Use the returned token as Authorization: Bearer <admin_token> on every admin request.

List / Search Products

Filtering is handled via a dedicated POST endpoint so that multiple filter parameters can be sent in a JSON body rather than as query-string values.
POST /api/admin/products/index
Request headers
HeaderValue
AuthorizationBearer <admin_token>
Content-Typeapplication/json
Body parameters
Full-text search on the product title column (SQL LIKE %value%).
categorie_first_id
integer
Filter by first-level (top-level / department) category ID.
categorie_second_id
integer
Filter by second-level category ID.
categorie_third_id
integer
Filter by third-level (subcategory) ID.
brand_id
integer
Filter by brand ID.
Response — paginated, 10 products per page, ordered by id ascending.
total
integer
Total number of products matching the filters (across all pages).
products
object
Paginated product collection. Items live under the data key (Laravel ResourceCollection envelope).
products.data
array
Array of product objects for the current page. Each object includes resolved brand, categorie_first, categorie_second, categorie_third nested objects, a tags array decoded from JSON, an images gallery array, and timestamps.
{
  "total": 42,
  "products": {
    "data": [
      {
        "id": 7,
        "title": "Running Shoes Pro",
        "slug": "running-shoes-pro",
        "sku": null,
        "price_cop": 250000,
        "price_usd": 65,
        "resumen": "Lightweight running shoe for long distances.",
        "imagen": "https://objectstorage.us-phoenix-1.oraclecloud.com/.../products/cover.jpg",
        "state": 2,
        "description": "<p>Full HTML description...</p>",
        "tags": ["running", "sport"],
        "brand_id": 3,
        "brand": { "id": 3, "name": "Samsung" },
        "categorie_first_id": 1,
        "categorie_first": { "id": 1, "name": "Electronics" },
        "categorie_second_id": 4,
        "categorie_second": { "id": 4, "name": "Smartphones" },
        "categorie_third_id": null,
        "categorie_third": null,
        "stock": 120,
        "created_at": "2024-01-15 10:30:00",
        "images": [
          { "id": 5, "imagen": "https://objectstorage.../products/gallery1.jpg" }
        ]
      }
    ]
  }
}

Get Config Data (Dropdowns)

Returns the data needed to populate category and brand dropdowns in an admin UI.
GET /api/admin/products/config
Request headers
HeaderValue
AuthorizationBearer <admin_token>
Response
categories_first
array
Active first-level categories (state = 1, categorie_second_id = NULL, categorie_third_id = NULL).
categories_seconds
array
Active second-level categories (state = 1, categorie_second_id != NULL, categorie_third_id = NULL).
categories_thirds
array
Active third-level categories (state = 1, both categorie_second_id and categorie_third_id set).
brands
array
Active brands (state = 1).
{
  "categories_first": [{ "id": 1, "name": "Electronics" }],
  "categories_seconds": [{ "id": 4, "name": "Smartphones" }],
  "categories_thirds": [{ "id": 9, "name": "Android Phones" }],
  "brands": [{ "id": 3, "name": "Samsung" }]
}

Get Product

GET /api/admin/products/{id}
Path parameters
id
integer
required
The product ID.
Response
product
object
Full product resource (via ProductResource) including resolved brand, categorie_first, categorie_second, categorie_third nested objects, a decoded tags array, and a gallery images array. Variations and specifications are fetched via separate endpoints.
{
  "product": {
    "id": 7,
    "title": "Running Shoes Pro",
    "slug": "running-shoes-pro",
    "sku": null,
    "price_cop": 250000,
    "price_usd": 65,
    "resumen": "Lightweight running shoe for long distances.",
    "imagen": "https://objectstorage.us-phoenix-1.oraclecloud.com/.../products/cover.jpg",
    "state": 2,
    "description": "<p>Full HTML description...</p>",
    "tags": ["running", "sport"],
    "brand_id": 3,
    "brand": { "id": 3, "name": "Samsung" },
    "categorie_first_id": 1,
    "categorie_first": { "id": 1, "name": "Electronics" },
    "categorie_second_id": 4,
    "categorie_second": { "id": 4, "name": "Smartphones" },
    "categorie_third_id": null,
    "categorie_third": null,
    "stock": 120,
    "created_at": "2024-01-15 10:30:00",
    "images": [
      { "id": 5, "imagen": "https://objectstorage.../products/gallery1.jpg" }
    ]
  }
}

Create Product

POST /api/admin/products
If a product with the same title already exists the API returns {"message": 403, "message_text": "The product already exists"} without creating anything.
Request headers
HeaderValue
AuthorizationBearer <admin_token>
Content-Typemultipart/form-data
Body parameters
title
string
required
Product title. Must be unique across all products. The slug is auto-generated from this value using Str::slug() — do not supply a slug manually.
portada
file
Cover image file (JPEG/PNG). Uploaded to Oracle Cloud Infrastructure (OCI) Object Storage under juandevops/ecommerce/public/products/. The OCI storage path is saved in the imagen column.
multiselect
array
Tags array (sent as a multi-value field, e.g., multiselect[]=running&multiselect[]=sport). Internally mapped to the tags column as a JSON-encoded string.
sku
string
Stock-keeping unit identifier (optional free-text field).
price_cop
number
Price in Colombian Pesos (COP).
price_usd
number
Price in US Dollars (USD).
resumen
string
Short summary / meta description shown in product cards.
description
string
Full rich-text / HTML product description.
state
integer
Publication state. 1 = draft, 2 = published.
brand_id
integer
Foreign key to the brands table.
categorie_first_id
integer
Top-level category ID.
categorie_second_id
integer
Optional second-level category ID.
categorie_third_id
integer
Optional third-level category ID.
stock
integer
Total available stock units.
Response
message
integer
200 on success, 403 if a duplicate title is detected.
id
integer
The newly created product’s ID. Use this to attach images and variations.
{ "message": 200, "id": 42 }
Example — create a product
curl -X POST https://your-domain.com/api/admin/products \
  -H "Authorization: Bearer <admin_token>" \
  -F "title=Running Shoes Pro" \
  -F "price_cop=250000" \
  -F "price_usd=65" \
  -F "resumen=Lightweight running shoe for long distances." \
  -F "state=2" \
  -F "brand_id=3" \
  -F "categorie_first_id=1" \
  -F "categorie_second_id=4" \
  -F "stock=120" \
  -F "portada=@/path/to/cover.jpg" \
  -F "multiselect[]=running" \
  -F "multiselect[]=sport"

Update Product

Uses POST (not PUT/PATCH) because the request may include a multipart file upload.
POST /api/admin/products/{id}
Path parameters
id
integer
required
The product ID to update.
Body parameters Same fields as Create Product. When a new portada file is provided, the existing cover image is deleted from OCI before the new file is stored. The slug is always regenerated from title on every update.
If another product (different id) already uses the same title, the request returns {"message": 403, "message_text": "The product already exists"} and no update is applied.
Response
{ "message": 200 }

Delete Product

DELETE /api/admin/products/{id}
Deletes the product record and all associated gallery images from OCI Object Storage, followed by the cover image. The Product model uses the SoftDeletes trait, so the row is retained with a deleted_at timestamp.
A product that belongs to an existing sale cannot be deleted safely — validate order history before calling this endpoint.
Path parameters
id
integer
required
The product ID to delete.
Response
{ "message": 200 }

POST /api/admin/products/imagens
The imagens (gallery upload) action is not in the throttle list. Only store, update, destroy, and delete_imagen are throttled at 10 req/min.
Request headers
HeaderValue
AuthorizationBearer <admin_token>
Content-Typemultipart/form-data
Body parameters
product_id
integer
required
The ID of the product to attach this image to.
imagen_add
file
required
Image file to upload to OCI Object Storage under juandevops/ecommerce/public/products/.
Response
imagen
object
The newly created ProductImage record.
imagen.id
integer
Gallery image record ID (use this to delete the image later).
imagen.imagen
string
Public URL of the uploaded image on OCI Object Storage.
{
  "imagen": {
    "id": 15,
    "imagen": "https://objectstorage.us-phoenix-1.oraclecloud.com/.../products/abc123.jpg"
  }
}

DELETE /api/admin/products/imagens/{id}
Removes the image file from OCI Object Storage and deletes the ProductImage record. Path parameters
id
integer
required
The gallery image record ID (returned by Add Gallery Image).
Response
{ "message": 200 }

Product Specifications

Product specifications are key-value descriptors (e.g., Weight: 200g, Material: Leather) managed via the specifications sub-resource. The full CRUD surface is available at:
GET    /api/admin/specifications?product_id={id}   — list specs for a product
POST   /api/admin/specifications                   — create spec
PUT    /api/admin/specifications/{id}              — update spec
DELETE /api/admin/specifications/{id}              — delete spec
Specifications reference the same attributes and properties tables used by variations. See Variations & Attributes for how to manage those lookup tables. Duplicate attribute + property (or attribute + value_add) combinations on the same product are rejected with {"message": 403, "message_text": "Ya existe una especificación con estos datos"}.

Build docs developers (and LLMs) love