Products API
Fetch, search, and manage products in your store.
GET
List Products
Retrieve a paginated list of published products from your store.
List all products
// Fetch latest products
const products = await swat.products.list();Pagination & Filtering
// Fetch with options
const products = await swat.products.list({
limit: 12, // Number of items per page
offset: 0, // Skip N items (pagination)
category: 'shoes', // Filter by category slug
search: 'running' // Search by title/description
});GET
Get Product
Retrieve a single product details by its ID or URL slug.
Get By Slug
try {
const product = await swat.products.get('my-awesome-product');
console.log(product.title, product.price);
} catch (e) {
// Handle 404
console.log('Product not found');
}POST
Create Product
Programmatically add new products to your catalog.
Create new product
const newProduct = await swat.products.create({
title: "Limited Edition Hoodie",
price: 5900, // Price in cents ($59.00)
description: "Premium cotton blend...",
images: ["https://example.com/hoodie.jpg"],
category: "apparel",
inventory_quantity: 100,
published: true
});SDK
Configure Pipelines
Define custom fulfillment steps (orchestration) for your products.
Update Pipeline
// Define the steps this product must go through
await swat.products.updatePipeline('my-custom-product', [
{
id: 'step_assembly',
label: 'Assembly',
required_metadata: ['worker_id']
},
{
id: 'step_qa',
label: 'Quality Assurance',
required_metadata: ['qa_score']
},
{
id: 'step_shipping',
label: 'Ready for Shipping',
required_metadata: []
}
]);