Riti EnterpriseOn Shopify? Get the Shopify app →
Riti Enterprise
Developers — For the engineering lead SDK v1 · API v1 · OpenAPI 3.1

A script tag, a token, an order report.

Riti draws the try-on, fitting room and stylist on your product pages. Your front end passes it the product and receives the cart lines. Your backend mints short-lived session tokens and reports orders. Nothing touches your theme, your checkout or your platform plugin list.

A single-garment try-on of the cropped linen jacket, as the SDK renders it
tryon:success — One garmentRendered by Riti
Integration, in order

Three moves to live.

Load and initialise

Use a publishable key, which only works from the origins you allow, or have your backend mint session tokens.

<script src="https://api.rititech.app/sdk/v1/riti.js"></script>
<script>
Riti.init({
  publishableKey: "pk_live_…",
  getSessionToken: () =>
    fetch("/riti-session", { method: "POST" })
      .then((r) => r.json()),
  onAddToCart(items) {
    // each item carries its eventId
    myCart.add(items);
  },
});
</script>

Mount on product pages

Pass the product you already render. The buttons, fitting room and stylist come with it, styled from the console.

Riti.mount("#riti", {
  product: {
    id: "jacket-001",
    title: "Cropped Linen Jacket",
    imageUrl, url, price: "148.00",
    variants, variantId,
  },
});

// or every [data-riti-product] at once
Riti.mountAll();

// a floating fitting-room pill
Riti.launcher({ label: "Fitting room" });

Report the order

When an order lands, send its lines with your secret key. Lines whose eventId is your try-on are credited. Repeats are idempotent.

POST /api/v1/conversions
Authorization: Bearer sk_live_…

{
  "orderId": "1042",
  "currency": "USD",
  "lineItems": [{
    "lineItemId": "1042-1",
    "productId": "jacket-001",
    "quantity": 1,
    "unitPrice": 148.00,
    "eventId": "evt_9f…"
  }]
}
→ 202 { "attributed": 1, "ignored": 0 }
@riti/sdk · v1
The SDK

Small surface, plain events.

One global, Riti, served as a script tag or an ES module. Every event is also dispatched on document as a bubbling riti:<name> event, and a handler that throws is logged without breaking the widget.

  • Riti.init(options)Publishable key and/or getSessionToken, plus onAddToCart(items). Without a callback, a riti:add-to-cart DOM event does the add.
  • Riti.mount(target, { product })One widget on one element. Riti.unmount(target) removes it cleanly.
  • Riti.mountAll(root?)Mounts every [data-riti-product] element under root.
  • Riti.launcher(options)A floating pill that opens the fitting room, with position, label and offset.
  • Riti.on(name, handler) · Riti.offSubscribe to the events in the table. ready still fires for a late handler.
  • Riti.use(module)Optional modules such as Recommendations. The SDK loads entitled modules itself, pinned by SRI hash, so tenants without one never download it.
  • Riti.destroy()Tears everything down and forgets the cached session token, so a single-page app can initialise again.
EventDetail
readyversion, apiUrl
tryon:startproductId, lookId?
tryon:successeventId, productId, lookId?
tryon:errorerror, status, message
add-to-cartitems, each with eventId
look:savedid, pageUrl, imageUrl
room:open · close · addadd carries productId, variantId, source
recommendations:show · addRecommendations module
On the roadmap

The @riti/sdk npm package, React and Vue wrappers, a <riti-try-on> web component, a headless API mode, async render jobs and native iOS and Android SDKs.

Session tokens

Keep every key off the page.

Your backend mints a token with the secret key and hands it to the page through getSessionToken. Tenants can require a token for every caller with one setting.

POST /api/v1/sessions
Authorization: Bearer sk_live_…

{ "origin": "shop.example.com",
  "shopperRef": "cus_4471",
  "ttlSeconds": 900 }

→ 201 { "token": "rst_…", "expiresAt": "…", "livemode": true }
  • LifetimeOne to sixty minutes; fifteen by default.
  • ModeCarries the test or live mode of the key that minted it.
  • OriginOptionally pinned to one of your allowed hosts.
  • Shopper referenceAn opaque ID of yours, stamped on that shopper’s events.
