Skip to main content

Products

The Products API allows you to manage products in the POS inventory system. You can create, read, update, and delete products, as well as search by name and retrieve products formatted for select dropdowns.

Endpoints

POST /api/pos/producto

Create a new product in the system.
um_venta
string
required
Unit of measurement for sales (max 10 characters)
cat_codigo
string
Category code (max 10 characters, can be null)
prd_nombre
string
required
Product name (max 60 characters)
prd_desc_corta
string
required
Short description (max 60 characters)
prd_desc_larga
string
required
Long description (max 255 characters)
prd_precio_venta
number
required
Sale price (must be greater than 0)
prd_stock
integer
required
Stock quantity (must be greater than 0)
prd_prioridad
string
required
Priority level: ‘L’ (Low) or ‘F’ (Fast/High)
prd_img
file
Product image file (multipart/form-data)

Response

prd_codigo
string
Generated product code
message
string
Success message
cURL
curl -X POST "http://localhost:3000/api/pos/producto" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -F "um_venta=UND" \
  -F "prd_nombre=Pizza Margherita" \
  -F "prd_desc_corta=Classic pizza with cheese" \
  -F "prd_desc_larga=Traditional Italian pizza with tomato sauce and mozzarella cheese" \
  -F "prd_precio_venta=25.90" \
  -F "prd_stock=50" \
  -F "prd_prioridad=F" \
  -F "prd_img=@/path/to/image.jpg"
{
  "prd_codigo": "PRD001",
  "message": "Producto creado exitosamente"
}

GET /api/pos/producto

Get all products with pagination.
page
number
Page number for pagination (default: 1)

Response

page
number
Current page number
limit
number
Number of items per page
count
number
Total count of products
data
array
Array of product objects
cURL
curl -X GET "http://localhost:3000/api/pos/producto?page=1" \
  -H "Authorization: Bearer YOUR_TOKEN"
{
  "page": 1,
  "limit": 20,
  "count": 150,
  "data": [
    {
      "prd_codigo": "PRD001",
      "prd_nombre": "Pizza Margherita",
      "prd_desc_corta": "Classic pizza with cheese",
      "prd_desc_larga": "Traditional Italian pizza with tomato sauce and mozzarella cheese",
      "um_venta": "UND",
      "cat_codigo": "CAT001",
      "prd_precio_venta": 25.90,
      "prd_stock": 50,
      "prd_prioridad": "F",
      "prd_promocion": 0,
      "prd_estado": "ACT",
      "prd_img": "http://localhost:3000/images/pizza.jpg"
    }
  ]
}

GET /api/pos/producto/search

Search products by name.
name
string
required
Product name to search for
page
number
Page number for pagination (default: 1)

Response

page
number
Current page number
limit
number
Number of items per page
count
number
Total count of matching products
data
array
Array of matching product objects
cURL
curl -X GET "http://localhost:3000/api/pos/producto/search?name=Pizza&page=1" \
  -H "Authorization: Bearer YOUR_TOKEN"
{
  "page": 1,
  "limit": 20,
  "count": 5,
  "data": [
    {
      "prd_codigo": "PRD001",
      "prd_nombre": "Pizza Margherita",
      "prd_precio_venta": 25.90,
      "prd_stock": 50
    }
  ]
}

GET /api/pos/producto/type

Get products formatted for select dropdowns.

Response

data
array
Array of simplified product objects for dropdowns
cURL
curl -X GET "http://localhost:3000/api/pos/producto/type" \
  -H "Authorization: Bearer YOUR_TOKEN"
[
  {
    "value": "PRD001",
    "label": "Pizza Margherita"
  },
  {
    "value": "PRD002",
    "label": "Hamburger Classic"
  }
]

GET /api/pos/producto/:id

Get a specific product by ID.
id
string
required
Product code/ID

Response

product
object
Product object with all details
cURL
curl -X GET "http://localhost:3000/api/pos/producto/PRD001" \
  -H "Authorization: Bearer YOUR_TOKEN"
{
  "prd_codigo": "PRD001",
  "prd_nombre": "Pizza Margherita",
  "prd_desc_corta": "Classic pizza with cheese",
  "prd_desc_larga": "Traditional Italian pizza with tomato sauce and mozzarella cheese",
  "um_venta": "UND",
  "cat_codigo": "CAT001",
  "prd_precio_venta": 25.90,
  "prd_stock": 50,
  "prd_prioridad": "F",
  "prd_promocion": 0,
  "prd_estado": "ACT",
  "prd_img": "http://localhost:3000/images/pizza.jpg"
}

PUT /api/pos/producto/:id

Update an existing product.
id
string
required
Product code/ID to update
um_venta
string
Unit of measurement for sales (max 10 characters)
cat_codigo
string
Category code (max 10 characters, can be null)
prd_nombre
string
Product name (max 60 characters)
prd_desc_corta
string
Short description (max 60 characters)
prd_desc_larga
string
Long description (max 255 characters)
prd_precio_venta
number
Sale price (must be greater than 0)
prd_stock
integer
Stock quantity (must be greater than 0)
prd_prioridad
string
Priority level: ‘L’ (Low) or ‘F’ (Fast/High)
prd_promocion
integer
Promotion percentage (0-100)
prd_estado
string
Product status: ‘ACT’ (Active), ‘INA’ (Inactive), or ‘SUS’ (Suspended)
prd_img
file
Product image file (multipart/form-data)

Response

message
string
Success message
cURL
curl -X PUT "http://localhost:3000/api/pos/producto/PRD001" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -F "prd_precio_venta=29.90" \
  -F "prd_stock=75"
{
  "message": "Producto actualizado exitosamente"
}

DELETE /api/pos/producto/:id

Delete a product by ID.
id
string
required
Product code/ID to delete

Response

Returns 204 No Content on success.
cURL
curl -X DELETE "http://localhost:3000/api/pos/producto/PRD001" \
  -H "Authorization: Bearer YOUR_TOKEN"

Build docs developers (and LLMs) love