# Delectable AI + Instacart Commerce Platform — Integration Architecture

## Why This Matters

380+ grocery retailers run their e-commerce on Instacart's Storefront Pro, including Aldi, Sprouts, Publix, Hy-Vee, Price Chopper, Costco, and Raley's. For any of these retailers, Instacart is the commerce layer — catalog, cart, checkout, fulfillment, and ads. Delectable AI becomes the **intelligence layer** that sits on top: personalization, agentic shopping, knowledge graph, and retail media optimization. Together, one signal from the shopper drives action across both platforms without the retailer building anything from scratch.

---

## Architecture Overview

```
┌─────────────────────────────────────────────────────────────────────┐
│                        RETAILER SURFACE                             │
│  Website (Storefront Pro)  ·  Mobile App  ·  In-Store Kiosk        │
└──────────────┬──────────────────────────────────┬───────────────────┘
               │                                  │
               ▼                                  ▼
┌──────────────────────────┐    ┌──────────────────────────────────┐
│   DELECTABLE AI (AXP)    │◄──►│   INSTACART COMMERCE PLATFORM    │
│                          │    │                                  │
│  ┌────────────────────┐  │    │  ┌────────────────────────────┐  │
│  │ Grocery Agent       │  │    │  │ Storefront Pro              │  │
│  │ (29 tools, LLM)    │──┼───►│  │ (catalog, cart, checkout)   │  │
│  └────────────────────┘  │    │  └────────────────────────────┘  │
│  ┌────────────────────┐  │    │  ┌────────────────────────────┐  │
│  │ Knowledge Graph     │  │    │  │ IDP API / MCP Server        │  │
│  │ (Food + Shopper)   │──┼───►│  │ (recipe, shopping list)     │  │
│  └────────────────────┘  │    │  └────────────────────────────┘  │
│  ┌────────────────────┐  │    │  ┌────────────────────────────┐  │
│  │ Ads / RMN           │  │    │  │ Carrot Ads API              │  │
│  │ (auction, target)  │◄─┼───►│  │ (sponsored, display, RPM)   │  │
│  └────────────────────┘  │    │  └────────────────────────────┘  │
│  ┌────────────────────┐  │    │  ┌────────────────────────────┐  │
│  │ PIM + Catalog       │  │    │  │ Catalog API                 │  │
│  │ (enrichment, KG)   │──┼───►│  │ (product + item sync)       │  │
│  └────────────────────┘  │    │  └────────────────────────────┘  │
│  ┌────────────────────┐  │    │  ┌────────────────────────────┐  │
│  │ Orchestration       │  │    │  │ Connect Fulfillment API     │  │
│  │ (workflow, agents)  │──┼───►│  │ (delivery, pickup, slots)   │  │
│  └────────────────────┘  │    │  └────────────────────────────┘  │
│  ┌────────────────────┐  │    │  ┌────────────────────────────┐  │
│  │ Analytics            │  │    │  │ Shopping Widgets             │  │
│  │ (attribution, KPI) │◄─┼────│  │ (JS embed, cart events)     │  │
│  └────────────────────┘  │    │  └────────────────────────────┘  │
└──────────────────────────┘    └──────────────────────────────────┘
```

---

## Two Integration Surfaces — Don't Conflate Them

This architecture spans two distinct concerns that are easy to blur together:

1. **Catalog data onboarding** — getting the retailer's product catalog *into* Delectable's PIM so we can clean, hydrate, and enrich it into an AI-ready canonical record. See "Catalog Data Onboarding" immediately below.
2. **Runtime commerce integration** — the agent *acting* on the Instacart-powered storefront at shop time (recipes, carts, ads, fulfillment). See "Integration Layers" (MCP / IDP / Carrot Ads / Widgets / Connect).

The five runtime layers assume the catalog already exists on Instacart. **Onboarding is the prerequisite, and it has its own, non-API path** — this is the piece a PIM engagement (e.g. Sprouts) starts with.

## Catalog Data Onboarding — Getting the Catalog INTO Delectable's PIM

**Direction matters.** Instacart's Catalog API is **inbound only** — it's how a retailer submits catalog *to* Instacart (`POST /v2/data_ingestion/catalog/product/submission`, item submission, or SFTP bulk upload, all managed in the Platform Portal). There is **no bulk "read the catalog back out" API**, and Instacart's *enriched* version of the catalog (the images/descriptions/nutrition it merges in) is Instacart's asset — not something a third party pulls back.

So to bring the catalog into our PIM for enrichment, the sanctioned path is the retailer's own **data portability**:

```
Retailer (e.g. Sprouts) — Instacart Platform Portal
    │  download the SUBMITTED catalog inventory files  (SFTP / Portal UI)
    ▼
Delectable PIM — pim.ingest.matcher     (link / promote by GTIN)
    │
    ▼
Hydrate by GTIN from the grocery golden set   (Open Food Facts · USDA · GDSN)
    │
    ▼
Canonical, enriched, AI-ready catalog  →  feeds the 5 runtime layers below
```

