📡 API Reference

Vizbix API

The Vizbix Profit Optimizer API powers real-time profit analytics by connecting your store data with ad spend, shipping costs, and payment fees to calculate your true net profit.

Base URL https://vizbix-api.vizbixhq.workers.dev

🔐 Authentication

All protected endpoints require a Firebase JWT token passed in the Authorization header. Public endpoints (blogs, public settings, Zapier webhook) do not require authentication.

// Include in all authenticated requests
Authorization: Bearer <firebase_jwt_token>

⚡ Zapier Integration

Vizbix integrates with Zapier to allow users to push sales data from external platforms (Etsy, eBay, TikTok Shop, WooCommerce, and more) directly into their profit dashboard via webhooks.

POST /webhook/zapier — Receive sales data from Zapier
GET /api/zapier/test — Test Zapier connection
POST /fetch-zapier — Fetch stored Zapier data
POST /clear-zapier — Clear Zapier data
⚡ Zapier Endpoints
POST /webhook/zapier Receive sales data

Accepts sales order data pushed from Zapier. No authentication required — uses email-based routing. Syncs orders from Etsy, eBay, TikTok Shop, WooCommerce, and other platforms.

ParameterTypeRequiredDescription
emailstringrequiredUser's email for routing
ordersarrayrequiredArray of order objects with revenue and cost data
platformstringoptionalSource platform name (e.g. "etsy", "ebay")
Response
{ "ok": true, "received": 5 }
GET /api/zapier/test Test connection

Used by Zapier to verify the connection is working. Returns user account info. Requires authentication.

Response
{ "ok": true, "email": "user@example.com", "plan": "pro" }
📦 Store Data
POST /fetch-store Fetch aggregated store data

Returns aggregated product revenue, costs, and profit data for the authenticated user. Requires authentication.

Response
{ "ok": true, "products": [...], "totalRevenue": 50000, "totalProfit": 32000 }
POST /save Save store/product data

Saves or updates store data including products, revenue, and costs. Requires authentication.

ParameterTypeRequiredDescription
productsarrayrequiredArray of product objects with revenue and cost data
currencystringoptionalCurrency code (USD, INR, EUR, GBP)
Response
{ "ok": true }
GET /history Get data history

Returns historical snapshots of store data for trend analysis. Requires authentication.

Response
{ "ok": true, "history": [...] }
POST /settings Save user settings

Save user preferences including currency, store name, and display options. Requires authentication.

ParameterTypeRequiredDescription
currencystringoptionalPreferred currency (USD, INR, EUR, GBP)
storeNamestringoptionalStore display name
Response
{ "ok": true }
📘 Meta Ads
GET /meta/login Initiate Meta OAuth

Redirects the user to Facebook's OAuth consent screen to authorize ads_read access. No authentication required.

ParameterTypeRequiredDescription
emailstring (query)requiredUser's email for session routing
GET /meta/callback Meta OAuth callback

Handles the OAuth callback from Facebook. Exchanges the authorization code for an access token and stores it securely. Redirects user back to dashboard.

POST /fetch-meta Sync Meta Ads spend

Fetches total ad spend from all connected Meta Ads accounts for the last 30 days using the ads_read permission. Requires authentication.

Response
{ "ok": true, "totalSpend": 75.13, "campaigns": [...] }
🎯 Google Ads
GET /google/login Initiate Google OAuth

Redirects the user to Google's OAuth consent screen to authorize Google Ads access. No authentication required.

ParameterTypeRequiredDescription
emailstring (query)requiredUser's email for session routing
GET /google/callback Google OAuth callback

Handles the OAuth callback from Google. Exchanges authorization code for refresh token and stores it securely. Redirects user back to dashboard.

POST /fetch-google-ads Sync Google Ads spend

Fetches total ad spend from connected Google Ads accounts for the last 30 days. Automatically handles Manager (MCC) and individual accounts. Requires authentication.

Response
{ "ok": true, "totalSpend": 311.00 }
🛍️ Shopify
GET /shopify/login Initiate Shopify OAuth

Redirects to Shopify's OAuth consent screen for store data access. No authentication required.

GET /shopify/callback Shopify OAuth callback

Handles Shopify OAuth callback. Stores access token and begins initial data sync.

📦 Amazon
GET /amazon/login Initiate Amazon SP-API OAuth

Redirects to Amazon's OAuth consent screen for Seller Central access. No authentication required.

POST /fetch-amazon Sync Amazon order data

Fetches Amazon Seller Central orders, FBA fees, and revenue for profit calculation. Requires authentication.

Response
{ "ok": true, "totalRevenue": 12400, "totalFees": 1800, "orders": [...] }
📧 Klaviyo
POST /klaviyo/save-creds Save Klaviyo API key

Stores the user's Klaviyo API key for email revenue attribution. Requires authentication.

ParameterTypeRequiredDescription
apiKeystringrequiredKlaviyo private API key
POST /fetch-klaviyo Sync Klaviyo email revenue

Fetches email-attributed revenue from Klaviyo for the last 30 days. Requires authentication.

Response
{ "ok": true, "attributedRevenue": 4200.00 }
🚚 Shipping
POST /shipstation/save-creds Save ShipStation credentials

Stores ShipStation API key and secret for shipping cost sync. Requires authentication.

POST /fetch-shipstation Sync ShipStation costs

Fetches total shipping costs from ShipStation for the last 30 days. Requires authentication.

Response
{ "ok": true, "totalShippingCost": 320.50, "shipmentCount": 84 }
POST /shiprocket/save-creds Save Shiprocket credentials

Stores Shiprocket email and password for Indian domestic shipping cost sync. Requires authentication.

POST /fetch-shiprocket Sync Shiprocket costs

Fetches COD charges, shipping fees, and RTO costs from Shiprocket. Requires authentication.

Response
{ "ok": true, "totalShippingCost": 1840.00 }
POST /sendcloud/save-creds Save Sendcloud credentials

Stores Sendcloud API key and secret for European shipping cost sync. Requires authentication.

POST /fetch-sendcloud Sync Sendcloud costs

Fetches parcel shipping costs from Sendcloud for the last 30 days. Requires authentication.

Response
{ "ok": true, "totalShippingCost": 280.00 }
💳 Payment Gateways
POST /payment/save-creds Save gateway credentials

Stores credentials for payment gateways (Razorpay, Stripe, PayPal). Requires authentication.

ParameterTypeRequiredDescription
gatewaystringrequiredGateway name: razorpay, stripe, paypal
apiKeystringrequiredGateway API key
apiSecretstringoptionalGateway API secret (if required)
POST /payment/sync Sync payment gateway fees

Fetches processing fees from the connected payment gateway for profit calculation. Requires authentication.

Response
{ "ok": true, "totalFees": 142.30, "gateway": "razorpay" }
🌐 Public Endpoints
GET /api/blogs Fetch all blog posts

Returns all published blog posts sorted by date. No authentication required.

Response
{ "ok": true, "blogs": [{ "title": "...", "date": "..." }] }
GET /public/settings Fetch public app settings

Returns public configuration settings for the Vizbix app. No authentication required.

Response
{ "ok": true, "settings": { "maintenanceMode": false } }
GET /check Check user account status

Returns the authenticated user's account status, plan, and subscription details. Requires authentication.

ParameterTypeRequiredDescription
emailstring (query)requiredUser's email address
Response
{ "ok": true, "plan": "pro", "email": "user@example.com" }