Skip to main content
The Inventory endpoints give you programmatic access to your full product catalog and warehouse stock data in SmartPyme. You can filter by category, brand, or stock status to build integrations such as low-stock alerts, e-commerce catalog syncs, or cost-of-goods reports. All requests must include your API key in the Authorization header.

GET /inventory

Returns a paginated list of products from your catalog. Each product record includes pricing, cost, and an inventarios array showing current stock levels broken down by warehouse and branch.
curl --request GET \
  --url "https://api.smartpyme.site/api/external/v1/inventory?marca=Dell&con_stock=true&per_page=50" \
  --header "Authorization: Bearer {api_key}"

Query parameters

codigo
string
Filter by product SKU or internal code. Performs a partial match.
nombre
string
Filter by product name. Performs a partial, case-insensitive match.
categoria
string
Filter by category name. Performs a partial match against nombre_categoria.
marca
string
Filter by brand name. Performs a partial match.
tipo
string
Filter by product type. Accepted values: Producto, Servicio.
enable
integer
Filter by active status. Use 1 for active products and 0 for inactive products.
con_stock
boolean
When true, returns only products that have stock greater than zero across at least one warehouse.
stock_minimo
boolean
When true, returns only products whose current stock is at or below their configured minimum stock threshold.
page
integer
Page number to retrieve. Defaults to 1.
per_page
integer
Number of records per page. Accepts values between 1 and 200. Defaults to 100.
order_by
string
Field to sort results by. Accepted values: nombre, codigo, precio, costo, created_at.
order_direction
string
Sort direction. Accepted values: asc, desc.

Response example

{
  "success": true,
  "data": [
    {
      "id": 301,
      "nombre": "Laptop Dell Inspiron 15",
      "descripcion": "Laptop 15.6\" Intel Core i5, 8GB RAM, 512GB SSD",
      "codigo": "LAP-DELL-015",
      "barcode": "7501234567890",
      "nombre_categoria": "Electrónicos",
      "precio": 850.00,
      "costo": 620.00,
      "costo_anterior": 610.00,
      "costo_promedio": 615.50,
      "marca": "Dell",
      "tipo": "Producto",
      "enable": 1,
      "img": "https://cdn.smartpyme.site/products/lap-dell-015.jpg",
      "created_at": "2024-06-01T08:00:00Z",
      "updated_at": "2025-01-10T14:22:00Z",
      "inventarios": [
        {
          "id_producto": 301,
          "stock": 12,
          "stock_minimo": 5,
          "stock_maximo": 50,
          "nota": null,
          "nombre_bodega": "Bodega Principal",
          "nombre_sucursal": "Sucursal Central"
        },
        {
          "id_producto": 301,
          "stock": 4,
          "stock_minimo": 2,
          "stock_maximo": 20,
          "nota": "Revisar vencimiento",
          "nombre_bodega": "Bodega Norte",
          "nombre_sucursal": "Sucursal Norte"
        }
      ]
    }
  ],
  "pagination": {
    "current_page": 1,
    "per_page": 50,
    "total": 1,
    "total_pages": 1,
    "has_next": false,
    "has_prev": false
  },
  "meta": {
    "empresa": "Mi Empresa S.A.",
    "timestamp": "2025-01-31T15:00:00Z",
    "filters_applied": {
      "marca": "Dell",
      "con_stock": true
    }
  }
}

Response fields

success
boolean
Indicates whether the request completed successfully.
data
array
Array of product objects matching the applied filters.

GET /inventory/{id}

Retrieves a single product record by its numeric ID. The response returns the same full Product object described above, including the inventarios array with stock levels per warehouse.

Path parameter

id
integer
required
The unique numeric identifier of the product you want to retrieve.
curl --request GET \
  --url "https://api.smartpyme.site/api/external/v1/inventory/301" \
  --header "Authorization: Bearer {api_key}"
The response wraps the Product object under a data key with "success": true. All fields, including inventarios, are identical to the structure documented in the GET /inventory response above.

GET /inventory/summary

Returns aggregate statistics for your entire product catalog and combined stock position. Use this endpoint to get a quick overview of catalog health — how many products are active, total stock on hand, total inventory value, and which categories contain the most products.
curl --request GET \
  --url "https://api.smartpyme.site/api/external/v1/inventory/summary" \
  --header "Authorization: Bearer {api_key}"

Response example

{
  "success": true,
  "data": {
    "productos": {
      "total": 500,
      "activos": 480,
      "inactivos": 20
    },
    "inventario": {
      "stock_total": 15750.5,
      "valor_total": 125000.75,
      "productos_con_stock": 450,
      "productos_sin_stock": 30,
      "productos_stock_bajo": 15
    },
    "productos_por_categoria": [
      { "categoria": "Electrónicos", "cantidad": 150 },
      { "categoria": "Ropa",         "cantidad": 200 }
    ]
  },
  "meta": {
    "empresa": "Mi Empresa S.A.",
    "timestamp": "2025-01-31T15:00:00Z",
    "filters_applied": {}
  }
}

Response fields

data.productos.total
integer
Total number of products in your catalog, regardless of status.
data.productos.activos
integer
Number of products currently marked as active (enable = 1).
data.productos.inactivos
integer
Number of products currently marked as inactive (enable = 0).
data.inventario.stock_total
number
Sum of all stock quantities across every product and warehouse.
data.inventario.valor_total
number
Total inventory value calculated using each product’s average cost (costo_promedio) multiplied by its current stock.
data.inventario.productos_con_stock
integer
Number of distinct products that have at least one unit in stock across any warehouse.
data.inventario.productos_sin_stock
integer
Number of distinct products with zero stock across all warehouses.
data.inventario.productos_stock_bajo
integer
Number of products whose current stock is at or below their configured stock_minimo threshold in at least one warehouse.
data.productos_por_categoria
array
List of product counts grouped by category.
meta.empresa
string
Display name of the company associated with your API key.
meta.timestamp
string
ISO 8601 timestamp indicating when the summary was generated.
meta.filters_applied
object
Echo of any filters used to compute the summary.