Documentation

Learn MarginAI

Everything you need to connect your store, configure agents, and start optimizing margins.

Getting Started

Quick Start Guide

Connect your Shopify store and run your first margin analysis in under 5 minutes.

  • 1Sign up for a free MarginAI account
  • 2Click "Connect Store" and authorize your Shopify store via OAuth (read-only)
  • 3Wait for the initial data sync (typically 30-60 seconds)
  • 4Navigate to the Dashboard to see your margin analysis

System Requirements

MarginAI works in any modern browser. No software installation needed.

  • 1A Shopify store (Basic plan or above)
  • 2Chrome, Firefox, Safari, or Edge (latest versions)
  • 3Products with cost data (COGS) for accurate margin calculations

Core Concepts

Neural Core Engine

The Neural Core is MarginAI's analysis engine. It continuously processes your store data to identify margin opportunities, pricing anomalies, and inventory risks.

  • 1Inventory Analyst - Monitors stock levels, velocity, and holding costs
  • 2Pricing Analyst - Evaluates pricing vs. competition and margin targets
  • 3Results update in real-time as new orders come in

Autonomy Dial

Control how much autonomy MarginAI has over your store operations.

  • 1Level 0-25: Suggest Only - All actions require manual approval
  • 2Level 25-50: Smart Assist - Low-risk actions auto-execute, high-risk need approval
  • 3Level 50-75: Guided Auto - Most actions auto-execute with rollback windows
  • 4Level 75-100: Full Auto - Complete autonomous operation with override capability

Action Log & Undo

Every action MarginAI takes is logged with full audit trail. Any action can be undone instantly.

  • 1View all pending, approved, and executed actions
  • 2One-click undo on any executed action
  • 3Full history with timestamps and reasoning

AI Agents

Price Monitor Agent

Continuously monitors your product pricing against margin targets and competitive data.

  • 1Detects products priced below margin thresholds
  • 2Identifies opportunities for price increases on high-demand items
  • 3Generates price adjustment recommendations with projected impact

Inventory Optimizer Agent

Analyzes inventory levels, sell-through rates, and holding costs to prevent overstock and stockouts.

  • 1Flags slow-moving inventory with holding cost estimates
  • 2Predicts stockout risk based on velocity trends
  • 3Recommends clearance pricing for aged inventory

Competitor Tracker Agent

Monitors competitor pricing and market positioning to keep your catalog competitive.

  • 1Tracks pricing changes across competitor storefronts
  • 2Alerts on significant competitive price movements
  • 3Suggests strategic pricing responses

Profit Leak Detector Agent

Identifies hidden profit leaks from shipping costs, return rates, discount abuse, and ad spend waste.

  • 1Analyzes shipping cost vs. revenue per order
  • 2Detects unusual return rate patterns
  • 3Identifies discount codes with negative ROI

Integrations

Shopify

Native integration via Shopify OAuth. Read-only access to products, orders, and inventory data.

  • 1Go to Dashboard > Settings > Integrations
  • 2Click "Connect Shopify" and authorize the app
  • 3Data syncs automatically every 5 minutes

Coming Soon

We're actively building integrations for more platforms.

  • 1Amazon Seller Central
  • 2WooCommerce
  • 3BigCommerce
  • 4Stripe (payment analytics)
  • 5Google Ads & Meta Ads (ad spend tracking)

API Reference

Dashboard API

GET /api/dashboard - Returns all dashboard data including metrics, agents, runs, and logs.

  • 1Response includes: metrics, agents[], runs[], logs[], analytics, timeSeries[], productMargins[]
  • 2Authentication: Bearer token (from Supabase session)
  • 3Rate limit: 60 requests/minute

Neural Core API

POST /api/margin-ai - Execute queries and actions against the Neural Core engine.

  • 1action: "query" - Natural language queries about your store
  • 2action: "analyze" - Run full margin analysis
  • 3action: "execute" - Execute a recommended action
  • 4action: "undo" - Reverse a previously executed action

Products API

GET /api/margin-ai/products - Retrieve product catalog with margin data.

  • 1Returns full product list with cost, price, margin, and velocity data
  • 2Supports ?limit and ?offset query parameters
  • 3Includes inventory levels and days-on-hand metrics