Create Your First Store
Go from zero to your first API call in under 10 minutes. This guide walks you through creating a store, generating API keys, and adding your first product.
Prerequisites
- A BareCommerce account (sign up free (opens in a new tab))
- A terminal or HTTP client (curl, Postman, or your preferred tool)
Step 1: Create Your Store
After signing up, you'll create your first store. A store is a container for all your products, orders, customers, and settings.
Via Dashboard (Recommended)
- Go to your dashboard (opens in a new tab)
- Click "Create Store"
- Enter your store name (e.g., "My Awesome Shop")
- Optionally set your domain and currency
- Click "Create"
Via API (Advanced)
curl -X POST "https://api.barecommercecore.com/stores" \
-H "Content-Type: application/json" \
-d '{
"name": "My Awesome Shop",
"currency": "USD"
}'Step 2: Generate an API Key
API keys authenticate your requests to BareCommerce. Each key has specific scopes that control what it can access.
Via Dashboard
- Open your store in the dashboard
- Go to Settings → API Keys
- Click "Create API Key"
- Give it a name (e.g., "Development Key")
- Select scopes (for testing, select all)
- Click "Create" and copy the key immediately
⚠️ Important: The full API key is only shown once when created. Store it securely in your environment variables.
API Key Format
sk_live_aBcDeFgHiJkLmNoPqRsTuVwXyZ123456All API keys start with sk_live_ followed by 32 random characters.
Step 3: Set Up Your Environment
Store your API key and store ID as environment variables:
# .env.local (add to .gitignore!)
BARECOMMERCE_API_KEY=sk_live_your_api_key_here
BARECOMMERCE_STORE_ID=your_store_id_hereTest Your Connection
curl "https://api.barecommercecore.com/stores/YOUR_STORE_ID/products" \
-H "Authorization: Bearer sk_live_YOUR_API_KEY"
# Should return: { "items": [], "total": 0 }Step 4: Create Your First Product
Let's add a product to your store:
curl -X POST "https://api.barecommercecore.com/stores/YOUR_STORE_ID/products" \
-H "Authorization: Bearer sk_live_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Classic Blue T-Shirt",
"slug": "classic-blue-tshirt",
"price": "29.99",
"status": "published",
"description": "A comfortable cotton t-shirt in ocean blue.",
"sku": "TSHIRT-BLUE-001",
"stock": 100,
"trackStock": true
}'Response
{
"id": "prod_abc123def456",
"storeId": "store_xyz789",
"title": "Classic Blue T-Shirt",
"slug": "classic-blue-tshirt",
"status": "published",
"price": "29.99",
"sku": "TSHIRT-BLUE-001",
"stock": 100,
"publishedAt": "2024-01-15T10:00:00.000Z",
"createdAt": "2024-01-15T10:00:00.000Z"
}🎉 Congratulations! You've created your first product.
Step 5: Fetch Products in Your Frontend
Display your products on a website. Here's a Next.js example:
// app/products/page.tsx
async function getProducts() {
const res = await fetch(
`https://api.barecommercecore.com/stores/${process.env.BARECOMMERCE_STORE_ID}/products?status=published`,
{
headers: {
'Authorization': `Bearer ${process.env.BARECOMMERCE_API_KEY}`,
},
next: { revalidate: 60 },
}
);
if (!res.ok) throw new Error('Failed to fetch products');
return res.json();
}
export default async function ProductsPage() {
const { items: products } = await getProducts();
return (
<div className="grid grid-cols-3 gap-6">
{products.map((product) => (
<div key={product.id} className="border rounded-lg p-4">
<h2 className="font-bold">{product.title}</h2>
<p className="text-gray-600">{product.description}</p>
<p className="text-xl font-bold mt-2">${product.price}</p>
</div>
))}
</div>
);
}What's Next?
- Products API — Variants, attributes, inventory tracking
- Orders API — Process orders, manage status, fulfillment
- Payment Integration — Add Stripe, PayPal, or Square
- Webhooks — Real-time notifications
Quick Reference
Base URL
https://api.barecommercecore.comAuthentication Header
Authorization: Bearer sk_live_YOUR_API_KEYStore-scoped Endpoints
| Endpoint | Description |
|---|---|
| /stores/:storeId/products | Products |
| /stores/:storeId/orders | Orders |
| /stores/:storeId/customers | Customers |
| /stores/:storeId/categories | Categories |
| /stores/:storeId/media | Media |
| /stores/:storeId/webhooks | Webhooks |
Need Help?
- Check our API Reference
- Review the authentication guide for API key issues
- Contact support via the dashboard