Working with Products

Learn how to create, list, update, and manage products through the API.

Overview

Products are the core of any Whatalo store. The Products API lets you manage your entire catalog programmatically — from creating single items to bulk updates.

List Products

Retrieve all products in your store with optional filtering and pagination.

curl -X GET https://api.whatalo.com/v1/products \
  -H "X-API-Key: wk_live_your_key_here"

Response:

{
  "data": [
    {
      "id": "prod_abc123",
      "name": "Premium T-Shirt",
      "slug": "premium-t-shirt",
      "description": "100% cotton premium quality",
      "price": 2999,
      "compare_price": 3999,
      "is_active": true,
      "stock_quantity": 150,
      "created_at": "2026-01-15T10:30:00.000Z"
    }
  ],
  "pagination": { "page": 1, "per_page": 25, "total": 45, "total_pages": 2 }
}

Required scope: read:products

Create a Product

curl -X POST https://api.whatalo.com/v1/products \
  -H "X-API-Key: wk_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "New Product",
    "description": "A great product",
    "price": 1999,
    "is_active": false
  }'

Required scope: write:products

Set is_active to false to keep the product hidden until you are ready to publish. Defaults to true if omitted.

Update a Product

Update specific fields without affecting others:

curl -X PATCH https://api.whatalo.com/v1/products/prod_abc123 \
  -H "X-API-Key: wk_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "price": 2499,
    "stock_quantity": 200
  }'

Required scope: write:products

Delete a Product

curl -X DELETE https://api.whatalo.com/v1/products/prod_abc123 \
  -H "X-API-Key: wk_live_your_key_here"

Required scope: write:products

Deleting a product is permanent and cannot be undone. Consider setting is_active to false instead to hide it from the storefront.

Get Product Count

Quickly check how many products exist without fetching all data:

curl -X GET https://api.whatalo.com/v1/products/count \
  -H "X-API-Key: wk_live_your_key_here"

Common Patterns

Bulk Price Update

To update prices for multiple products, iterate through your catalog:

const res = await fetch('https://api.whatalo.com/v1/products?per_page=100', {
  headers: { 'X-API-Key': API_KEY }
});
const { data: products } = await res.json();

for (const product of products) {
  const updateRes = await fetch(`https://api.whatalo.com/v1/products/${product.id}`, {
    method: 'PATCH',
    headers: {
      'X-API-Key': API_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      price: Math.round(product.price * 1.1) // 10% increase
    })
  });

  if (!updateRes.ok) {
    console.error(`Failed to update ${product.id}:`, await updateRes.json());
  }
}

For bulk operations, be mindful of the rate limit (1,000 requests/minute). Add a delay between requests if updating large catalogs.

Sync Inventory

Keep your inventory in sync with an external system:

async function syncInventory(externalProducts) {
  for (const ext of externalProducts) {
    const res = await fetch(`https://api.whatalo.com/v1/products/${ext.whataloId}`, {
      method: 'PATCH',
      headers: {
        'X-API-Key': API_KEY,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        stock_quantity: ext.stock
      })
    });

    if (!res.ok) {
      console.error(`Failed to sync ${ext.whataloId}:`, await res.json());
    }
  }
}

On this page