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.

The storefront exposes products via slug-based URLs. Every product detail response is assembled from the ProductEcommerceResource — a rich JSON object that includes pricing, categorization, variation trees, discount resolution, specifications, and review aggregates. Responses are cached per slug (with a 1-month TTL) so product pages load instantly even under heavy traffic. The cache is automatically flushed whenever a review is created or updated, or an order is placed. For endpoint routing and request/response documentation, see Home & Discovery. This page documents the shape of the product resource returned by that endpoint and by cart, checkout, and filter responses across the API.

Product Resource Fields

Every product object in the API conforms to the ProductEcommerceResource structure defined in app/Http/Resources/Ecommerce/Product/ProductEcommerceResource.php.
id
integer
Primary key of the product.
title
string
Display name of the product, e.g. "Wireless Headphones Pro".
slug
string
URL-safe identifier used in storefront routes, e.g. "wireless-headphones-pro".
sku
string
Stock-keeping unit code. Used internally for inventory management.
price_cop
number
Price in Colombian Pesos (COP). This is the field name in the full ProductEcommerceResource. Note: the embedded product summary inside cart items uses price_pen instead (as returned by CartEcommerceResource).
price_usd
number
Price in US Dollars (USD).
resumen
string
Short summary / excerpt shown in product cards and listing pages.
imagen
string (URL)
Absolute URL of the primary product image stored in OCI Object Storage. null if no image has been uploaded.
state
integer
Publication state. 1 = draft (not visible on storefront), 2 = published (visible). Only products with state=2 are returned by storefront endpoints.
description
string
Full HTML or plain-text description of the product.
tags
array
Raw parsed JSON tags array. Each element is an object as stored by the tag input widget.
tags_parse
array of strings
Flattened list of tag text strings, e.g. ["wireless", "bluetooth", "audio"]. Prefer this over tags for display.
brand_id
integer
Foreign key to the brand.
brand
object | null
Embedded brand object: { "id": 3, "name": "Sony" }. null if no brand is assigned.
categorie_first_id
integer
Foreign key to the top-level (department) category.
categorie_first
object | null
Embedded top-level category: { "id": 1, "name": "Electronics" }.
categorie_second_id
integer | null
Foreign key to the second-level category.
categorie_second
object | null
Embedded second-level category: { "id": 10, "name": "Computers" }.
categorie_third_id
integer | null
Foreign key to the third-level (subcategory).
categorie_third
object | null
Embedded subcategory: { "id": 100, "name": "Laptops" }.
stock
integer
Total stock available for the base product (without variations). For variation-based products, per-variation stock is tracked separately inside the variations array.
created_at
string
Creation timestamp formatted as "YYYY-MM-DD HH:mm:ss".
images
array
Additional product gallery images. Each element: { "id": 12, "imagen": "https://..." }.
discount_g
object | null
The best resolved discount for this product. Resolution priority: (1) active flash discount campaign (type_campaing=2), (2) highest-value regular discount among product-level, category-level, and brand-level discounts. null if no active discount applies.
{
  "id": 4,
  "code": "FLASH20",
  "type_discount": 1,
  "discount": 20,
  "start_date": "2024-06-01",
  "end_date": "2024-06-07",
  "type_campaing": 2
}
  • type_discount: 1 = percentage off, 2 = fixed amount off.
  • type_campaing: 1 = regular, 2 = flash sale.
avg_reviews
number
Average star rating across all reviews, rounded to 2 decimal places. 0 when no reviews exist.
count_reviews
integer
Total number of reviews for this product.
variations
array
Grouped variation tree. See the Variations section below.
specifications
array
Technical specifications. See the Specifications section below.

Variations Object