- **The retailer exports their own submitted catalog** from the Platform Portal — no third-party access question, no scraping. Fast, low-friction; even a single department is enough to start.
- **We do NOT read Instacart's enriched catalog back** (no such API) — we re-enrich from our own golden reference sets by GTIN, which is more consistent and fully ours to use.
- **We do NOT scrape the storefront.** `shop.<retailer>.com` robots.txt disallows non-Googlebot crawlers, and Instacart's ToS governs the platform — a retailer cannot waive Instacart's controls on Instacart's infrastructure.
- **Data rights / vendor delegation** (can a vendor receive the export; can we obtain Instacart's enriched attributes) are contract-specific — confirm **in writing** per the retailer's Instacart Platform agreement.
- **Optional push-back:** once enriched, our attributes can flow *back out* to improve the storefront via the same inbound Catalog API submission endpoints (below). Onboarding-in and push-back-out are separate flows in opposite directions.

> Meeting-ready walkthrough: [`../public-sprouts/sprouts-instacart-integration-guidance.html`](../public-sprouts/sprouts-instacart-integration-guidance.html) · before/after result: [`../public-sprouts/sprouts-product-intelligence.html`](../public-sprouts/sprouts-product-intelligence.html)

## Integration Layers

### Layer 1: MCP — Agentic Commerce (Primary)

The fastest path for AI agent integration. Instacart's MCP server exposes tools that our grocery agent calls directly.

| | Details |
|---|---|
| **Endpoint** | `https://mcp.instacart.tools/mcp` (prod) / `https://mcp.dev.instacart.tools/mcp` (dev) |
| **Transport** | HTTP (Streamable HTTP / SSE) |
| **Auth** | Bearer token (IDP API key) |
| **Tools exposed** | `create-recipe` — creates shoppable recipe page with ingredient matching |
| | `create-shopping-list` — creates shoppable list from product names |

**How Delectable AI uses this:**

Our grocery agent's existing tools (`create_recipe`, `build_shopping_cart`, `manage_shopping_list`) produce structured output that maps directly to MCP tool inputs. The orchestration layer routes to Instacart MCP when the retailer's commerce platform is Instacart:

```
Shopper: "I want to make keto lasagna for 6 people"
  → grocery-agent: create_recipe (generates ingredients + instructions)
  → orchestration: detect retailer platform = Instacart
  → MCP call: create-recipe → returns shoppable Instacart URL
  → Agent responds with recipe + one-click "Shop these ingredients" link
```

The MCP layer means we don't hard-code Instacart API calls — the agent discovers tools at runtime. When Instacart adds new MCP tools (product search, cart management), our agent picks them up automatically.

### Layer 2: IDP REST API — Programmatic Commerce

For deterministic, non-LLM workflows where we need direct API control.

| | Details |
|---|---|
| **Base URL** | `https://connect.instacart.com/idp/v1/` |
| **Auth** | Bearer token (IDP API key) |
| **Endpoints** | `POST /idp/v1/products/recipe` — create recipe page |
| | `POST /idp/v1/products/products_link` — create shopping list page |

**How Delectable AI uses this:**

- **Weekly ad automation**: When our ads module generates a personalized flyer, each recipe card links to a pre-built Instacart shopping list via the IDP API
- **Email/push campaigns**: Campaign manager creates shoppable links in bulk without LLM overhead
- **Social commerce**: Ghost Cart pre-warms a shopping list from a TikTok recipe — the shoppable link is ready before the shopper taps

### Layer 3: Carrot Ads API — Retail Media Monetization

This is where our ads module and Instacart's retail media network converge.

| | Details |
|---|---|
| **Base URL** | `https://connect-ian.instacart.com` |
| **Endpoints** | `POST /v2/ian/sp` — get sponsored products (up to 100 per request) |
| | `POST /v2/ian/dp` — get display placements |
| | `GET /v2/ian/brand_page` — brand page content |
| | `POST /v2/ian/track` — impression/click/conversion tracking |

**How Delectable AI uses this:**

Our ads module already runs a real-time auction with 14 targeting methods and a helpfulness gate. For Instacart-powered retailers, we create a **dual-auction architecture**:

1. Delectable AI's auction selects contextually relevant sponsored products using our knowledge graph (dietary fit, household affinity, mission awareness)
2. Instacart's Carrot Ads API provides the CPG ad inventory and billing infrastructure
3. Our helpfulness gate ensures sponsored products are genuinely relevant — not just highest bid
4. Attribution flows through both systems: Instacart tracks the transaction, our analytics module tracks the full journey (signal → recommendation → ad impression → cart → purchase)

This gives the retailer **incremental RMN revenue** without degrading the shopping experience — exactly what Lei Duran means by "don't lose the human layer."

### Layer 4: Shopping Widgets — Frontend Embedding

For retailers who want Delectable AI intelligence surfaced directly on their Instacart-powered storefront.

| | Details |
|---|---|
| **Integration** | UMD JS library via `<script>` tag |
| **Types** | Prebuilt (search, cart, collections) and Custom (developer-built) |
| **Events** | checkout-complete, add-to-cart, session-start, order-cancel |

**How Delectable AI uses this:**

- **Custom Widget**: An "AI Assistant" widget on the storefront that wraps our grocery agent — shopper asks questions, agent responds with products that are instantly add-to-cart compatible via Instacart's widget framework
- **Event bridge**: Shopping Widget events (add-to-cart, checkout) feed into our analytics module for attribution and propensity model training
- **Smart collections**: Our PIM + knowledge graph generates personalized product collections that render through Instacart's prebuilt collection widget

### Layer 5: Connect Fulfillment API — Order Lifecycle

For retailers with a direct Instacart enterprise relationship who want Delectable AI to manage the full order lifecycle.

| | Details |
|---|---|
| **Base URL** | `https://connect.instacart.com/v2/fulfillment/` |
| **Auth** | OAuth 2.0 (client credentials, 24h tokens) |
| **Capabilities** | User/address management, delivery/pickup slot preview, order creation, cancellation, webhooks |

**How Delectable AI uses this:**

- **Slot-aware recommendations**: Our agent checks available delivery/pickup slots before suggesting a shopping mission — "Your usual Tuesday 4:30 PM pickup slot is available"
- **Order orchestration**: The workflow engine manages the full lifecycle: cart build → slot reservation → order creation → status tracking via webhooks
- **Fulfillment intelligence**: Analytics module tracks fill rates, substitution patterns, and delivery reliability to improve future recommendations

---

## Retailer-Specific Integration Patterns

### Pattern A: "Full Stack" (Aldi, Sprouts, Hy-Vee)

Retailer runs Storefront Pro end-to-end. Delectable AI integrates via all 5 layers:
- MCP/IDP for agentic shopping
- Carrot Ads for RMN revenue
- Shopping Widgets for frontend AI
- Connect for fulfillment orchestration
- Catalog API for product sync with PIM

### Pattern B: "Intelligence Layer" (Price Chopper, Raley's)

Retailer has an established Instacart relationship. Delectable AI adds:
- Personalization via grocery agent (MCP)
- Knowledge graph for product relationships
- Ads optimization on top of Carrot Ads
- Analytics for cross-channel attribution

### Pattern C: "Owned + Instacart" (Kroger, Publix)

Retailer has their own e-commerce AND uses Instacart for delivery. Delectable AI:
- Powers the owned experience directly (full AXP)
- Uses Instacart Connect for fulfillment only
- Unifies analytics across both channels

---

## What Delectable AI Adds That Instacart Doesn't

| Capability | Instacart Provides | Delectable AI Adds |
|---|---|---|
| **Product catalog** | Universal catalog, 1B+ items; *inbound submission only* | Canonical golden record onboarded from the retailer's Portal export, hydrated by GTIN from our golden set (OFF/USDA/GDSN); KG dietary/allergen/recipe-to-ingredient/brand relationships |
| **Personalization** | Basic "Buy It Again" | Household-level propensity, cadence prediction, mission detection, dietary profiling |
| **Shopping** | Search + browse + cart | Agentic: 29-tool agent with meal planning, recipe creation, perfect cart, pantry intelligence |
| **Ads** | Carrot Ads (CPG-funded) | Contextual auction with helpfulness gate — ads that are relevant, not interruptive |
| **Social** | None | Ghost Cart, Viral Pulse, creator economy, BlinkLink attribution |
| **Analytics** | Transaction reporting | Full-journey attribution: signal → recommendation → ad → cart → purchase → repeat |
| **Fulfillment** | World-class last-mile | Slot-aware agent recommendations, substitution intelligence |

**The pitch to an Instacart-powered retailer:**

> "Instacart gives you the commerce engine. Delectable AI gives you the intelligence engine. Together, one guest signal becomes a personalized recipe, a pre-staged cart with locally-stocked ingredients, a relevant sponsored product that earns you RMN revenue, and a delivery slot that fits the shopper's schedule — all in one conversation. No new platform to integrate. We sit on top of what you already have."

---

## Technical Requirements

| Requirement | Source |
|---|---|
| IDP API key | Apply via Instacart Developer Dashboard (brand review required) |
| MCP access | Same IDP API key works for MCP server |
| Connect API OAuth credentials | Provisioned by Instacart per retailer relationship |
| Carrot Ads API access | Requires Storefront Pro enrollment |
| Shopping Widgets library | Unique distribution URL per retailer |

## Documentation Links

| Resource | URL |
|---|---|
| Developer Platform API | https://docs.instacart.com/developer_platform_api/ |
| MCP Tutorial | https://docs.instacart.com/developer_platform_api/guide/tutorials/mcp/ |
| Connect Fulfillment API | https://docs.instacart.com/connect/fulfillment/ |
| Carrot Ads API | https://docs.instacart.com/ads/ |
| Shopping Widgets | https://docs.instacart.com/widgets/ |
| Catalog API | https://docs.instacart.com/catalog/ |
| Developer Dashboard | https://docs.instacart.com/developer_dashboard/oauth_applications/ |
| Business landing page | https://www.instacart.com/company/business/developers |

---

## Interactive Architecture Demo

See `instacart-architecture.html` for the interactive visual that walks prospects through each integration layer with clickable nodes, data flow animations, and integration details.
