Documentation
Everything you need to integrate BaaS Platform into your e-commerce frontend.
Quick Start
Get up and running in 5 minutes
API Reference
Explore all endpoints
Security
Learn about auth & security
Base URL
https://api.baasplatform.comAll API endpoints are relative to this base URL. For tenant-specific endpoints, use your subdomain: https://yourstore.baasplatform.com
Quick Start
Follow these steps to integrate your frontend with BaaS Platform:
Register your business
curl -X POST https://api.baasplatform.com/api/platform/register/ \
-H "Content-Type: application/json" \
-d '{
"business_name": "My Store",
"email": "owner@mystore.com",
"password": "securepassword123",
"first_name": "John",
"last_name": "Doe"
}'Get your API key
curl -X POST https://api.baasplatform.com/api/platform/api-keys/ \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "Production API Key"}'Make API requests to your store
curl https://mystore.baasplatform.com/api/store/products/ \
-H "X-API-Key: YOUR_API_KEY"Authentication
BaaS Platform uses JWT tokens for admin authentication and API keys for storefront access.
JWT Authentication (Admin)
Use JWT tokens for business owner authentication and admin panel access.
# Get JWT tokens
POST /api/platform/token/
{
"email": "owner@mystore.com",
"password": "yourpassword"
}
# Response
{
"access": "eyJ0eXAiOiJKV1QiLCJhbGciOi...",
"refresh": "eyJ0eXAiOiJKV1QiLCJhbGciOi...",
"user": { "id": 1, "email": "owner@mystore.com", ... }
}API Key Authentication (Storefront)
Use API keys for frontend-to-backend communication in your storefront.
# Include in request headers
X-API-Key: sk_live_abc123xyz789
# Or as query parameter
GET /api/store/products/?api_key=sk_live_abc123xyz789Products API
Retrieve product information for your storefront.
List Products
GET /api/store/products/
# Query Parameters
?category=electronics # Filter by category
?search=laptop # Search products
?min_price=100 # Minimum price
?max_price=1000 # Maximum price
?sort=price_asc # Sort order
?page=1 # Pagination
?per_page=20 # Items per pageResponse
{
"count": 150,
"next": "/api/store/products/?page=2",
"previous": null,
"results": [
{
"id": "prod_abc123",
"name": "Premium Headphones",
"slug": "premium-headphones",
"description": "High-quality wireless headphones...",
"price": "99.99",
"compare_price": "149.99",
"images": [
{"url": "https://...", "alt": "Product image"}
],
"category": {"id": 1, "name": "Electronics"},
"in_stock": true,
"stock_quantity": 50,
"created_at": "2024-01-15T10:30:00Z"
}
]
}Cart API
Manage shopping carts for your customers.
Add to Cart
POST /api/store/cart/items/
Authorization: Bearer CUSTOMER_JWT_TOKEN
{
"product_id": "prod_abc123",
"quantity": 2
}Get Cart
GET /api/store/cart/
# Response
{
"id": "cart_xyz789",
"items": [
{
"id": "item_123",
"product": {...},
"quantity": 2,
"unit_price": "99.99",
"total_price": "199.98"
}
],
"subtotal": "199.98",
"tax": "16.00",
"total": "215.98",
"item_count": 2
}Orders API
Create and manage customer orders.
Create Order (Checkout)
POST /api/store/checkout/
Authorization: Bearer CUSTOMER_JWT_TOKEN
{
"shipping_address": {
"street": "123 Main St",
"city": "New York",
"state": "NY",
"postal_code": "10001",
"country": "US"
},
"billing_address": {...},
"payment_method": "card",
"notes": "Please leave at door"
}Order Status Values
pendingOrder placed, awaiting confirmation
confirmedOrder confirmed by merchant
processingOrder being prepared
shippedOrder shipped to customer
deliveredOrder delivered
cancelledOrder cancelled
Rate Limiting
API requests are rate limited to ensure fair usage and platform stability.
| Plan | Requests/minute | Requests/day |
|---|---|---|
| Free | 60 | 10,000 |
| Starter | 120 | 50,000 |
| Pro | 300 | 200,000 |
| Enterprise | Custom | Unlimited |
Rate limit headers: Check X-RateLimit-Remaining and X-RateLimit-Reset headers in API responses.
Error Handling
All API errors follow a consistent format.
{
"error": {
"code": "validation_error",
"message": "Invalid request data",
"details": {
"email": ["This field is required."],
"password": ["Password must be at least 8 characters."]
}
},
"status": 400
}Common Error Codes
400Bad Request - Invalid input data401Unauthorized - Invalid or missing authentication403Forbidden - Insufficient permissions404Not Found - Resource does not exist429Too Many Requests - Rate limit exceeded500Internal Server Error - Contact supportNeed help? Contact support@baasplatform.com or join our Discord community.