The Products API manages the entire AutoPart Pro inventory. Public read access lets any visitor browse the catalog, while authenticated users can look up individual parts. All write operations — creating, updating, and deleting products — are restricted to accounts with theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/JFKoryy/autopart-pro/llms.txt
Use this file to discover all available pages before exploring further.
admin role. SKUs are the unique business identifier for each part and are automatically uppercased before storage. The PUT endpoint also fires an internal low-stock event via stockEmitter whenever an update brings a product’s stock at or below its configured minimum.
GET /api/products
Returns all products in the inventory ordered from newest to oldest (created_at DESC). No authentication is required. This is the primary endpoint for populating the storefront catalog and the admin inventory table.
Example request
Responses
true on a successful fetch.Array of product objects.
GET /api/products/:id
Fetches a single product by its database ID. Requires a valid Bearer token. Use this to populate a product detail page or a pre-filled edit form in the admin panel.Path parameters
The database ID of the product to retrieve.
Example request
Responses
true when the product is found.The full product object. Fields are identical to those described in
GET /api/products.POST /api/products
Creates a new product in the inventory. Requires a valid Bearer token with theadmin role. SKUs are automatically uppercased before being inserted. The sku column has a unique constraint — submitting a duplicate SKU returns a 400 error.
The
sku, name, and brand fields are required. All other fields are optional and default to null or 0 if omitted.Request body
Unique stock-keeping unit identifier. Automatically converted to uppercase before storage (e.g.
"filt-ace-002" → "FILT-ACE-002").Human-readable product name.
Manufacturer or brand name.
Comma-separated string of compatible vehicle makes and models.
Unit sale price. Must be
>= 0.Initial stock quantity. Must be an integer
>= 0.Publicly accessible URL for the product image.
Free-text description of the product.
Category label (e.g.
"Motor", "Frenos", "Eléctrico").Example request
Responses
true on successful creation.Confirmation:
"Autoparte registrada con éxito"The auto-incremented ID of the newly created product row.
PUT /api/products/:id
Partially updates an existing product. Only the fields included in the request body are modified — fields that are omitted remain unchanged. Requires a valid Bearer token with theadmin role. After every successful update, the server re-fetches the product and emits a low-stock event via stockEmitter if the current stock is at or below min_stock.
At least one field must be provided in the request body. Sending an empty object returns a server error.
Path parameters
The database ID of the product to update.
Request body
Any combination of the following fields. All are optional, but at least one must be present.New SKU value. Must be unique. Will be rejected with
400 if it collides with another product.Updated product name.
Updated brand.
Updated compatible vehicles string.
Updated unit price.
Updated stock level. If the new value is
<= min_stock, a low-stock event is fired server-side.Updated minimum stock threshold.
Updated image URL.
Updated description.
Updated category label.
Example request
Responses
true when the update is applied."Autoparte actualizada con éxito."DELETE /api/products/:id
Permanently removes a product from the inventory. Requires a valid Bearer token with theadmin role. This action is irreversible — consider setting stock to 0 instead if you want to keep sales history intact.
Path parameters
The database ID of the product to delete.
Example request
Responses
true when the product is deleted."Autoparte eliminada del inventario."GET /api/products/low-stock
Returns all products whose currentstock is at or below their configured min_stock threshold. Requires a valid Bearer token. Use this endpoint to power low-stock alert dashboards or automated reorder notifications.
Example request
Responses
true on a successful fetch.Array of low-stock entries.