Webhooks

Signed, retried, redeliverable.

Register endpoints per mode in the console. Each request carries Riti-Signature: t=…,v1=…, an HMAC-SHA256 of the timestamp and raw body under the endpoint’s signing secret.

Answer with any 2xx within ten seconds. Anything else is retried seven times over roughly 42 hours, then marked failed and left for redelivery from the console. Delivery is at least once; deduplicate on the envelope id.

  • tryon.succeededA render finished.
  • tryon.failedThe render provider failed. Failed renders are not billed.
  • cart.addedThe shopper added a try-on to the cart.
  • look.savedThe shopper saved a look with their email and consent. You send the email, from your brand.
  • conversion.attributedA reported order credited at least one try-on.
  • catalog.sync.completedA registered catalogue feed synced.
  • catalog.sync.failedA feed could not be fetched or parsed, or was held before archiving most of its products.
  • webhook.test“Send test event” in the console.
Versions

Pin it, or follow it.

  • /sdk/v1/riti.jsFollows the latest v1 release, cached for five minutes.
  • /sdk/v1.3.2/riti.jsAn exact, immutable release, with subresource-integrity hashes in its manifest.json.
  • OpenAPI 3.1The contract for every public route, served at /api/openapi.yaml. A test fails the build if a route is missing from it.
  • Additive changesNew endpoints, fields and event types ship within v1. Ignore unknown fields and treat unknown event types as a 2xx no-op.
  • Breaking changesOnly in a new major. The previous major keeps working for at least twelve months, with Deprecation and Sunset headers and notice to every tenant owner.
API reference

Every public route.

The browser SDK calls the widget routes for you. Your backend calls the server routes with a secret key. Full request and response schemas are in the OpenAPI spec.

RouteWhat it does
Widget API Publishable key from an allowed origin, or a session token
GET/api/widget/configWidget settings for the calling tenant
POST/api/widget/tryonRender one garment on the shopper’s photo
POST/api/widget/tryon/lookRender a multi-garment outfit
POST/api/widget/looks/planStylist plan for the fitting room (free, not counted toward usage)
POST/api/widget/room-addCount a garment added to the fitting room
POST/api/widget/events/{eventId}/add-to-cartMark a try-on as added to cart
POST/api/widget/saved-looksSave a look and the shopper’s email
POST/api/widget/feedbackRate a try-on
POST/api/widget/recommendationsRecommendations for a product added to the room
POST/api/widget/recommendations/eventsCount recommendation impressions, clicks, room adds and dismissals
Server API Secret key, server to server
GET/api/v1/tenantThe calling tenant
POST/api/v1/sessionsMint a short-lived browser session token
POST/api/v1/conversionsReport an order for attribution
PUT/api/v1/catalog/productsCreate or update catalogue products in a batch
GET/api/v1/catalog/products/{id}One catalogue product, with what Riti derived from it
DELETE/api/v1/catalog/products/{id}Archive a product (kept for saved looks, never recommended)
PATCH/api/v1/catalog/inventoryUpdate stock without resending products
GET/api/v1/catalog/statusCatalogue health for the key’s mode
GET/api/v1/catalog/feedsRegistered catalogue feeds
POST/api/v1/catalog/feedsRegister a CSV, TSV or JSON feed that Riti pulls on a schedule
PATCH/api/v1/catalog/feeds/{id}Pause, resume or retune a feed
DELETE/api/v1/catalog/feeds/{id}Remove a feed (its products stay in the catalogue)
POST/api/v1/catalog/feeds/{id}/syncSync a feed now
GET/api/v1/catalog/feeds/{id}/runsThe last 20 sync runs of a feed
Hosted Public, addressed by look token
GET/looks/{token}Hosted look page
GET/looks/{token}/imageThe look image
GET/sdk/{version}/{file}The browser SDK: the v1 alias, or an exact version with SRI hashes

Want the spec file, test keys and a walkthrough of the console? Book a demo and we’ll provision a test tenant for your team.