Skip to main content
GET
/
api
/
v1
/
products
List Products
curl --request GET \
  --url https://api.example.com/api/v1/products/
{
  "id": "<string>",
  "sku": "<string>",
  "name": "<string>",
  "category": "<string>",
  "unit_measure": "<string>",
  "unit_value": 123,
  "is_perishable": true,
  "expiration_date": "<string>",
  "suggested_price": 123
}

Authorization

Required roles: admin, gestor, consultor

Query Parameters

skip
integer
default:"0"
Number of records to skip for pagination
limit
integer
default:"100"
Maximum number of records to return (max: 100)

Response

Returns an array of product objects.
id
string
Unique product identifier (UUID)
sku
string
Stock Keeping Unit
name
string
Product name
category
string
Product category
unit_measure
string
Unit of measurement
unit_value
number
Value per unit
is_perishable
boolean
Whether product has expiration date
expiration_date
string
Expiration date if applicable
suggested_price
number
Recommended selling price

Example Request

curl -X GET "https://api.example.com/api/v1/products/?skip=0&limit=10" \
  -H "Authorization: Bearer YOUR_TOKEN"

Example Response

[
  {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "sku": "PROD-001",
    "name": "Organic Apples",
    "category": "Fruits",
    "unit_measure": "kg",
    "unit_value": 1.0,
    "is_perishable": true,
    "expiration_date": "2026-03-15",
    "suggested_price": 4.99
  },
  {
    "id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
    "sku": "PROD-002",
    "name": "Steel Bolts",
    "category": "Hardware",
    "unit_measure": "units",
    "unit_value": 1.0,
    "is_perishable": false,
    "expiration_date": null,
    "suggested_price": 0.25
  }
]

Get Single Product

Endpoint

GET /api/v1/products/{product_id}

Authorization

Required roles: admin, gestor, consultor

Path Parameters

product_id
string
required
UUID of the product to retrieve

Example Request

curl -X GET https://api.example.com/api/v1/products/a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
  -H "Authorization: Bearer YOUR_TOKEN"

Example Response

{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "sku": "PROD-001",
  "name": "Organic Apples",
  "category": "Fruits",
  "unit_measure": "kg",
  "unit_value": 1.0,
  "is_perishable": true,
  "expiration_date": "2026-03-15",
  "suggested_price": 4.99
}

Error Responses

404 Not Found

Returned when product doesn’t exist:
{
  "detail": "Product not found"
}

401 Unauthorized

Returned when authentication token is invalid or missing.

403 Forbidden

Returned when the authenticated user lacks required role.

Pagination Tips

  • Use skip and limit together for efficient pagination
  • Default limit is 100 items per request
  • To get the next page, increment skip by limit

Example: Paginating through all products

# First page (0-99)
curl "https://api.example.com/api/v1/products/?skip=0&limit=100"

# Second page (100-199)
curl "https://api.example.com/api/v1/products/?skip=100&limit=100"

# Third page (200-299)
curl "https://api.example.com/api/v1/products/?skip=200&limit=100"

Build docs developers (and LLMs) love