Warehouse Stock API

Overview

The Warehouse Stock API allows you to manage product stock levels across multiple warehouses in your Venddor store. You can update, retrieve, and manage stock for specific products in specific warehouses, enabling precise control over stock allocation and distribution.

Base URL: https://www.venddor.com.br/api/2.0/warehouses/{warehouse_id}/stock

Core Stock Operations

GET /api/2.0/warehouses/{warehouse_id}/stock

Retrieves stock levels for all products in a specific warehouse.

GET /api/2.0/warehouses/{warehouse_id}/stock/{product_id}

Retrieves stock information for a specific product in a specific warehouse.

PUT /api/2.0/warehouses/{warehouse_id}/stock/{product_id}

Updates stock levels for a specific product in a specific warehouse.

Stock Structure

Below is the structure of a stock object for a product in a warehouse:

{
  "warehouse_id": "12",
  "product_id": "423",
  "product_code": "LAPTOP-PRO-15",
  "product_name": "Professional Laptop 15\"",
  "amount": 150,              // Current stock quantity
  "reserved_amount": 25,     // Reserved for pending orders
  "available_amount": 125,   // Available for sale (amount - reserved)
  "min_amount": 10,          // Minimum stock level alert
  "max_amount": 500,         // Maximum stock capacity
  "cost_price": "899.99",    // Unit cost price
  "tracking": "B",           // B - track with options, O - track without options, D - don't track
  "status": "A",             // A - active, D - disabled
  "location": "A-12-34",     // Physical location within warehouse
  "batch_number": "LOT2024001", // Batch/lot tracking
  "last_updated": "2024-06-24T14:30:00Z",
  "options": [
    {
      "option_id": "15",
      "option_name": "Color",
      "variant_id": "45",
      "variant_name": "Silver",
      "amount": 75,
      "reserved_amount": 10
    },
    {
      "option_id": "15",
      "option_name": "Color",
      "variant_id": "46",
      "variant_name": "Black",
      "amount": 75,
      "reserved_amount": 15
    }
  ]
}

Updating Product Stock

Example request to update stock for a specific product in a warehouse:

curl -X PUT "https://www.venddor.com.br/api/2.0/warehouses/12/stock/423" \
  -H "Content-Type: application/json" \
  -u "email:api_key" \
  -d '{
    "amount": 200,
    "reserved_amount": 30,
    "min_amount": 15,
    "max_amount": 600,
    "cost_price": "899.99",
    "location": "A-12-35",
    "batch_number": "LOT2024002",
    "options": [
      {
        "variant_id": "45",
        "amount": 100,
        "reserved_amount": 15
      },
      {
        "variant_id": "46", 
        "amount": 100,
        "reserved_amount": 15
      }
    ]
  }'
Note: All stock operations are tracked with timestamps and user information for complete audit trails. Reserved amounts are automatically calculated based on pending orders and manual reservations.

Best Practices

Tip: When updating stock for products with options/variants, always include the variant-specific quantities to maintain accurate inventory tracking. The system will automatically calculate the total product stock based on variant totals.