Categories & Organization
Organize your product catalog with categories.
Overview
Categories help organize products in your store. Use the Categories API to create product organization and keep your catalog structured.
List Categories
curl -X GET https://api.whatalo.com/v1/categories \
-H "X-API-Key: wk_live_your_key_here"Required scope: read:products
Categories share the read:products / write:products scopes since they are a product sub-resource.
Get a Single Category
curl -X GET https://api.whatalo.com/v1/categories/cat_abc123 \
-H "X-API-Key: wk_live_your_key_here"Create a Category
curl -X POST https://api.whatalo.com/v1/categories \
-H "X-API-Key: wk_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"name": "Electronics"
}'Required scope: write:products
Only name is required. slug is auto-generated from the name if omitted.
Update a Category
curl -X PATCH https://api.whatalo.com/v1/categories/cat_abc123 \
-H "X-API-Key: wk_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"name": "Electronics & Gadgets"
}'Required scope: write:products
Delete a Category
curl -X DELETE https://api.whatalo.com/v1/categories/cat_abc123 \
-H "X-API-Key: wk_live_your_key_here"Required scope: write:products
Deleting a category does not delete its products. Products will become uncategorized.
Common Patterns
Seed Categories from a List
const defaultCategories = ['Clothing', 'Electronics', 'Home & Garden'];
async function seedCategories() {
for (const name of defaultCategories) {
const res = await fetch('https://api.whatalo.com/v1/categories', {
method: 'POST',
headers: {
'X-API-Key': API_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({ name })
});
if (!res.ok) {
console.error(`Failed to create "${name}":`, await res.json());
}
}
}Sync Categories with External System
async function syncCategories(externalCategories) {
const res = await fetch('https://api.whatalo.com/v1/categories?per_page=100', {
headers: { 'X-API-Key': API_KEY }
});
const { data: existing } = await res.json();
const existingNames = new Set(existing.map(c => c.name));
for (const ext of externalCategories) {
if (!existingNames.has(ext.name)) {
const createRes = await fetch('https://api.whatalo.com/v1/categories', {
method: 'POST',
headers: {
'X-API-Key': API_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({ name: ext.name })
});
if (!createRes.ok) {
console.error(`Failed to create "${ext.name}":`, await createRes.json());
}
}
}
}