API Ecommerce provides two complementary promotional systems: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.
- Discounts — automatic, date-based campaigns. The discount is applied transparently when a customer browses a product, category, or brand that falls within an active campaign’s date window. No customer action required.
- Coupons — customer-entered codes applied in the cart. The customer types the code at checkout and the discount is applied if the code is active, has uses remaining, and targets a matching product/category/brand.
Mutating operations on coupons (
store, update, destroy, delete_imagen) are throttled at 10 requests per minute per token. The discount campaign endpoints have no additional throttle middleware beyond the global request rate.Authentication
All/api/admin/ endpoints require:
Discount Campaigns
List Discounts
id descending.
Query parameters
Filter by campaign
code (SQL LIKE %value%). Codes are auto-generated with PHP’s uniqid().Total matching campaigns across all pages.
Paginated discount collection. Items live under the
data key (Laravel ResourceCollection envelope).Array of discount campaign objects. Each object includes
id, code, type_discount, discount, start_date, end_date, discount_type, type_campaing, state, created_at, and expanded products, categories, and brands pivot arrays.Create Discount Campaign
code is auto-generated via PHP’s uniqid() — you do not supply a code. Timezone is set to America/Bogota before date validation.
Request headers
| Header | Value |
|---|---|
| Authorization | Bearer <admin_token> |
| Content-Type | application/json |
Campaign type. Campaigns of the same
type_campaing and discount_type cannot overlap in date range on the same target entity.| Value | Meaning |
|---|---|
1 | Standard campaign |
2 | Flash sale |
What entity type the campaign targets.
| Value | Targets |
|---|---|
1 | Specific products |
2 | Specific categories |
3 | Specific brands |
How the discount amount is interpreted.
| Value | Meaning |
|---|---|
1 | Percentage discount |
2 | Fixed amount off |
1 = active. Only active campaigns are evaluated at browse time.Campaign start date in
YYYY-MM-DD format (Bogota timezone).Campaign end date in
YYYY-MM-DD format (inclusive; the API adds +1 day when evaluating Carbon::now()->between()).Discount value — a percentage (e.g.,
15 for 15% off) or a fixed currency amount, depending on type_discount.Required when
discount_type = 1. Array of objects with id and title for each targeted product.Required when
discount_type = 2. Array of objects with id and name for each targeted category.Required when
discount_type = 3. Array of objects with id and name for each targeted brand.200 on success, 403 on date-range conflict.The newly created discount campaign ID.
Get Discount Campaign
Discount campaign ID.
Full campaign object (via
DiscountResource) including id, code, type_discount, discount, start_date, end_date, discount_type, type_campaing, state, created_at, and expanded products, categories, and brands arrays with resolved product/category/brand data.Update Discount Campaign
Discount campaign ID to update.
discount_products, discount_categories, and discount_brands pivot rows are deleted and recreated from the new *_selected arrays. The same overlapping-date-range validation applies (excluding the current campaign ID from the conflict check).
Response
Delete Discount Campaign
Discount model’s deleting event automatically cascades the delete to associated discount_products, discount_categories, and discount_brands pivot rows.
Path parameters
Discount campaign ID to delete.
Coupons
List Coupons
id descending.
Query parameters
Filter by coupon
code (SQL LIKE %value%).Total matching coupons.
Paginated coupon collection. Items live under the
data key (Laravel ResourceCollection envelope).Array of coupon objects. Each includes
id, code, type_discount, discount, type_count, num_use, type_cupone, state, created_at, and expanded products, categories, and brands arrays.Get Coupon Config (Dropdowns)
Returns published products, active first-level categories, and active brands for populating coupon target selection dropdowns.Published products (
state = 2) with id, title, slug, and imagen (resolved OCI URL or null).Active first-level categories (
state = 1, categorie_second_id = NULL, categorie_third_id = NULL) with id, name, and imagen (resolved OCI URL or null).Active brands (
state = 1) with id and name.Create Coupon
code is supplied by the admin and must be unique. Customers enter this code at checkout.
Request headers
| Header | Value |
|---|---|
| Authorization | Bearer <admin_token> |
| Content-Type | application/json |
Coupon code string that customers enter at checkout (e.g.,
"SUMMER20", "INFLUENCER10"). Must be unique across all coupons.1 = active (can be applied by customers), 0 = inactive.What entity type the coupon targets.
| Value | Targets |
|---|---|
1 | Specific products |
2 | Specific categories |
3 | Specific brands |
How the discount is calculated.
| Value | Meaning |
|---|---|
1 | Percentage discount |
2 | Fixed amount off |
Discount value — either a percentage (e.g.,
20 for 20% off) or a fixed currency amount depending on type_discount.Usage limit type.
| Value | Meaning |
|---|---|
1 | Unlimited uses |
2 | Limited uses — num_use is decremented on each successful application |
Maximum number of times the coupon may be applied. Required when
type_count = 2. Decremented automatically on each successful use.Array of
{id} objects for targeted products. Pass an empty array [] when type_cupone is not 1.Array of
{id} objects for targeted categories. Pass an empty array [] when type_cupone is not 2.Array of
{id} objects for targeted brands. Pass an empty array [] when type_cupone is not 3.200 on success, 403 on duplicate code.The newly created coupon ID.
Get Coupon
Coupon ID.
Full coupon resource (via
CuponeResource) including id, code, type_discount, discount, type_count, num_use, type_cupone, state, created_at, and expanded products, categories, and brands arrays with resolved entity data and id_aux pivot IDs.Update Coupon
Coupon ID to update.
cupone_products, cupone_categories, and cupone_brands pivot rows are deleted and recreated from the new *_selected arrays. If the new code already belongs to a different coupon, returns {"message": 403, "message_text": "El cupón ya existe"}.
Response
Delete Coupon
Coupon ID to delete.