# Developer documentation ## Getting started ### Introduction Dimera lets your shoppers find their exact size and see products on a real body — directly on your product pages. This guide covers both integration paths. #### What Dimera does - Body measurement — shoppers self-measure from a phone photo and get accurate garment measurements. - Size recommendation — those measurements are matched to your size chart to recommend one size. - Virtual try-on — an AI render of the product on the shopper before they add to cart. #### Two ways to integrate Most brands use the embeddable widget — a single script tag, no backend work. If you need full control (a native app, a headless storefront, or custom UI) call the REST API directly. | Path | Best for | | --- | --- | | `Widget` | Shopify, WooCommerce and most storefronts. Fastest to launch — copy one snippet. | | `REST API` | Native apps, headless commerce and fully custom flows. | > [!NOTE] > You can mix both: run the widget on your storefront and call the API from your backend for order-time size validation. ### Quickstart Get a working size finder on a product page in about five minutes. #### 1. Get your keys In your Dimera dashboard open a project, go to the Widget & install tab, and copy the publishable key (pk_live_…) for the snippet. For server-side calls you also need the API key (ak_live_…) from Project settings — that is a different credential from the Strict-mode signing secret (sk_live_…), which only signs widget init tokens. #### 2. Add the widget Paste this snippet before the closing body tag on your product pages. Replace the project and key values with your own. ```html ``` #### 3. Go live Publish the page. The trigger appears where you targeted it, and shoppers can measure or try on immediately. Every session shows up under the project’s Logs and Conversions tabs. > [!TIP] > Use your publishable key (pk_) in front-end code. Never expose the secret key (sk_) in a browser — it can read and write all project data. ### How it works A quick look at what happens between a shopper tapping the trigger and a size appearing. #### The pipeline - The shopper opens the widget and follows a guided camera flow (or uploads a photo). - For a body measurement the face can be blurred on the device — enforced by the shop, or left to the shopper to switch on. A virtual try-on is never blurred. - The image plus the shopper’s height is processed by our measurement model in the EU. - Measurements are matched to the product’s size chart to produce a recommendation. - The photo is deleted right after processing; only derived measurements are kept. > [!NOTE] > Nothing is used to train our models without explicit, separate consent. See Data & privacy for the full detail. ## Widget ### Installation The widget is a single asynchronous script. It injects a trigger element into your page and handles the entire flow in an overlay. #### Embed snippet ```html ``` #### Where to place it Add it once per product page. The script is async and defers its own work, so it will not block page rendering. If your store uses a theme layout, put it in the product template so it only loads where it is needed. Where the tag itself goes depends on the placement you picked in the dashboard, because the trigger is positioned by the widget, not by the tag: - Your own container — you place the mount points yourself; see below. This is the one that gives you an exact position. - Attach to element — the trigger is inserted directly after the first element matching your CSS selector, and it keeps watching the DOM for up to 10 seconds so a client-rendered product page still works. Use it when you cannot add markup to the template. - Floating — the button is fixed to the screen corner you chose, independent of your markup. All three position themselves, so the script tag can go anywhere — just before is the habit. Whether the trigger renders as a button or as an underlined text link is a separate setting (data-style), not a placement, so a link can sit in any of the three. #### Your own container The container placement is the one that gives you the exact position, and the only one that can put a button inside or before an element. Leave the script in your theme footer and add an empty div wherever a button belongs: ```html
``` Every container may carry its own data- attributes, which override what the dashboard stored for that button only — so one snippet can render a compact link next to the price and a large button in the gallery. data-element picks which trigger a container is (measure or vto), and data-product / data-product-image / data-product-category / data-colours let a "shop the look" page give each button its own product — which is also what decides the size recommended for it. - [data-dimera] is accepted as an alias for class="dimera". - A container is ours: on it, the attributes above are read as widget overrides. Do not reuse a Dimera container as a hook for your own data-label / data-color / data-size — add a wrapper element for those instead. - Containers that appear later are picked up for 10 seconds, so a client-rendered product page works. After that, call Dimera.refresh(). - A container is empty until the API confirms the widget may run, so give it a min-height if the layout shift matters to you. - Only one snippet may run per page. Several buttons come from several containers of one widget, never from a second snippet — the second one is refused and says so in the console. #### If your site sends a Permissions-Policy header The measurement and try-on steps use the device camera, which runs inside YOUR page and is therefore governed by your own Permissions-Policy (or the older Feature-Policy) header. If that header omits the camera, or sends camera=(), the browser removes the feature from the document — the widget cannot even ask for permission, and the console reports a permissions policy violation with no prompt shown. Allow the camera for your own origin. Nothing cross-origin has to be granted: the widget runs in your document, not in an iframe. ```http Permissions-Policy: camera=(self) ``` > [!IMPORTANT] > This is the one integration problem that looks like a broken widget rather than a configuration one: everything loads, the button works, and the capture screen simply never starts the camera. > [!TIP] > The dashboard generates this exact snippet for you with your keys and chosen options already filled in — copy it from the Widget & install tab rather than writing it by hand. ### Configuration Configure the widget entirely through data- attributes on the script tag. No JavaScript required. #### Data attributes | Attribute | Type | Description | | --- | --- | --- | | `data-project` | string | Your project slug. Required. | | `data-key` | string | Publishable key (pk_live_…). Required. | | `data-mode` | enum | combined · measure · vto. What the widget offers. | | `data-locale` | string | Language the widget speaks to the shopper: en, de, sk or cs. Pass the current page’s language and one snippet serves a whole multilingual storefront. Defaults to the widget’s own setting; an unsupported value falls back to it and says so in the console. | | `data-units` | enum | metric · imperial. Defaults to the widget’s own setting. | | `data-layout` | enum | single · separate. Only for combined mode — one element the shopper picks from, or two dedicated triggers. | | `data-trigger` | enum | container · selector · floating. Where the element is placed. | | `data-position` | enum | For floating: bottom-right · bottom-left · top-right · top-left. | | `data-target` | string | For selector: CSS selector the trigger is injected after. | | `data-element` | enum | Containers only: measure · vto · single. Which trigger this container renders. Absent renders the widget’s usual set. Ignored if the project does not offer it. | | `data-style` | enum | button · link. Whether the trigger renders as a filled button or an underlined text link. Independent of the placement. | | `data-label` | string | Button text (single-element modes). | | `data-icon` | enum | ruler · sparkle · person · none. | | `data-color` | string | Hex accent color. Omit to inherit the project brand color. | | `data-shape` | enum | pill · rounded · square. | | `data-size` | enum | small · medium · large. | | `data-product` | string | The product on the page. Pass its EAN, its SKU or its Dimera product id and a completed measurement will also recommend a size from that product’s size chart. A SKU is matched only when exactly one product in your account carries it — the column is your own free text, so two products sharing one code resolve to neither rather than to a guess. It is also what decides WHAT is measured: on a footwear or socks product the widget measures the shopper’s feet against a sheet of paper, on everything else their body. Any other value still labels a try-on result and will attribute a conversion, but recommends no size. | | `data-product-image` | string | The URL of the product’s own photo, for a try-on of an item our catalogue does not hold. Up to two, comma separated (front and back). Absolute http(s) URLs only, and each is fetched and re-validated by us. Only read when data-product resolves to nothing here — a product you have given us wins, because its photos are the ones you curated. | | `data-product-category` | enum | What kind of item it is: tops · shirts · sweaters · outerwear · trousers · shorts · skirts · dresses · underwear · swimwear · sleepwear · socks · footwear · headwear · gloves · coveralls · accessories. REQUIRED for a try-on whenever data-product does not resolve to a product of yours in Dimera — see “Try-on without our catalogue” below. It is also the fall-back answer to what gets measured when data-product names nothing we hold: footwear and socks measure the feet, gloves the hands (coming soon — a gloves page offers no measurement yet), everything else the body. (socks is measured but never rendered, so it is never offered for try-on.) | | `data-colours` | string | Comma-separated colourways to offer for try-on, e.g. Black,Sand — or Black:#111111,Sand:#D9C7A7 to show swatches. One colour is used silently. When the product is in your Dimera catalogue with colourways, a try-on never runs without one: if the page names none we know, the widget asks the shopper to pick from your catalogue’s colourways. | | `data-shopper` | string | Your own customer id, so a shopper’s allowance follows them across devices — and so your backend can address them. Send the SAME string here and in every API call about that person; see “Your customer id” under Shopper allowances. Unsigned — see Strict mode. | | `data-token` | string | Signed init token. Required when Strict mode is on — see below. | | `data-cart` | bool | Set to "true" to offer an Add to cart button at the end of a try-on. Only do this once your page listens for the dimera:cart event — the widget cannot add anything to your cart itself, so without a listener the button would do nothing. | #### What is offered depends on the product A trigger is only placed for something a shopper on that page could actually do, and the page tells us which by naming its product. Two things are decided before any button is drawn: whether this shop collects the measurement this product needs — a footwear or socks page measures feet, and a shop that has feet measurement switched off has no measurement to offer there — and whether a try-on could be rendered at all, which needs a category and a photo. A capability that fails its check is simply not offered on that page: no button, and one line in the browser console saying which check failed and what to change. The other capability is unaffected, and every other page of the shop is unaffected. > [!TIP] > A button that used to appear and no longer does is this, and the console says so. The usual causes are a product whose category needs a measurement the project does not collect (switch it on in Dimera → your project → measurement policy), and a try-on on a page that names neither a product of yours nor a data-product-image. > [!IMPORTANT] > The check reads the product the SCRIPT tag names. A
carrying its own data-product is not covered by it — those buttons are drawn as before and a refusal, if any, arrives when the shopper presses them. A page that adds its product after load is the same case. #### Try-on without our catalogue A try-on needs two things about the garment: a photo of it, and what kind of item it is. When data-product resolves to a product of yours in Dimera we take both from there — your own photos, in the order you arranged them, and the category you filed it under. Nothing else is read, so you can leave the two attributes below empty on a catalogue product. When it does not — you have not imported that product, or the code on the page matches more than one of them — the page is the only thing that knows. Pass data-product-image with the photo URL(s) and data-product-category with one of the values listed above, and the try-on renders exactly as it would from the catalogue. ```html
``` > [!IMPORTANT] > Send the category, or there is no try-on. Where on the body an item is worn is the one thing that cannot be read off a photograph: told only to dress the shopper, the renderer completes an outfit — a sleeveless vest came back over a long black base layer that was in neither photo. So a page with no category from either source is not offered a try-on at all (see above), and a run that reaches us anyway refuses at its start with vto_no_category, before the shopper takes a photo. The measurement flow is unaffected: a size recommendation needs data-product and ignores both of these. > [!TIP] > The photo must be of the product on the page. It is not an override of anything — it is what we use when we have nothing of our own — so if the page can give us a resolvable data-product instead, do that: your catalogue photos are colourway-aware, they cost no fetch, and a measurement then recommends a size as well. #### Per-page overrides Every widget already carries its full configuration, resolved from your publishable key — the attributes above are optional. Where one is present it wins for that page load; where it is absent the widget uses what you saved in the dashboard. That is what lets a single snippet serve a whole storefront: pass the current page’s language, its unit system and the product being viewed. Anything else about the widget — where it loads, which domains may use it, how the trigger looks — belongs to the widget itself; create a second widget when you need those to differ. ```html data-locale="de" data-units="metric" data-product="4006381333931" ``` #### Overrides on a container A
may carry the same attributes to override them for that one button: data-element, data-label / data-icon and their measure/vto variants, data-style, data-shape, data-size, data-color, data-product, data-product-image, data-product-category and data-colours. Everything else stays on the script tag, because it describes the widget or the whole page render rather than one button — data-key, data-locale, data-units, data-mode, data-layout, data-trigger, data-position, data-target, data-shopper and data-token. Put one of those on a container and the console tells you where it belongs. #### Separate triggers When data-mode="combined" and data-layout="separate", set the two elements independently with data-measure-label / data-measure-icon and data-vto-label / data-vto-icon. Placement, shape, size and color are shared. ```html data-mode="combined" data-layout="separate" data-measure-label="Find my size" data-measure-icon="ruler" data-vto-label="Try it on" data-vto-icon="sparkle" ``` #### Strict mode By default a widget trusts the browser: it checks that the page’s domain is on your allowlist, which is enough for most stores. Strict mode adds a second requirement — your backend signs a short-lived token for each page render, and the widget will not open a session without it. Turn it on when a shopper’s remaining attempts have to be unforgeable, or when you want the shopper identity you pass us to be proof rather than a hint. Under Strict mode the signed identity replaces data-shopper entirely, so nobody can claim to be someone else by editing the page. > [!IMPORTANT] > Strict mode needs a secret key, created in Dimera under your project → Settings. It is a real secret: keep it on your server, never in page source, a repository or a frontend build. Anyone holding it can sign tokens as you. #### Signing a token > [!NOTE] > This is not the same key as the API key used for the REST endpoints. The widget signing secret only signs init tokens; keep them separate and rotate them independently. Build the token from three values — your widget’s publishable key, the shopper, and an expiry: - payload = base64url("|") — expires is a Unix timestamp, at most 24 hours ahead - signature = hex(hmac_sha256(secret, "||")) - token = payload + "." + signature The shopper can be your own customer id, or a guest identifier for a visitor who has not signed in. It may contain any characters, including the | separator. > [!IMPORTANT] > The payload is signed, not encrypted — base64 is trivially decoded, and the token sits in your page source. Never put a session id, an email address or anything else sensitive in it. For guests, derive an opaque value (an HMAC of the session id, or a dedicated random cookie) rather than passing the session id itself. ```php $key = 'pk_your_widget_key'; $secret = getenv('DIMERA_WIDGET_SECRET'); $shopper = $user ? 'cust-'.$user->id : 'guest:'.substr(hash_hmac('sha256', session_id(), $secret), 0, 32); $expires = time() + 900; $payload = rtrim(strtr(base64_encode($shopper.'|'.$expires), '+/', '-_'), '='); $signature = hash_hmac('sha256', $key.'|'.$shopper.'|'.$expires, $secret); $token = $payload.'.'.$signature; ``` ```js const crypto = require('crypto') const key = 'pk_your_widget_key' const secret = process.env.DIMERA_WIDGET_SECRET const guest = crypto.createHmac('sha256', secret).update(sessionId).digest('hex').slice(0, 32) const shopper = user ? `cust-${user.id}` : `guest:${guest}` const expires = Math.floor(Date.now() / 1000) + 900 const payload = Buffer.from(`${shopper}|${expires}`).toString('base64url') const signature = crypto.createHmac('sha256', secret) .update(`${key}|${shopper}|${expires}`) .digest('hex') const token = `${payload}.${signature}` ``` ```ruby require 'openssl' require 'base64' key = 'pk_your_widget_key' secret = ENV['DIMERA_WIDGET_SECRET'] guest = OpenSSL::HMAC.hexdigest('SHA256', secret, session.id.to_s)[0, 32] shopper = user ? "cust-#{user.id}" : "guest:#{guest}" expires = Time.now.to_i + 900 payload = Base64.urlsafe_encode64("#{shopper}|#{expires}", padding: false) signature = OpenSSL::HMAC.hexdigest('SHA256', secret, "#{key}|#{shopper}|#{expires}") token = "#{payload}.#{signature}" ``` Then template it into the snippet: ```html data-token="" ``` > [!IMPORTANT] > Sign per request. If the page is served from a cache or a CDN, every visitor receives the same token — so they all share one shopper identity and one allowance, which is the opposite of what Strict mode is for. On a cached page, fetch the token from an uncached endpoint of your own and set data-token before the widget loads. #### When a token is rejected The widget renders nothing and logs the reason to the browser console. Each of the three says which half to look at: | Code | What to check | | --- | --- | | `strict_token_missing` | No data-token on the script tag — your template is not passing one. | | `strict_token_invalid` | The signature did not verify: a stale secret, a different widget key than data-key, or a payload that is not base64url of "\|". | | `strict_token_expired` | Outside the validity window. Sign per page render — a token served from a cached page will expire — and keep the expiry within 24 hours. | > [!NOTE] > Replacing the secret key invalidates every token already signed with the old one, immediately. Deploy the new key to your backend first, or Strict-mode widgets will stop opening until you do. ### Events & JS API The widget tells your page what happens — a flow opened, a size came back, a try-on finished, something failed. Every event arrives as a DOM event on document, and window.Dimera is a small API for opening flows and for listening in one line. #### Listening Each event is a CustomEvent on document, named dimera: plus the event name, with its payload in e.detail. Reach for this form: it works whether your code runs before or after our snippet. ```js document.addEventListener('dimera:measurement:complete', function (e) { console.log(e.detail.recommendedSize); // e.g. "M" }); ``` Dimera.on() is the same thing in one line and returns a function that removes the listener again. It exists only once our snippet has loaded, so call it after that — or use the form above, which does not care. ```js var off = Dimera.on('measurement:complete', function (detail) { console.log(detail.recommendedSize); }); // stop listening off(); ``` #### Events | Event | Fired when | | --- | --- | | `widget:open` | The overlay has opened. | | `widget:close` | The overlay has been dismissed. | | `measurement:complete` | A measurement result is on screen — a fresh one, or a saved one the shopper reused. | | `tryon:complete` | A try-on render is on screen. | | `tryon:shared` | The shopper sent their try-on somewhere from the Share sheet. Tells you which channel, never the link. | | `cart` | The shopper pressed Add to cart on a try-on. Opt-in, see below. | | `error` | A flow ended without a result: a refusal, an exhausted allowance, a failed run. | #### What each event carries ```js // dimera:measurement:complete ('dimera:tryon:complete' is the second block) { run: "9f1c…", // the run this came from, null for a reused saved result kind: "body", // body | feet | hands (coming soon) product: "4006381333931", // whatever your data-product said, null if none recommendedSize: "M", // null when no size could be named — see below sizeBasis: { // PRESENT only when a size chart was actually read measurements: ["chest", "waist"], deviation: 1.4, }, measurements: { // ONLY when your project has "Send measurements to your page" on chest: 98.4, waist: 82.1, // our own names, centimetres, already calibrated }, saved: false, // true when the shopper reused a saved measurement measuredAt: null, // ISO 8601, set only when saved is true } // dimera:tryon:complete { run: "3a8e…", product: "4006381333931", colour: "Navy" } // dimera:tryon:shared { run: "3a8e…", product: "4006381333931", channel: "whatsapp" } // channel: copy | native | whatsapp | messages | email // dimera:widget:open / dimera:widget:close { mode: "measure", product: "4006381333931" } // mode: measure | tryon | null { reason: "closed" } // closed | error // dimera:error { code: "out_of_credits", stage: "flow", mode: "measure" } // stage: flow | allowance | run mode: measure | tryon | null ``` > [!TIP] > recommendedSize is null in two different situations, and sizeBasis is how you tell them apart: if sizeBasis is missing, no size chart was read at all (usually there was no data-product on the page); if it is present, the chart was read and nothing on it fits this shopper. > [!IMPORTANT] > By default an event carries the size, never the shopper’s measurements — and never a URL for the try-on image. Both are personal to them rather than to the sale, and an event on document is read by every script on your page, not only yours. A shopper who wants to share their try-on has a Share button that mints a link they can withdraw again; tryon:shared tells you they used it, and which channel, but never the link. > [!TIP] > If your own code genuinely needs the numbers — a made-to-measure order, your own fit logic — switch on “Send measurements to your page” in the project’s settings and measurements appears in the event. It is a setting rather than an attribute on purpose: anything that can be written into your page’s HTML could otherwise switch it on without you. While it is on, the consent screen tells the shopper that this shop receives their measurements. #### Add to cart When a try-on finishes, the widget can offer an Add to cart button. Pressing it records the intent in your Conversions report and hands the product to your page — it cannot touch your cart itself, so putting the item in is your code’s half of the job. Switch it on with data-cart="true" and listen on the document: ```js document.addEventListener('dimera:cart', function (e) { // e.detail = { run, product, size, colour } myShop.addToCart(e.detail.product, e.detail.size); }); ``` > [!TIP] > detail.size is the size Dimera recommended, which is the point of the event: add THAT variant rather than whichever one the page happens to have selected, or the shopper receives a size we never recommended. > [!IMPORTANT] > The button is rendered only when data-cart="true". There is no way for the widget to tell whether your page has a listener, so it is an explicit opt-in — a button that silently fails to add anything is worse than no button. #### Opening programmatically Skip the built-in trigger and open the widget from your own button. ```js document.querySelector('#my-btn').addEventListener('click', function () { Dimera.open({ mode: 'measure', product: '4006381333931' }); }); ``` Both keys are optional: mode is measure or tryon (leave it out to let the widget decide, as your own trigger does), and product is an EAN, a SKU or a Dimera product id. What gets measured is not one of them — the product decides that. > [!IMPORTANT] > Asking for something this widget does not offer opens nothing and says why in the console — the same as a trigger configured for a feature you have switched off. A product passed here carries no photo URLs of its own, so on a shop whose catalogue does not live with us, use a
container for that product instead; each container resolves its own full configuration. ## API reference ### Authentication The Dimera REST API is available at https://api.dimera.app/v1. Every request is authenticated with your project’s API key, sent as a bearer token. #### Authorization header ```bash curl https://api.dimera.app/v1/me \ -H "Authorization: Bearer ak_live_R2p8Xc…" ``` > [!TIP] > The whole API is also described as an OpenAPI 3.1 specification at https://dimera.app/openapi.json — import it into Postman or Insomnia, generate a client from it, or hand it to an AI coding assistant. Create the key in Dimera under your project → Settings → API key. There is one key per project: it is shown once when you create it, and afterwards it can be revealed again behind your password. > [!IMPORTANT] > The key grants full access to a project’s API — it can reset a shopper’s remaining attempts and erase a shopper’s data. Keep it on your server, never in browser or mobile client code, and replace it from Project settings if it leaks. > [!NOTE] > This is not the same key as the Strict-mode signing secret. That one only signs widget init tokens; this one opens the REST API. They are created, revealed and replaced independently, so rotating one never breaks the other. #### Check your key GET /v1/me is the call to make first. It says which project the key opens, what that project offers, the per-shopper limits it enforces — including whether a reported purchase will reset them — and how many credits are left. A credits level of "empty" means the widget has stopped rendering on your storefront. ```json { "project": { "id": 12, "title": "Nordwear", "status": "active" }, "capabilities": { "widget_mode": "combined", "measure": { "body": true, "feet": false, "hands": false }, "vto": true, "profiles": true }, "limits": { "measure": { "per_shopper": 3, "reset_on_purchase": true }, "vto": { "per_shopper": 10, "reset_on_purchase": false } }, "credits": { "balance": 1400, "level": "ok" }, "key": { "created_at": "2026-09-01T08:12:00+00:00", "last_used_at": "2026-09-02T10:41:12+00:00" } } ``` All requests must be made over HTTPS. Responses are JSON. Timestamps are ISO-8601 in UTC. > [!NOTE] > A per_shopper limit of null means unlimited — which is not the same as 0, and the API keeps the two apart everywhere they appear. ### Report a purchase Tell Dimera what was bought. This is the call that closes the loop: we know which size was recommended, only you know which was ordered — and it is what hands a shopper their measurement attempts back. #### Report a purchase ```bash curl https://api.dimera.app/v1/conversions \ -H "Authorization: Bearer ak_live_R2p8Xc…" \ -H "Content-Type: application/json" \ -d '{ "order_ref": "ORD-2041", "shopper": { "external_id": "cust-991" }, "items": [ { "ref": "8591234567890", "size": "M", "price": 39.9, "currency": "EUR" } ] }' ``` #### Response ```json { "recorded": 1, "duplicates": 0, "shopper": { "resolved": true, "reset": { "measure": true, "vto": false } } } ``` #### Request parameters | Field | Type | Description | | --- | --- | --- | | `order_ref` | string | Your own order identifier. Required — it is what makes a retried delivery idempotent. Max 64 characters. | | `shopper.external_id` | string | The customer id you pass the widget as data-shopper. This is what lets us find the shopper whose attempts should reset. | | `shopper.uid` | string | Alternatively, the Dimera shopper id if you stored one. | | `occurred_at` | string | ISO-8601. Defaults to now; cannot be in the future. | | `items` | array | One entry per order line, 1–100. Each becomes one row in your Conversions report. | | `items[].ref` | string | How you identify the product: its EAN, its SKU, or its Dimera product id. Required. A reference we cannot match is still recorded — the sale happened either way. | | `items[].title` | string | Product name, used only when the reference matches nothing in your catalog. | | `items[].size` | string | The size actually ordered. This is the half we compare against what we recommended. | | `items[].price` | number | Line price. | | `items[].currency` | string | Three-letter currency code. | | `items[].run` | string | Optional. The run this line’s size came from — the id measurement:complete gave your page. Sending it attributes the sale to that exact run instead of to the shopper’s most recent one. It has to be a finished run of the same shopper, or the whole call is refused with 404 run_not_found so a wrong id cannot pass silently. | #### Retries are safe A purchase is identified by your order reference plus the product reference, so sending the same order twice records nothing the second time and answers 201 with a duplicates count. Retry as often as your queue needs to. #### The quota reset If the project has "reset attempts on purchase" switched on for measurement or try-on, this call is what performs it: the shopper starts again from a full allowance. Nothing else triggers it. > [!IMPORTANT] > The reset can only reach a shopper you identified. Pass data-shopper (or a Strict-mode token) in the widget snippet and the same id here — without it we hold nothing that ties the purchase to a browser, so the sale is recorded, no attempts are returned, and the response says resolved: false. ### Shopper allowances Read and manage the per-shopper allowances the widget enforces, addressed by your own customer id. #### Your customer id Every call in this API that is about a PERSON — an allowance, a headless measurement, a headless try-on, an erasure — addresses them by an id of your own choosing. Dimera never stores that id: we keep a one-way hash of it, salted per project, so two shops both calling a customer cust-991 can never reach each other’s data. Because it is your id, only you can get it wrong — and a wrong one fails invisibly: every call succeeds, and the data simply describes two different people. So: - Use the EXACT same string you pass the widget as data-shopper (or as the sub claim of a Strict-mode token). It is compared verbatim before hashing, so casing and whitespace matter: cust-991 and Cust-991 are two people. - Make it stable for the life of the customer — your internal user id or a UUID. Never a session or cart id, and not an email address: a customer who changes their address would silently become a new person and lose their measurements. - Keep it under 160 characters. - Avoid a slash. Everything else is fine URL-encoded (spaces, +, @, accents), but an encoded slash is rejected by web servers before the request reaches us, so an id containing one cannot be addressed in a path at all. - Treat it as an identifier, not a secret — it is not a credential, and the ak_ key is what authenticates the call. > [!NOTE] > A visitor you never identified exists to us only as an anonymous browser: the widget still works for them, but nothing about them can be reached from your backend, because we hold nothing that names them. That is the strongest reason to pass data-shopper. #### What a shopper has left ```bash curl https://api.dimera.app/v1/shoppers/cust-991 \ -H "Authorization: Bearer ak_live_R2p8Xc…" ``` ```json { "shopper": { "external_id": "cust-991", "created_at": "2026-08-02T09:10:00+00:00", "last_seen_at": "2026-09-02T11:02:41+00:00" }, "allowance": { "measure": { "limit": 3, "used": 3, "remaining": 0, "reset_on_purchase": true }, "feet": { "limit": 3, "used": 0, "remaining": 3, "reset_on_purchase": true }, "vto": { "limit": 10, "used": 2, "remaining": 8, "reset_on_purchase": false } } } ``` These are the exact numbers the widget shows the shopper and enforces a moment later, so you can render "2 of 3 tries left" in your own UI without it ever disagreeing with ours. #### Give a shopper another go For a return, a complaint, or plain goodwill. Independent of the reset-on-purchase setting — use this when there is no purchase to report. ```bash curl -X POST https://api.dimera.app/v1/shoppers/cust-991/reset \ -H "Authorization: Bearer ak_live_R2p8Xc…" \ -H "Content-Type: application/json" \ -d '{ "capability": "measure" }' ``` capability is measure, vto, or all (the default). measure covers feet as well: a foot measurement is counted apart from a body one, against the same limit, which is why the allowance lists feet on its own line. The call is safe to repeat, and answers with the new allowance. #### Erase a shopper You are the data controller for your shoppers; when one exercises their right to erasure, this is how you carry it out for the data we process on your behalf. ```bash curl -X DELETE https://api.dimera.app/v1/shoppers/cust-991 \ -H "Authorization: Bearer ak_live_R2p8Xc…" ``` Every run of theirs is deleted along with any photo or render still held for it, and their entry in your Conversions report is anonymised — the sale stays, the person does not. Answers 404 the second time, because there is nothing left to erase. > [!NOTE] > A shopper’s network-wide saved measurement profile is not erased by this. That profile belongs to the shopper across every shop using Dimera, so only they can delete it — from inside the widget. What this removes is everything held for them at YOUR shop. > [!IMPORTANT] > All three calls need a shopper you identified to the widget. A visitor who was never given a data-shopper id exists to us only as an anonymous browser, and cannot be addressed from your backend. > [!NOTE] > URL-encode the customer id in the path — and see “Your customer id” above for the one character that cannot be used at all. ### Products (catalog) Keep your catalog in step with Dimera. One idempotent call carries the whole product — its identity, its variants, its photos and its size chart — so you can fire the same request from your own product-save hook on every create and every edit, without checking first whether we have it. #### Create or update a product A product is identified by its EAN, or by its SKU when it has no EAN. If we already have that product it is updated in place; if we do not, it is created and linked to the project your key opens. Nothing else has to be tracked on your side — there is no Dimera id to store. ```bash curl https://api.dimera.app/v1/products \ -H "Authorization: Bearer ak_live_R2p8Xc…" \ -H "Content-Type: application/json" \ -d '{ "ean": "8591234567890", "sku": "SKU-1234", "title": "Merino Crew Sweater", "category": "sweaters", "brand": "Nordwear", "description": "Midweight merino crew-neck.", "capabilities": { "measurement": true, "vto": true }, "properties": { "Size": ["S", "M", "L"], "Color": ["Black", "Navy"] }, "variants": [ { "values": { "Size": "S", "Color": "Black" }, "ean": "8591234567906" }, { "values": { "Size": "M", "Color": "Black" }, "ean": "8591234567913" }, { "values": { "Size": "M", "Color": "Navy" }, "ean": "8591234567920" } ], "images": [ { "url": "https://cdn.yourstore.com/merino/black-front.jpg", "value": "Black" }, { "url": "https://cdn.yourstore.com/merino/black-back.jpg", "value": "Black" }, { "url": "https://cdn.yourstore.com/merino/navy-front.jpg", "value": "Navy" } ], "size_chart": { "sizes": { "S": { "chest": 96, "waist": 80 }, "M": { "chest": 102, "waist": 86 }, "L": { "chest": 108, "waist": [92, 98] } } } }' ``` #### Response 201 when the product was created, 200 when it was updated — and the product comes back in the same shape you can post again, plus what only we know: our own id, whether the chart can answer, which photos actually landed, and any open problem with them. ```json { "created": true, "images": { "queued": 3, "dropped": 0, "unmatched": 0, "skipped": false }, "product": { "id": 4182, "ean": "8591234567890", "sku": "SKU-1234", "title": "Merino Crew Sweater", "brand": "Nordwear", "category": "sweaters", "description": "Midweight merino crew-neck.", "capabilities": { "measurement": true, "vto": true }, "properties": { "Size": ["S", "M", "L"], "Color": ["Black", "Navy"] }, "variants": [ { "values": { "Size": "S", "Color": "Black" }, "ean": "8591234567906", "sku": null } ], "size_chart": { "ranges": true, "sizes": { "S": { "chest": 96, "waist": 80 }, "L": { "waist": [92, 98] } } }, "size_chart_ref": null, "chart_source": "own", "library_chart_ref": null, "chart_ready": true, "images": { "pending": true, "manual": false, "slots": [] }, "issues": [], "feed": null, "created_at": "2026-09-02T09:14:00+00:00", "updated_at": "2026-09-02T09:14:00+00:00" } } ``` #### Request parameters | Field | Type | Description | | --- | --- | --- | | `ean` | string | 8–14 digits. The primary identity: a product with this EAN is updated, and a new EAN always means a new product. | | `sku` | string | Your own code. Used as the identity only when there is no EAN. Send one of the two — a product with neither could not be addressed on any later call. | | `title` | string | Display name. Required. | | `category` | string | Required when creating, optional when updating. Our key (tops, shirts, sweaters, outerwear, trousers, shorts, skirts, dresses, underwear, swimwear, sleepwear, socks, footwear, headwear, gloves, coveralls, accessories) or its label in any language we support. Decides which measurements matter and which capabilities exist at all. | | `brand / description` | string | Optional. | | `capabilities` | object | measurement and vto, each a boolean. Optional: an absent flag takes your account default on create and is left alone on update. A capability the category does not offer stays off whatever you send. | | `properties` | object | Your variant axes, as { "Size": [...], "Color": [...] }. Additive — see below. | | `variants` | array | The items you actually sell, each naming one value of every property and carrying its own barcode. Replaces the set — see below. | | `images` | array | Photos to fetch, in order. See Product images. | | `size_chart` | object | The garment measurements per size. See Size charts. | #### Variants, and why they are additive properties are the axes a product varies along. A property whose name we recognise as a size (Size, Velkosť, Größe…) becomes the axis your size chart’s rows are keyed by; one we recognise as a colour becomes the axis photos belong to. Everything else is stored as it is. Sending them again ADDS: a new size joins the existing ones, and a value already there (matched case-insensitively) is left as it is. Nothing is ever removed by this endpoint, because a value can carry photos, chart rows and a shopper’s finished try-on. Removing a colourway or a size is a deliberate act in the Dimera dashboard, where the consequences are shown. #### The items you actually sell properties say what a product CAN vary along; variants say which of those combinations exist. A shop stocking black in S–XL and red in M–L sells fewer items than the arithmetic, and each of them has its own barcode — which is the thing the axes have nowhere to put. Send one entry per item, naming one value of every property the product has: { "values": { "Size": "M", "Color": "Black" }, "ean": "…", "sku": "…" }. A barcode here is what lets the widget recognise the exact item a shopper is looking at, so data-product on a product page may be a variant barcode as well as the product’s own. Unlike properties, a variants key REPLACES the set: nothing hangs off a variant that you could not simply restate, so this is how you say a combination is no longer sold. Omit the key and the stored items are left exactly as they are. Every value you name must already exist (send it under properties in the same call), every entry must name every axis, and a barcode may only be on one item — all three are refused with a message rather than dropped quietly. A barcode another product already holds is the one exception: it is dropped, and the variants you get back are where you see that it did not stick. #### Readiness is polled, not returned Photos are fetched in the background, so images.slots is usually empty in the response and images.pending is true. chart_ready says whether a size can actually be recommended: it is true only when every size row states every measurement the chart uses. Fetch GET /v1/products/{ref} a little later to see both settle. #### Many products in one call For a nightly reconciliation rather than a save hook, POST /v1/products/batch takes up to 100 of the same product payloads under a products array. Every line is written on its own: one bad product never rolls back the good ones, and the response tells you what happened to each. ```bash curl https://api.dimera.app/v1/products/batch \ -H "Authorization: Bearer ak_live_R2p8Xc…" \ -H "Content-Type: application/json" \ -d '{ "products": [ { "ean": "8591234567890", "title": "Merino Crew", "category": "sweaters" } ] }' ``` ```json { "created": 1, "updated": 0, "failed": 1, "results": [ { "index": 0, "ean": "8591234567890", "status": "created", "images": { … } }, { "index": 1, "sku": "SKU-9", "status": "error", "error": { "code": "invalid_request", "message": "The title field is required." } } ] } ``` > [!NOTE] > The call answers 200 whenever the body itself was readable — even if every line inside failed. Check the per-line status rather than the HTTP code, and read the products back with GET /v1/products/{ref} if you need the full record. #### Reading the catalog back | Endpoint | Purpose | | --- | --- | | `GET /v1/products` | One page of the products this key’s project holds, ordered by our id. ?page= and ?per_page= (10, 25, 50, 100). Because the order is by id, it can be walked as a sync cursor while you are still writing. | | `GET /v1/products/{ref}` | One product. {ref} is an EAN, our own id, or a SKU that only one product in your account carries. | | `POST /v1/products/{ref}/detach` | Delist the product from THIS project. It stays in your catalog and in any other project. Safe to repeat: answers detached: false when it was not there. | | `DELETE /v1/products/{ref}` | Delete the product from your whole catalog — see the warning below. | > [!IMPORTANT] > DELETE is not the opposite of the upsert — it is permanent and account-wide. It removes the product from EVERY project of your account, together with its variants, its photos and its size chart, and frees its EAN for reuse. If you only want it to stop appearing in one storefront, use detach. The list wraps the page in the counts you need to walk it: ```json { "products": [ { … }, { … } ], "page": 1, "per_page": 25, "total": 812, "pages": 33 } ``` Each entry is exactly the product object above, so one loop handles both the list and a single fetch. Stop when page reaches pages — never when a page comes back short, because it cannot. #### Photo problems worth acting on issues carries whatever is currently wrong with a product’s photos, deduplicated by type — the same list the dashboard shows. Each entry is { type, severity }: | type | severity | Meaning | | --- | --- | --- | | `fetch_failed` | error | We could not download one of the urls you sent (bad url, not an image, or the host kept refusing). That slot is empty — send a working url. | | `shared_variant_image` | warning | Two colourways ended up with the same photo, so a try-on will show the wrong colour for one of them. | | `generic_main_image` | warning | The product’s only photo is one it shares with other products, so it is not a photo OF this garment. | #### Products a feed owns If a product came from an XML feed, that feed owns it: it rewrites the title, category, brand, description, SKU and EAN on every sync. So every write here — upsert, detach, delete — answers 409 product_owned_by_feed and names the feed, rather than accepting a change the next sync would silently revert. Reads work normally, and the feed field tells you which feed to edit (or to disconnect, in the dashboard, if you would rather manage the product through this API). > [!TIP] > Sync continuously from your own product hooks, and when many products change at once send them through POST /v1/products/batch — up to 100 per call. A first import of a large catalog is still simpler done once through Products → Import (CSV/Excel) or a feed. #### Turning a capability off The two capability flags are independent, so a product can be offered for size recommendation only, for try-on only, for both, or for neither. They are yours: a feed never changes them, and neither does a re-import. A product with both switched off stays in your catalog and keeps syncing, but the widget skips it. Dimera also stops reporting problems that only matter to a switched-off capability, so a product you never size will not be flagged for a missing size chart. Some categories do not offer a capability at all — there is no body measurement that would size a hat or a belt, and socks are not visible in a try-on. For those the flag is always off: sending true has no effect. The response always shows the value that was actually stored. > [!TIP] > You can change this for many products at once in the app: select them in the product list and use "Change usage". The same screen can store the choice as the default for products added later by a feed or an import. ### Feed imports Instead of pushing products one by one, you can point Dimera at the XML product feed you already generate for price-comparison sites. We fetch it on a schedule, map each product onto Dimera and keep the catalog in sync. Heureka (SHOPITEM) and Google Merchant (RSS 2.0) feeds are supported. #### Only wearable products are imported Dimera sizes and renders things worn on the body, so a feed usually mixes products we can use (garments, footwear, headwear, gloves, swimwear, sleepwear, underwear) with products we cannot (a battery for heated socks, jewelry, watches, bags, hair accessories, umbrellas). We read every entry but only import the ones whose category maps to a wearable Dimera category — everything else is skipped. > [!NOTE] > Skipping is by category. A product in an unsupported category is counted in the sync log ("X skipped — outside supported categories") but never created, so your Dimera catalog stays clean. Products already imported are kept even if their category later becomes unsupported. #### How categories are matched - Heureka — the full CATEGORY_FULLNAME path (e.g. "Oblečenie, obuv a doplnky | Dámske oblečenie | Dámske tričká a tielka") is matched against the supported apparel branches. - Google Merchant — the g:google_product_category value is matched by its numeric id (recommended, language-independent) or its full text path under "Apparel & Accessories". The merchant-defined g:product_type is not used for matching. Categories are mapped to the nearest Dimera category (for example a scarf becomes an accessory, a tracksuit set becomes a one-piece/set). Mapping is derived from the marketplace’s own published taxonomy, so sub-categories are covered automatically and both Heureka.sk and Heureka.cz resolve. When we cannot confidently place a category, the product is skipped rather than mis-labelled — protective gear that is not body-measured (helmets, pads), infant clothing and non-apparel goods are skipped. #### Which categories are supported Garments and footwear (tops, shirts, sweaters, outerwear, trousers, shorts, skirts, dresses, underwear, swimwear, sleepwear, socks, footwear), head/hand/neck wear (headwear, gloves), one-pieces/coveralls, and clothing accessories (belts, scarves, ties, sunglasses) — for adults and children alike. Infant clothing (Heureka "Dojčenské / Kojenecké oblečenie", Google "Baby & Toddler Clothing") is not imported, because a baby cannot be body-measured and no size could be recommended. Jewelry, watches, bags, wallets, luggage, hair accessories, umbrellas and non-apparel categories are not imported either. > [!NOTE] > Size charts apply only to categories with body measurements. Accessories and headwear are imported without a size chart — that is expected, not an error. Socks and footwear take a foot-length chart. ### CSV import The other way to get a catalog in without writing any code: upload a CSV or Excel file in Products → Import. Columns are mapped in the wizard, so your file can use any header names and any column order — nothing has to be renamed before uploading. #### Download a template Products → Import → Download sample template gives you a file with every column the import reads, two example rows, and one extra column per product attribute you have defined — pre-filled with that attribute’s own values. Start from it and the mapping step will already be correct. #### Columns | Column | Required | Notes | | --- | --- | --- | | `Name` | yes | The product name. | | `SKU` | no | Your own code. Used to match an existing product when the row has no EAN. | | `EAN` | no | 8–14 digits, unique per account. When present it is the identity: a row with a new EAN always creates a new product. | | `Brand` | no | Manufacturer. A blank cell never clears an existing value. | | `Category` | no | The stored key or its label in any language. An unrecognised value skips the row rather than guessing; a blank cell falls back to the default category. | | `Description` | no | A blank cell never clears an existing value. | | `Sizes / Colors` | no | Comma-separated values, each becoming a product property. Map any column to the "Property" role to create your own axis — the column header becomes the property name. | | `Image (URL)` | no | A public http(s) URL to the main photo. Fetched in the background after the import; only for newly created products. | | `Measurement / Try-on` | no | Yes/No. A blank cell keeps the account default rather than switching a capability off. | | `Attribute columns` | no | One per attribute you want to tag — see below. | #### Attribute columns Attributes are the categorization fields you define yourself (Products → a project’s Attributes tab, or the Attributes section). To tag products during an import, map a column to the "Attribute" role and pick which attribute it targets — a column mapped to that role without a target blocks the import rather than importing as a silent no-op. - Values are MATCHED against the attribute’s existing values, case-insensitively. They are never created — a typo cannot mint a permanent new option. - A cell may carry SEVERAL values, comma-separated ("Winter, Autumn"): a product can hold more than one value of the same attribute. The whole cell is tried first, so a value that itself contains a comma still matches. - A cell whose value is not one of the attribute’s values leaves the product untagged for that attribute, is counted in the import summary and is flagged amber in the mapping preview. - A blank cell says nothing about that attribute — with "Update existing products" on, it never clears a tag the product already has. - An attribute that belongs to a project only applies when the import actually links the products to that project. > [!NOTE] > Two columns may target the same attribute — each contributes its own value. That is the alternative to comma-separating them in one cell. #### Matching and updates Rows are matched to existing products by EAN first, then by SKU; anything unmatched is created. "Update existing products" is off by default, so a re-upload only adds what is new. With it on, a matched product’s mapped fields are refreshed from the file — but only the fields the file actually provides, so a blank cell never wipes a value. > [!IMPORTANT] > A header row is required, and the first row is always treated as one. A file without headers would lose its first product. ### Size charts The size chart is how Dimera turns a shopper’s body measurements into a recommended size. A product can carry its OWN chart, sent inside the product; or — for a catalogue of thousands — it can be measured by a SHARED chart from your size-chart library, sent once and applied to every product it fits. #### Structure size_chart.sizes maps each SIZE to the measurements it states. Every key on the left must be a value of the product’s size property, so send properties in the same call (or in an earlier one) — a size we do not know is refused rather than quietly dropped. ```json "properties": { "Size": ["S", "M", "L"] }, "size_chart": { "sizes": { "S": { "chest": 96, "waist": 80 }, "M": { "chest": 102, "waist": 86 }, "L": { "chest": 108, "waist": 92 } } } ``` #### Values are centimetres, or a range A cell is either a single number — the garment’s own measurement — or a [min, max] pair, which is how a brand states “this size fits a chest of 94–101”. Mixing the two in one chart is fine, and the response’s size_chart.ranges tells you whether any pair was stored. You never send that flag: a pair IS the statement, so nothing can contradict the cells. ```json "sizes": { "M": { "chest": [94, 101], "waist": [78, 84] }, "L": { "chest": [102, 109], "waist": [85, 91] } } ``` #### Measurement keys chest · waist · hip · inseam · thigh · shoulder_width · arm_length · sleeve_length · neck · height · foot_length · foot_width · palm_length · palm_circumference. Send the key, or its label in any language we support — an unrecognised one is refused with the valid list, because a silently ignored column is a chart that looks complete and cannot answer. Use the ones that matter for the category: chest/waist/shoulder_width for a top, waist/hip/inseam for trousers, foot_length (and foot_width where the fit depends on it) for footwear and socks. #### Replacing a chart A size_chart in the payload REPLACES the whole chart. Omit the key entirely and the stored chart is left exactly as it is — which is what lets you send a price or title update without resending the chart every time. > [!NOTE] > chart_ready in the response is the field to watch: it is true only when every size row states every measurement the chart uses. A product with no chart at all is still ingested and can be tried on — it simply recommends no size. > [!NOTE] > A product with no size property gets a ONE-SIZE chart: send a single row under any label you like ({ "sizes": { "One size": { "chest": 96 } } }). #### Shared charts — the size-chart library A brand publishes one chart per cut, so ten thousand products rarely need more than a few dozen charts. Send each once to PUT /v1/size-charts/{ref} — ref is your own identifier for it — and let its rules attach it to the right products, or assign it explicitly with size_chart_ref on the product. The library belongs to your account, so every project’s key sees — and can change — the same charts. ```bash curl -X PUT https://api.dimera.app/v1/size-charts/nike-men-tops \ -H "Authorization: Bearer ak_live_..." \ -H "Content-Type: application/json" \ -d '{ "title": "Nike – men’s tops", "sizes": { "S": { "chest": [88, 95], "waist": [73, 80] }, "M": { "chest": [96, 103], "waist": [81, 88] }, "L": { "chest": [104, 111], "waist": [89, 96] } }, "rules": [ { "brands": ["Nike"], "categories": ["tops"], "attributes": { "Gender": ["Men"] } } ] }' ``` The sizes speak the same dialect as a product’s own chart, but they are matched to each product’s sizes by LABEL (ignoring upper/lower case), so one chart serves every product that sells an “M”. A product size the chart has no row for keeps that product not chart_ready until it does. #### Rules A rule may state brands, categories, attributes (by attribute name and value, as you see them in the dashboard), title_contains and sku_prefix. Every condition a rule states must hold; within one condition any listed value will do. A chart applies when any of its rules matches. A rule with no condition is refused — assign the chart explicitly instead. #### Which chart measures a product | # | Wins when | | --- | --- | | `1` | The product has its OWN size_chart — always, whatever the library says. | | `2` | The product names a library chart with size_chart_ref. | | `3` | The first library chart, by priority, one of whose rules matches the product. | ```json { "ean": "8591234567890", "title": "Tee", "size_chart_ref": "nike-men-tops" } ``` size_chart_ref: null clears an assignment so the rules decide again; leaving the key out leaves it alone. The product’s response reports chart_source (own, assigned, rule or null) and library_chart_ref, the library chart in force. | Endpoint | Does | | --- | --- | | `GET /v1/size-charts` | The library, in priority order — at most 500 charts, with has_more: true when there are more. | | `GET /v1/size-charts/{ref}` | One chart, in the dialect PUT accepts. | | `PUT /v1/size-charts/{ref}` | Create (201) or update (200). title is required on every call, an update included; sizes and rules, when sent, replace that part. | | `DELETE /v1/size-charts/{ref}` | Delete it; its products fall back to their own chart, another rule, or none. | ### Product images Photos are what a virtual try-on renders from. They travel inside the product too, as urls we fetch ourselves. #### By url, in order Each entry needs a publicly reachable url. value binds the photo to a colourway — a value of the property we recognised as the colour axis — and an entry with no value is a general product photo. Both can appear on one product. ```json "images": [ { "url": "https://cdn.yourstore.com/merino/black-front.jpg", "value": "Black" }, { "url": "https://cdn.yourstore.com/merino/black-back.jpg", "value": "Black" }, { "url": "https://cdn.yourstore.com/merino/flat.jpg" } ] ``` #### Two photos per slot, and the ORDER is the slot Each colourway (and the general slot) holds up to two photos — a front and a back is what a render can use, and a third adds cost without adding information. Anything beyond that is reported in images.dropped rather than refused. Position matters: your first url for a colourway is that slot’s first photo, your second is its second. That is also what makes repeating the call safe — we fill the positions that are still empty and never replace a photo that is already there. So adding a second photo later works, while changing an existing one does not: delete it in the dashboard, or send it under a new colourway. #### What the response tells you | Field | Type | Description | | --- | --- | --- | | `images.queued` | number | How many fetches we started. | | `images.dropped` | number | Urls past the two-per-slot limit, ignored. | | `images.unmatched` | number | Urls whose value names no colourway of the product — send that value under properties first. | | `images.skipped` | boolean | Nothing was fetched: either a batch is still in flight, or somebody has edited this product’s photos in the dashboard (product.images.manual), after which they own them. | | `product.images.pending` | boolean | A fetch is still running — a missing photo is not yet a failure. | | `product.images.slots` | array | What actually landed, per slot: { value, urls }. | | `product.issues` | array | Open problems: a fetch that failed, or one photo reused across colourways (which makes a try-on show the wrong colour). | | Requirement | Value | | --- | --- | | `Formats` | JPG, PNG, WebP, AVIF or HEIC. | | `Max size` | 5 MB per image. | | `Recommended` | At least 1000px on the shortest side, product on a clean background. | | `Reachability` | Public http/https. We never fetch a private or internal address. | > [!IMPORTANT] > Fetching is asynchronous, so the upsert’s response almost never shows the photos yet. Poll GET /v1/products/{ref} and read images.pending and issues rather than assuming a queued fetch succeeded. > [!TIP] > No public url? Upload the photos in the dashboard instead (Products → the product → Photos). That marks the product’s photos as manually managed, and this API then stops filling its empty slots — which is deliberate, so a photo somebody deleted on purpose is not fetched back. ### Measurements Measure a shopper from your own backend, with no widget on the page: you send the photographs, we answer with measurements and — when you name a product — a size. Two kinds: a BODY from a front and a side photograph, or FEET from one photograph against a sheet of paper. This is the headless path; if the widget is on your storefront you do not need it. #### Create a measurement Two views are needed, front and side: the engine reads depth from the pair, so one photograph cannot be measured. Send them as multipart form data, or as urls we fetch ourselves. ```bash curl https://api.dimera.app/v1/measurements \ -H "Authorization: Bearer ak_live_R2p8Xc…" \ -F "shopper=cust-991" \ -F "consent=true" \ -F "height_cm=178" \ -F "product=8591234567890" \ -F "front_image=@front.jpg" \ -F "side_image=@side.jpg" ``` Or entirely in JSON, with the photographs hosted on your side: ```bash curl https://api.dimera.app/v1/measurements \ -H "Authorization: Bearer ak_live_R2p8Xc…" \ -H "Content-Type: application/json" \ -d '{ "shopper": "cust-991", "consent": true, "height_cm": 178, "product": "8591234567890", "front_image_url": "https://cdn.yourstore.com/tmp/front.jpg", "side_image_url": "https://cdn.yourstore.com/tmp/side.jpg" }' ``` #### Measure feet instead Send kind=feet and ONE photograph. There is no height on this path: the sheet of paper in the picture is the scale, which is what makes a self-taken photo accurate. paper_size is optional — without it we use the reference sheet configured on the project. ```bash curl https://api.dimera.app/v1/measurements \ -H "Authorization: Bearer ak_live_R2p8Xc…" \ -F "shopper=cust-991" \ -F "consent=true" \ -F "kind=feet" \ -F "paper_size=eu-a4" \ -F "product=8591234567890" \ -F "feet_image=@feet.jpg" ``` The photograph is shot straight down: both bare feet with their heels against a wall, and the sheet lying between them with its short edge against the same wall. All four corners of the sheet have to be in frame — it is what the measurement is scaled against. It answers foot_length and foot_width in centimetres, and a footwear or socks size chart is matched on them the same way a garment chart is matched on a body. #### It answers 202, and you poll Measuring takes seconds under load and longer when the engine is busy, so the call returns as soon as the run is accepted. Nothing is held open — a connection waiting that long is cut by proxies between us anyway. ```json { "id": "9f2c0f7a-1e4b-4c9a-8a3f-2b6d4e8c1a55", "status": "processing", "created_at": "2026-09-02T10:22:04+00:00" } ``` ```bash curl https://api.dimera.app/v1/measurements/9f2c0f7a-1e4b-4c9a-8a3f-2b6d4e8c1a55 \ -H "Authorization: Bearer ak_live_R2p8Xc…" ``` ```json { "id": "9f2c0f7a-1e4b-4c9a-8a3f-2b6d4e8c1a55", "status": "completed", "kind": "body", "measurements": { "chest": 98.4, "waist": 84.1, "hip": 100.2, "inseam": 81.0, "shoulder_width": 45.3 }, "notices": [], "recommended_size": "M", "chart_status": "matched", "product": "8591234567890", "created_at": "2026-09-02T10:22:04+00:00" } ``` Every measurement is in centimetres and in our own vocabulary — the same keys a size chart is built from, so you can compare them yourself. #### Notices — the measurement worked, but notices carries stable codes describing what was in the photograph that makes the numbers less trustworthy than they could be. It is not a failure: the run completed and the size stands. Show them to your shopper in your own wording, or use them to ask for a better photograph. Empty for a clean picture, and for a body measurement, which produces none today. | Code | Meaning | | --- | --- | | `foot_covered` | The feet were not bare. A sock or a shoe measures longer than the foot inside it. | | `one_foot` | Only one foot was in the picture, so both numbers come from that one. | | `foot_far` | The feet were some way from the sheet; accuracy degrades with distance. | | `multiple_sheets` | More than one sheet of paper was in frame. We measured against the one beside the feet. | | `other_feet` | More than one pair of feet was in frame. We measured the two closest to the sheet. | | `blurry` | The photograph is soft. A sharper one measures more accurately. | #### Request parameters | Field | Type | Description | | --- | --- | --- | | `shopper` | string | Required. Your own customer id — see “Your customer id” under Shopper allowances. It is what a later erasure and a reported purchase address this person by. | | `consent` | boolean | Required, must be true. Your assertion that you hold this shopper’s consent to process their photographs — see below. | | `kind` | enum | body · feet. Optional, defaults to body. It decides which photographs the request carries and whether a height is needed. | | `height_cm` | number | Required for a BODY, 100–250. The only scale those photographs are measured against, so a wrong height does not give a worse body, it gives the wrong one. Feet need none. | | `front_image / side_image` | file | BODY only, both required, as multipart form data. JPEG, PNG, WebP, HEIC, HEIF or AVIF, up to 12 MB each. | | `front_image_url / side_image_url` | string | The url form of the same two views. Must be publicly reachable http/https; we never fetch a private address. A fetched photograph may be up to 5 MB. | | `feet_image / feet_image_url` | file / string | FEET only, required. One photograph of both feet beside the reference sheet, shot straight down. Same formats and size limits as the body photographs. | | `paper_size` | enum | FEET only. eu-a4 · us-letter. Optional — without it we use the reference sheet configured on the project. | | `product` | string | Optional. An EAN, a Dimera product id, or a unique SKU. What unlocks recommended_size — without it we can measure the body but have no chart to compare it against. | | `chart` | enum | BODY only. female · male · unisex. Optional; refines the body model. | #### Why there is no size recommended_size is null in three different situations, and chart_status says which: | chart_status | Meaning | | --- | --- | | `matched` | A size was recommended. | | `no_product` | You sent no product, so there was no chart to compare against. | | `no_chart` | The product could not be resolved, its size chart is incomplete, or size recommendation is switched off for it. | | `no_match` | The chart was read and this body is outside all of it. We say so rather than handing back the largest size. | #### When it fails ```json { "id": "9f2c0f7a…", "status": "failed", "error": { "code": "not_full_body", "view": "side" }, "created_at": "2026-09-02T10:22:04+00:00" } ``` A failure is a normal outcome, not an error on your side: the request was fine, the photographs were not. view names the photograph the refusal is about when there is one, so you can ask for that one again. Common codes: not_full_body, unreadable_photos, height_missing, engine_unavailable. A failed run costs you nothing — the credits are refunded. > [!IMPORTANT] > On this path YOU are the data controller and we show nobody a consent screen. Before you send a photograph, you must have told the shopper what happens to it and obtained their consent; consent: true is your assertion that you did. The widget carries our own consent step, which is one reason to prefer it. > [!NOTE] > Body and feet can both be measured headlessly. Hand measurement (glove sizing) is coming soon and is refused until it ships. The project’s own measurement policy still decides — a project that does not collect feet refuses them here too. A run costs the same credit as a widget measurement, and per-shopper attempt limits do NOT apply here — they exist to stop a browser spending your credits, and this call is you spending them deliberately. ### Virtual try-on Render a product on a shopper from your own backend. Same shape as a headless measurement: you send the photograph, poll for the result, and fetch the image. #### Create a try-on ```bash curl https://api.dimera.app/v1/tryon \ -H "Authorization: Bearer ak_live_R2p8Xc…" \ -F "shopper=cust-991" \ -F "consent=true" \ -F "product=8591234567890" \ -F "colour=Navy" \ -F "person_image=@shopper.jpg" ``` product is a reference into your Dimera catalog and the garment’s photos are taken from there — which is the reason to push your products first. It also answers what kind of item it is, which the renderer needs in order to know where on the body it is worn. If the garment is not in Dimera, send product_image_urls instead (up to two: front and back) — and then product_category as well, because nothing else can tell us that. It is required whenever product is absent, and a product we cannot resolve without one is refused at once with 422 vto_no_category — no run is created and nothing is charged — rather than rendered from a guess. A product we hold whose try-on is switched off, or which is not published, is refused the same way with vto_product_unavailable. ```json { "shopper": "cust-991", "consent": true, "person_image_url": "https://cdn.yourstore.com/tmp/shopper.jpg", "product_category": "outerwear", "product_image_urls": [ "https://cdn.yourstore.com/merino/front.jpg", "https://cdn.yourstore.com/merino/back.jpg" ] } ``` #### Poll, then fetch the image ```json { "id": "3b7d0a91-5c2e-4f18-9d64-7a1e0c3b5d22", "status": "completed", "render": true, "product": "8591234567890", "colour": "Navy", "created_at": "2026-09-02T10:24:11+00:00" } ``` ```bash curl https://api.dimera.app/v1/tryon/3b7d0a91-5c2e-4f18-9d64-7a1e0c3b5d22/image \ -H "Authorization: Bearer ak_live_R2p8Xc…" \ -o render.jpg ``` The image is served by that endpoint with the same key, and there is deliberately no url in the poll: a url would be a second credential to keep and to expire. render says whether the image is still there. #### Request parameters | Field | Type | Description | | --- | --- | --- | | `shopper` | string | Required. Your own customer id — see “Your customer id” under Shopper allowances. | | `consent` | boolean | Required, must be true. See the warning below — it matters more here. | | `person_image / person_image_url` | file / string | The photograph of the person. One of the two is required. A file may be JPEG, PNG, WebP, HEIC, HEIF or AVIF, up to 12 MB; a fetched url up to 5 MB. | | `product` | string | An EAN, a Dimera product id, or a unique SKU; its stored photos are used. Required unless you send product_image_urls. | | `colour` | string | Which colourway of that product to render. Optional. | | `product_image_urls` | array | Up to two publicly reachable urls of the garment, for a product that is not in your Dimera catalog. | | `product_category` | enum | What kind of item it is: tops · shirts · sweaters · outerwear · trousers · shorts · skirts · dresses · underwear · swimwear · sleepwear · footwear · headwear · gloves · coveralls · accessories. Required unless you send a product we hold, whose own category then wins. It is what tells the renderer where on the body the item is worn. | #### What it costs A try-on costs four credits from one product photo and five from two — decided when the run is accepted, from what is actually available, and never changed afterwards. Two photos are worth it for anything whose back matters (a cap, a shoe, a glove); for a garment worn on the torso one is usually enough. #### When it fails error.code is no_product_photo (we could not obtain a usable photo of the garment — the reference resolved to nothing, or the urls were unreachable), render_refused (the renderer would not produce this image), unreadable_photos, or engine_unavailable. A failed run is refunded. > [!IMPORTANT] > A try-on sends the shopper’s photograph to our AI rendering partner, outside Dimera’s own infrastructure. Our widget says so on its consent screen; on this path you have to make the equivalent disclosure yourself, and consent: true is your assertion that you did. > [!NOTE] > Fetch the image and store it if you need to keep it: a render is deleted with the shopper’s photographs when their retention window passes, and the endpoint then answers 404. Do not hotlink it into a page — it is a picture of a person, served with no-store and behind your secret key. ### Exports Pull what has happened into your own systems. Two read-only endpoints, both paged and both ordered so you can walk them as a cursor without a row being shown twice or skipped. #### Runs Every measurement and try-on of your project, whether it came from the widget or from this API. This is the same record you see under Logs in the dashboard: what was run, for which product, what size came out, and why it failed if it did. source is widget, api, invite (a measurement invitation e-mail) or profile (a shopper’s saved measurement reused here instead of measuring again). recommended_size and notices appear only on measure runs that did not fail; error, with its code and the photograph it is about, only on a failed run. ```bash curl "https://api.dimera.app/v1/runs?type=measure&status=completed&from=2026-09-01&per_page=100" \ -H "Authorization: Bearer ak_live_R2p8Xc…" ``` ```json { "runs": [ { "id": "9f1c…", "type": "measure", "kind": "body", "source": "widget", "status": "completed", "shopper": "shp_…", "product": "8591234567890", "recommended_size": "M", "notices": [], "created_at": "2026-09-14T08:21:04+00:00", "finished_at": "2026-09-14T08:21:19+00:00", "duration_ms": 15120 } ], "page": 1, "per_page": 100, "total": 248, "pages": 3 } ``` > [!IMPORTANT] > A run carries the size it produced, never the shopper’s measurements. Those belong to the shopper’s own session — a list is the last place to hand them out. If you need the numbers, run the measurement through POST /v1/measurements, where you hold the shopper’s consent yourself. #### Filters | Parameter | Accepts | | --- | --- | | `type` | measure \| tryon | | `source` | widget \| api — invite and profile runs are listed, but cannot be filtered on | | `status` | processing \| completed \| failed | | `shopper` | your own customer id, the same one you pass as data-shopper | | `from / to` | ISO-8601 date or timestamp, inclusive at both ends, on when the run started | | `page / per_page` | per_page is 25, 50, 100 or 250 — anything else falls back to 50 | A filter value we do not recognise is ignored rather than refused, so a typo widens the result instead of stopping your sync. A shopper id that matches nobody returns nothing. #### Conversions Your Conversions report as rows: what we recommended, what was bought, and whether the two matched. It is not only purchases — type is purchase, cart (added to the cart from our overlay) or measured, and a measured row exists for every completed measurement, which is what makes "measured, did not buy" answerable. Filter on type if you are summing revenue. ```bash curl "https://api.dimera.app/v1/conversions?type=purchase&from=2026-09-01" \ -H "Authorization: Bearer ak_live_R2p8Xc…" ``` ```json { "conversions": [ { "type": "purchase", "order_ref": "ORD-2041", "product": { "ref": "8591234567890", "title": "Merino Crew Sweater" }, "recommended_size": "M", "chosen_size": "M", "followed": true, "confidence": 92, "value": 39.9, "currency": "EUR", "via_measurement": true, "via_vto": false, "run": "9f1c…", "shopper": "shp_…", "occurred_at": "2026-09-14T09:02:00+00:00" } ], "page": 1, "per_page": 50, "total": 12, "pages": 1 } ``` > [!TIP] > Both endpoints page by our own internal order rather than by date, so a page you walk while new runs are being created cannot show a row twice or miss one. Keep the last page you read, not the last timestamp. ### Errors & rate limits The API uses conventional HTTP status codes and returns a machine-readable error object on failure. #### Status codes | Code | Meaning | | --- | --- | | `200 / 201` | Success. | | `400` | Malformed request, a missing parameter, or a value we cannot apply. | | `401` | Missing or invalid API key. | | `403` | The key is valid, but the Dimera account is suspended (account_inactive). | | `402` | The account has no credits left. Nothing is wrong with the request. | | `404` | Resource not found — or not one this key may address. | | `405` | The endpoint exists, but not for that HTTP method. | | `409` | The request is fine, the resource’s state does not accept it (an archived project, a product a feed owns). | | `422` | The request cannot be carried out as things are set up: the project does not offer what was asked, the product cannot be tried on, or a try-on names a product we do not hold and sends no product_category. | | `429` | Rate limit exceeded. | | `5xx` | Something went wrong on our side. | #### Error object Every error under /v1 carries the same envelope, whatever your Accept header says — a rate limit, a path that does not exist, a wrong method and a failure on our side included. Branch on code; message is English prose for whoever reads your logs. ```json { "error": { "code": "product_owned_by_feed", "message": "This product is managed by the product feed \"Main feed\", which rewrites its fields on every sync." } } ``` #### Codes worth handling | Code | What to do | | --- | --- | | `invalid_request` | Fix the payload. The message names the field and, where there is a fixed set, the valid values. | | `missing_key · invalid_key` | Check the Authorization header and the project the key belongs to. | | `account_inactive` | The Dimera account is suspended; nothing will succeed until it is not. | | `out_of_credits` | Stop retrying and tell somebody: only the account owner can fix it. | | `project_archived` | The project is read-only. Unarchive it in the dashboard. | | `product_owned_by_feed` | Change the product in the feed, or disconnect the feed to take it over. | | `product_not_found · shopper_not_found` | The reference names nothing this key can address — see how a reference is resolved. | | `measurement_not_found · tryon_not_found` | That run is not one this key created. Only runs started through this API can be polled here. | | `product_not_written` | Only inside a batch: that one product could not be written for a reason on our side. Nothing about it changed, so send the line again. | | `run_not_found` | A conversion line named a run that is not this shopper’s finished run of this project. Fix the id or leave it out — nothing was recorded, and the call is safe to retry. | | `kind_unavailable · vto_unavailable` | The project does not collect the kind of measurement you asked for (body or feet) / does not offer try-on. Change it in the project’s settings. | | `vto_product_unavailable` | We hold that product and it cannot be tried on: its try-on is switched off, or it is not published. Both are on the product in Dimera. Some categories — socks, for one — never offer a try-on at all. | | `vto_no_category` | A try-on named a product we do not hold and sent no product_category, so nothing says what kind of item it is. Upsert the product first, or send product_category. No run was created. | | `render_unavailable` | The try-on has no image: it has not finished, it failed, or the render’s retention window has passed. | | `photo_unreadable` | The file is not a photograph we can read. JPEG, PNG, WebP, HEIC, HEIF or AVIF. | | `photo_fetch_failed` | We could not download the image. Retry, or send the file as multipart form data. | | `rate_limited` | Too many requests. Wait the number of seconds in the Retry-After header, then retry. | | `not_found · method_not_allowed` | The path does not exist under /v1, or does not accept that HTTP method. Check the URL and the method against this reference. | | `server_error` | Something failed on our side. Retry with a backoff; the message deliberately says nothing more. | | `unavailable · payload_too_large` | 503: planned maintenance — retry after the seconds in Retry-After. 413: the request body is too large; send fewer products per batch or smaller photos. | > [!NOTE] > A finished run that FAILED is not an error response: it answers 200 with status: "failed" and its own code, because the request succeeded and the outcome did not. Those codes are listed with the measurement and try-on endpoints. #### Rate limits The limit is 60 requests per minute per project — counted per project rather than per IP, so one server making every call for a storefront is not sharing a bucket with anybody. Beneath it sits a floor of 300 requests per minute per IP address, applied before the key is even checked. Either one answers 429 rate_limited with a Retry-After header saying how many seconds to wait. POST /v1/products/batch carries up to 100 products per call, so a sync can move up to 6,000 products a minute; for a first import of a large catalog a feed or Products → Import is still the simpler route. Need a higher limit? Contact us. ## Platforms ### Shopify Add Dimera to a Shopify store without touching code, using the theme editor. #### Steps - From your Dimera dashboard, copy the widget snippet for your project. - In Shopify admin, go to Online Store → Themes → Edit code. - Open theme.liquid and paste the snippet just before . - For product-page-only loading, paste it into sections/main-product.liquid instead. - Save and preview a product page — the trigger appears where you targeted it. > [!TIP] > Use data-trigger="selector" with data-target=".product-form__buttons" to place the button right under Add to cart in most Shopify themes. ### WooCommerce Add Dimera to a WooCommerce / WordPress store. #### Steps - Copy the widget snippet from your Dimera dashboard. - Install a header-and-footer script plugin, or edit your theme’s footer.php. - Paste the snippet into the footer so it loads on product pages. - To scope it to products only, wrap it in an is_product() conditional in footer.php. ```php ``` ### Custom / headless For headless storefronts and custom front-ends, load the widget script yourself or drive the flow with the REST API. #### Loading the script manually ```js const s = document.createElement('script'); s.src = 'https://dimera.app/widget/widget.js'; s.dataset.project = 'nordwear-uniforms'; s.dataset.key = 'pk_live_7Kd92JfQ0aB3nR8xLmZs'; s.dataset.mode = 'combined'; s.async = true; document.body.appendChild(s); ``` Once loaded, control it with the window.Dimera JS API (see Events & JS API). For a fully custom UI with no widget at all, push your catalog with POST /v1/products and run the flow yourself with POST /v1/measurements and POST /v1/tryon — on that path your own front-end collects the photographs and your own backend holds the consent. ## Resources ### Data & privacy Dimera is privacy-first by design. This is the short version — the full detail is in our Privacy Policy. - Face blur for body-measurement photos happens on the device — the shop either enforces it or leaves the choice to the shopper. A virtual try-on is never blurred, and that is not configurable. - Photos are deleted automatically right after processing. - Only derived measurements (not images) are retained, and only as long as needed. - All processing and storage is hosted in the EU under the GDPR. - Shopper photos are never used for model training without explicit, separate consent. > [!NOTE] > When you embed the widget, you are the data controller for your shoppers’ data and Dimera acts as your processor under a data-processing agreement. ### Changelog Notable changes to the widget and API. Dates are in UTC. #### v2.6 · September 2026 - Catalog API: one idempotent POST /v1/products carrying variants, photos and the size chart, plus GET, detach and delete. Identified by EAN or SKU — the external_id field is gone. - Headless measurement and try-on: POST /v1/measurements and POST /v1/tryon run the whole flow from your backend, no widget needed. Both answer 202 and are polled. - Webhooks are not offered. Async results are polled, product readiness is read from the product, and a low credit balance is emailed to the account owner. #### v2.5 · August 2026 - Report a purchase (POST /v1/conversions) — the conversion signal and the per-shopper allowance reset in one call. - Shopper endpoints: read an allowance, hand one back, and carry out a GDPR erasure. #### v2.4 · July 2026 - Combined widget mode can now render as two separate triggers (data-layout="separate"). - Add to cart at the end of a try-on, over the dimera:cart event (data-cart="true"). #### v2.3 · May 2026 - Virtual try-on API out of beta. - Configurable trigger shape, size and icon via data- attributes. #### v2.2 · March 2026 - On-device face blur enabled by default. - Added Retry-After header on 429 responses.