How to Integrate a Size Recommendation API Into an Ecommerce Store
Architecture blueprint for engineers connecting React, Shopify, or native mobile checkouts to a privacy-scoped sizing API.
Key Takeaways
- Keep server secret keys (uf_live_*) strictly on backend services while using publishable keys on product pages.
- Use OAuth 2.0 + PKCE (S256) to obtain short-lived size recommendation tokens and verify webhook HMAC signatures.
1. Sync Product Catalogs and Garment Size Specs
Begin by synchronizing product IDs, SKU variants, apparel category tags, fabric stretch classification, and canonical centimetre garment tables via REST endpoints or CSV batch import.
2. Obtain Shopper Permission via OAuth 2.0 + PKCE
When a shopper clicks Find My Size on a storefront, redirect or open a popup to UniFit authorization using a S256 PKCE code challenge. Exchange the one-time authorization code server-side for a short-lived scoped grant.
3. Request Garment Recommendations & Handle Feedback
POST the productId, variantId, and scoped grantToken to /v1/recommendations from your server or via our 1-line auto-mount storefront widget. Subscribe to HMAC-signed webhooks to sync fit feedback and return attribution automatically.
Put This Guide Into Practice
Use UniFit's interactive sizing tools or connect your brand storefront.