Variations are grouped by attribute (e.g. “Color”, “Size”) and support one level of nesting (sub-variations). The variations array on a product resource contains one element per distinct attribute group.
[
  {
    "attribute_id": 2,
    "attribute": {
      "name": "Color",
      "type_attribute": "color"
    },
    "variations": [
      {
        "id": 11,
        "product_id": 42,
        "attribute_id": 2,
        "attribute": { "name": "Color", "type_attribute": "color" },
        "propertie_id": 7,
        "propertie": { "name": "Black", "code": "#000000" },
        "value_add": null,
        "add_price": 0,
        "stock": 15,
        "state": 1,
        "subvariation": {
          "attribute_id": 3,
          "attribute": { "name": "Size", "type_attribute": "text" }
        },
        "subvariations": [
          {
            "id": 21,
            "product_id": 42,
            "attribute_id": 3,
            "attribute": { "name": "Size", "type_attribute": "text" },
            "propertie_id": 12,
            "propertie": { "name": "M", "code": null },
            "value_add": null,
            "add_price": 0,
            "stock": 8,
            "state": 1
          }
        ]
      }
    ]
  }
]
attribute_id
integer
The attribute this group belongs to (e.g. the ID for “Color”).
attribute.name
string
Human-readable attribute name, e.g. "Color", "Size", "Storage".
attribute.type_attribute
string
Rendering hint: "color" (render as color swatch), "text" (render as text button), "imagen" (render as image swatch).
variations[].id
integer
Unique variation ID used as product_variation_id when adding to the cart.
variations[].propertie
object | null
The specific property value: { "name": "Black", "code": "#000000" }. code is a hex color for color-type attributes, null otherwise.
variations[].value_add
string | null
Optional free-text extra value for the variation (e.g. a custom label).
variations[].add_price
number
Price surcharge added on top of the base product price for this variation.
variations[].stock
integer
Units available for this specific variation.
variations[].state
integer
1 = active, 0 = inactive.
variations[].subvariation
object | null
Summary of the child attribute group (present when this variation has sub-variations). Contains attribute_id and attribute.
variations[].subvariations
array
Child variations (anidado / nested). Each element has the same structure as a top-level variation item (id, attribute_id, attribute, propertie_id, propertie, value_add, add_price, stock, state). Empty array when there are no sub-variations.

Specifications Object

[
  {
    "id": 3,
    "product_id": 42,
    "attribute_id": 5,
    "attribute": { "name": "Connectivity", "type_attribute": "text" },
    "propertie_id": 9,
    "propertie": { "name": "Bluetooth 5.3", "code": null },
    "value_add": null
  }
]
Each specification is an attribute-property pair used to display a technical specs table on the product detail page.

Discount Resolution Logic

The discount_g field is resolved in this order of priority:
  1. Flash discount (type_campaing=2): If any active flash campaign applies to the product (directly, via its category, or via its brand), it takes precedence over all other discounts.
  2. Regular discounts: The highest-value discount among three sources is selected:
    • discount_product — discount targeting this product directly
    • discount_categorie — discount targeting the product’s top-level category
    • discount_brand — discount targeting the product’s brand
Each source returns either the active discount object or null.

Full Example Product JSON

{
  "id": 42,
  "title": "Wireless Headphones Pro",
  "slug": "wireless-headphones-pro",
  "sku": "WHP-001-BLK",
  "price_cop": 299900,
  "price_usd": 74.99,
  "resumen": "Premium wireless headphones with active noise cancellation.",
  "imagen": "https://objectstorage.example.com/ecommerce/products/whp001.webp",
  "state": 2,
  "description": "<p>Experience studio-quality audio...</p>",
  "tags": [],
  "tags_parse": ["wireless", "bluetooth", "noise-cancelling"],
  "brand_id": 3,
  "brand": { "id": 3, "name": "Sony" },
  "categorie_first_id": 1,
  "categorie_first": { "id": 1, "name": "Electronics" },
  "categorie_second_id": 10,
  "categorie_second": { "id": 10, "name": "Audio" },
  "categorie_third_id": null,
  "categorie_third": null,
  "stock": 0,
  "created_at": "2024-01-15 10:22:00",
  "images": [
    { "id": 55, "imagen": "https://objectstorage.example.com/ecommerce/products/whp001-side.webp" }
  ],
  "discount_g": {
    "id": 4,
    "code": "AUDIO20",
    "type_discount": 1,
    "discount": 20,
    "start_date": "2024-06-01",
    "end_date": "2024-06-30",
    "type_campaing": 1
  },
  "variations": [
    {
      "attribute_id": 2,
      "attribute": { "name": "Color", "type_attribute": "color" },
      "variations": [
        {
          "id": 11,
          "product_id": 42,
          "attribute_id": 2,
          "attribute": { "name": "Color", "type_attribute": "color" },
          "propertie_id": 7,
          "propertie": { "name": "Black", "code": "#000000" },
          "value_add": null,
          "add_price": 0,
          "stock": 15,
          "state": 1,
          "subvariation": null,
          "subvariations": []
        }
      ]
    }
  ],
  "avg_reviews": 4.75,
  "count_reviews": 8,
  "specifications": [
    {
      "id": 3,
      "product_id": 42,
      "attribute_id": 5,
      "attribute": { "name": "Connectivity", "type_attribute": "text" },
      "propertie_id": 9,
      "propertie": { "name": "Bluetooth 5.3", "code": null },
      "value_add": null
    }
  ]
}
Only products with state=2 are returned by any storefront endpoint. Products in state=1 (draft) are invisible to customers and will not appear in listings, search results, or direct slug lookups.

Build docs developers (and LLMs) love