Products API

Read and manage the product catalogue, including variants, SKUs, pricing and the master data that orders reference.

2 endpoints. Every request needs an API key or a session token — see Authentication. To send one of these calls from the browser, use the interactive reference.

GEThttps://api.spirestock.com/api/v1/products

List all products in the catalog with optional search filter. Products include their class and variants.

Parameters

  • page (number)Page number (default: 1)
  • limit (number)Items per page (default: 20, max: 100)
  • search (string)Search by product name
  • status (number)Filter by status: 1 (active), 0 (inactive)

Example request

curl "https://api.spirestock.com/api/v1/products?search=milk&status=1" \
  -H "Authorization: Bearer YOUR_TOKEN"

Example response

{
  "response_code": 200,
  "data": [
    {
      "id": 1,
      "product_name": "Full Cream Milk",
      "product_class_id": 1,
      "product_hsn": "0401",
      "product_color_code": "#FFFFFF",
      "product_description": "Fresh full cream milk",
      "product_image": null,
      "status": 1,
      "ProductClass": {
        "id": 1,
        "product_class": "Milk"
      },
      "ProductVariants": [
        {
          "id": 10,
          "variant_name": "500ml",
          "item_sku_code": "FCM-500",
          "mrp": 30.00,
          "sp": 28.00,
          "variant_size": "500",
          "variant_quantity": 1,
          "container_quantity": 12,
          "status": 1
        },
        {
          "id": 11,
          "variant_name": "1L",
          "item_sku_code": "FCM-1000",
          "mrp": 58.00,
          "sp": 54.00,
          "variant_size": "1000",
          "variant_quantity": 1,
          "container_quantity": 6,
          "status": 1
        }
      ]
    }
  ],
  "pagination": {
    "total": 65,
    "page": 1,
    "limit": 20,
    "total_pages": 4
  }
}
POSThttps://api.spirestock.com/api/v1/products

Add a new product to the catalog with optional variants.

Request body

  • product_name (string)requiredProduct name
  • product_class_id (number)requiredProduct class/category ID
  • product_hsn (string)HSN code for tax classification
  • product_description (string)Product description
  • variants (array)Array of { variant_name, item_sku_code, mrp, sp } variant objects

Example request

curl -X POST https://api.spirestock.com/api/v1/products \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "product_name": "Toned Milk",
    "product_class_id": 1,
    "product_hsn": "0401",
    "variants": [
      { "variant_name": "500ml", "item_sku_code": "TM-500", "mrp": 25.00, "sp": 22.00 },
      { "variant_name": "1L", "item_sku_code": "TM-1000", "mrp": 48.00, "sp": 42.00 }
    ]
  }'

Example response

{
  "response_code": 201,
  "message": "Product created",
  "data": {
    "id": 66,
    "product_name": "Toned Milk",
    "product_class_id": 1,
    "product_hsn": "0401",
    "status": 1,
    "ProductVariants": [
      { "id": 120, "variant_name": "500ml", "item_sku_code": "TM-500", "mrp": 25.00, "sp": 22.00, "status": 1 },
      { "id": 121, "variant_name": "1L", "item_sku_code": "TM-1000", "mrp": 48.00, "sp": 42.00, "status": 1 }
    ]
  }
}