# Revieve Developer Docs — full text This file is the entire site, concatenated. It is generated; do not edit. --- ## Revieve Developer Docs Source: src/content/docs/index.mdx > Computer-vision API for beauty brands and retailers: skin analysis, makeup and hair from one selfie. import { CardGrid, LinkCard } from "@astrojs/starlight/components"; import BuildGrid from "../../components/BuildGrid.astro"; ## Use cases Every picture is real API output, unless it is marked as an illustration. ## Start here ## Looking for virtual try-on? For real-time, webcam-based makeup, hair-colour, or full-look try-on in the browser, use **Revieve Virtual Try-On** — a separate product with its own multi-hundred-point face tracking, optimised for live video on mobile and desktop, with on-device frame processing. --- ## Introduction Source: src/content/docs/introduction.mdx > What Revieve provides, how the two APIs fit together, and who they are intended for. Includes when to use the Virtual Try-On product instead. import { Aside } from "@astrojs/starlight/components"; Revieve is a beauty-tech platform whose core capability is turning user images into structured, actionable data about skin, hair, and makeup — and then mapping that data onto your product catalog. This site documents the two APIs that surface that capability: - **Skin Analysis API** — a server-side computer-vision endpoint that accepts a JPEG and returns per-metric scores, regional measurements, masks, categorical findings, and image-quality warning/error codes. - **Product Recommendations API** — a catalog-aware service that consumes analysis output (and optionally explicit user preferences) and returns ranked product picks for your catalog taxonomy. ## Who this is for The docs assume you are one of: - An **engineer** integrating Revieve into a brand or retailer's web or mobile app. - An **internal team** building Revieve-powered consumer experiences (concierge, regimen builders, in-store kiosks). - An **AI coding agent** acting on behalf of one of the above. (See the [AI agents page](/ai-agents/) for a structured ingestion route.) ## What good looks like A clean integration usually has three layers: 1. **Capture** — a camera/upload UI that produces a face-forward JPEG of at least 600×600 pixels. 2. **Analyze** — a single `POST` to the Skin Analysis API with the components your experience needs. 3. **Apply** — render results back to the user (visualization overlays, shade picks, product cards), optionally piped into Product Recommendations. The [Your first skin analysis](/guides/your-first-skin-analysis/) walk-through covers this end-to-end in about ten minutes. ## What's *not* documented here - **Onboarding and Partner ID provisioning.** Reach out to your Revieve account contact. The test ID `jmlv6b2qtS` works against `partner-test.revieve.com` for evaluation. - **Revieve Virtual Try-On** — the real-time webcam-based try-on product. See the [VTO overview](/products/virtual-try-on/) and the [product page on revieve.com](https://www.revieve.com/platform/makeup/makeup-virtual-try-on); integration is sales-led. - **The hosted concierge front-ends** (AI Skincare, Makeup, Haircare Advisors; AI Hair Color Artist) — products built *on top of* the APIs and the VTO engine. ## Where images are processed The Skin Analysis API is **server-side**: images sent to it are uploaded to Revieve for analysis, and the results are returned in the response. For real-time experiences (lipstick, eyeshadow, hair-colour try-on), use **Revieve VTO**. It runs in the browser on the user's own device, because face tracking at video frame rate isn't feasible over a network hop. The webcam video is not sent to Revieve during try-on. Compliance and data-handling specifics for your deployment are governed by your Revieve agreement. ## Versioning posture The Skin Analysis API uses a single base path and identifies itself by spec version (currently `3.x`). Changes are additive: new components, fields and status codes are added, and existing fields keep their shape and meaning. Each release is listed in the [Changelog](/changelog/). --- ## APIs at a glance Source: src/content/docs/apis-overview.mdx > Side-by-side summary of the Skin Analysis and Product Recommendations APIs — what each accepts, what each returns, and when to call which. import { Tabs, TabItem } from "@astrojs/starlight/components"; import { Aside } from "@astrojs/starlight/components"; ## Two products, briefly This site documents the **Skin Analysis** and **Product Recommendations** APIs — both server-side, image- or data-in / JSON-out. For real-time webcam-based virtual try-on, use **[Revieve VTO](/products/virtual-try-on/)** — a separate browser-side product with its own face tracking. The split: | You want… | Use | | ---------------------------------------------------------- | -------------------------------- | | Per-metric skin analysis (wrinkles, redness, age, …) | Skin Analysis API (this site) | | Catalog-aware product recommendations | Product Recommendations API | | Real-time makeup try-on (lipstick, eyeshadow, full looks) | **Revieve VTO** | | Hair-colour try-on | **Revieve VTO** / AI Hair Color Artist | ## Skin Analysis API A single `POST /analyzeImage/` endpoint that accepts a multipart-encoded JPEG and a small set of query parameters. Returns a JSON document containing: - **`results`** — per-component findings (score, regional measurements, masks). Each finding also has its own `message` and `local_warnings` for problems that affect only that metric. - **`face_area`** — bounding box and face rotation. - **`status`** — global warning and error codes, expected to affect all or most metrics (see [Status codes](/concepts/status-codes/)). - **`message`** — a one-word summary of `status`: `OK` (no codes), `Warning` (only warnings; the analysis ran) or `Error` (at least one error; the analysis could not run). - **`inverse_color_balance_rb`** — inverse white-balance factors `[invR, invB, luminance]` for re-applying the image's colour cast to measured colours (see [Interpreting results](/guides/interpreting-results/#inverse_color_balance_rb)). You ask for what you need via the `components` query parameter. Common picks: | Use case | Components | | ----------------------- | -------------------------------------------------------------------------- | | Skin assessment | `wrinkles, redness, hyperpigmentation, acne, pore_dilation, skin_age` | | Foundation shade match | `makeup` | | Hair attribute readout | `hair` | See the full reference at [`POST /analyzeImage/`](/api/skin-analysis/operations/analyzeimage/). ## Product Recommendations API Catalog-aware ranked recommendations. You provide your catalog taxonomy and optionally pass through analysis output and user preferences. See the reference at [/api/product-recommendations/](/api/product-recommendations/). ## When to call which Capture image → Skin Analysis → render results → Product Recommendations using analysis output as input. This is the "expert consultation" pattern. Use **[Revieve VTO](/products/virtual-try-on/)**. Real-time try-on is not built on the Skin Analysis API. Capture image → Skin Analysis with `makeup` → read `Skin foundation RGB`, `Skin undertone`, `Skin Fitzpatrick type` from `sum_measures[]` → query Product Recommendations filtered by foundation taxonomy. No image. Send only user preferences and inventory filters to Product Recommendations. Lighter integration, lower personalisation ceiling. ## Hosting and environments | Environment | Base URL | When to use | | ------------- | ----------------------------------------------------- | --------------------------------------------- | | Test | `https://partner-test.revieve.com/api/3/` | Evaluation, integration, QA. | | Production | `https://partner.revieve.com/api/3/` | Your live traffic. | When your contract specifies a region, Revieve gives you a regional production host instead, with the same `/api/3/` path. The test environment receives new CV versions before production, so a component documented here can reach test first; the [changelog](/changelog/) says which version each environment runs. The Partner ID `jmlv6b2qtS` is a shared demo ID for use with the test environment. It is for evaluation and testing only, and Revieve may replace it at any time; if it stops working, find the current one here in the docs or ask the Revieve team. Revieve tells you which Partner ID to use in each environment. --- ## AI assistant integration Source: src/content/docs/ai-agents.mdx > Surfaces and reference material for grounding AI coding assistants in current Revieve API behavior — OpenAPI specs, llms.txt, common mistakes to verify against. import { Aside, Card, CardGrid, LinkCard, Tabs, TabItem } from "@astrojs/starlight/components"; ## Overview If you're building a Revieve integration with help from an AI coding assistant (Claude, ChatGPT, Cursor, Copilot, an MCP-connected client), this page collects the surfaces that keep the assistant grounded in current API behavior — and the common mistakes worth verifying in any AI-generated code. ## Canonical references ## Ingestion surfaces Three ways to feed these docs into an AI assistant: [`/llms-full.txt`](/llms-full.txt) — every page concatenated, front-matter preserved. Best for one-shot context windows. Every doc page has a markdown sidecar at `.md`: - [`/guides/getting-started.md`](/guides/getting-started.md) - [`/concepts/redness.md`](/concepts/redness.md) Use these instead of scraping rendered HTML — they preserve front-matter, code blocks, and structure cleanly. ## Endpoint summary ```http POST https://partner-test.revieve.com/api/3/analyzeImage/ Content-Type: multipart/form-data # Required query params ?skintone=<0-6> &gender= # Optional but useful &components= &hairtype=<-1..4> &skintone_rgb= # Form fields image= partner_id= ``` Response is JSON. Branch on `data.message` (`"OK"` / `"Warning"` / `"Error"`) before reading `data.results[]`. The `data.status[]` array is the first thing to check on any non-OK message. ## Common mistakes in AI-generated code When training data lags the current spec, AI assistants tend to make a recurring set of mistakes. Worth scanning generated code for these: | Wrong | Right | | --- | --- | | Recommending the CV API for real-time virtual try-on | Use **[Revieve VTO](/products/virtual-try-on/)** — a separate browser-side product with its own multi-hundred-point face tracker | | `Authorization: Bearer …` | `partner_id` form field on the multipart body | | `?components=` empty / unset to mean "no metrics" | Omitting means *all defaults*; pass an explicit list to slim | | Reading `value_raw` | Use `value` (normalized 0..1) | | Sending PNG / HEIC | JPEG only; ≥ 600×600 px | | `gender=other` / `gender=nonbinary` | Use `gender=unknown` | | Branching on HTTP 200 alone | Branch on `data.message` *and* `data.status[]` | | Treating `local_warnings[]` as a stable enum | Treat as advisory; code defensively per finding | | Assuming one intensity scale for all visualization channels | Ranges differ per metric; see [Intensity ranges](/concepts/visualization/#intensity-ranges) | | Confusing the `makeup` component with virtual makeup try-on | `makeup` *detects* shades for matching; *applying* virtual makeup is VTO | | Calling features in `visualization_data` "heatmap points" | They're spots, polylines, or polygon-area features — see [Visualization data](/concepts/visualization/) | ## Suggested implementation order 1. [Getting started](/guides/getting-started/) and [Authentication](/guides/authentication/). 2. Generate a thin client from the OpenAPI spec. 3. Use the call from [Your first skin analysis](/guides/your-first-skin-analysis/) as a fixture in integration tests. 4. Map status codes to user-facing copy per [Error handling](/guides/error-handling/). 5. For each metric your UI surfaces, read the corresponding [concept page](/concepts/) for value semantics and rendering notes. ## When the assistant goes off-spec If generated code references a component, status code, or response field that doesn't appear in the OpenAPI document at this site, it doesn't exist in the API — re-prompt with `/llms-full.txt` or the relevant page sidecar in context, or paste the OpenAPI spec back in. --- ## Playground Source: src/content/docs/playground.mdx > Try the Skin Analysis API directly from the browser. Upload a JPEG, pick components, see the live response, copy the equivalent code. import { Aside } from "@astrojs/starlight/components"; import PlaygroundClient from "../../components/PlaygroundClient.astro"; Run a real call against `partner-test.revieve.com/api/3/analyzeImage/` from the browser. The playground talks directly to the test environment — no proxy, no backend. The shared demo Partner ID `jmlv6b2qtS` is prefilled. It is for evaluation only and may be replaced at any time; use your own Partner ID for sustained testing. ## What this is for - **Trying components without writing code.** Tick the boxes, upload a selfie, see what comes back. - **Generating reproducible calls.** "Show as code" panel emits the equivalent `curl`, JavaScript, or Python — paste into your client. - **Grounding AI integrators.** "Copy prompt" emits a self-contained prompt the user can hand to an LLM (Claude, ChatGPT, Cursor) along with the actual response. - **Spot-checking spec changes.** When a new component lands, this is the fastest way to see its real shape. ## Privacy Images are sent directly to `partner-test.revieve.com` for analysis and are not stored. Use the shared test ID for evaluation only, and your own Partner ID for anything else. --- ## Virtual Try-On Source: src/content/docs/products/virtual-try-on.mdx > Real-time, webcam-based try-on of makeup, hair colour and full looks in the browser. A Revieve product with its own integration, and how it fits with the Skin Analysis API. import { Aside, LinkCard, CardGrid } from "@astrojs/starlight/components"; ## Overview Revieve's **Virtual Try-On (VTO)** lets shoppers try makeup, hair colour, and full looks in real time using their webcam, directly in the browser, on mobile and desktop. Multi-hundred-point face tracking, true-to-product colour and finish, and skin-tone and lighting adjustment, with no images posted to a server. VTO is its own Revieve product with its own integration and developer documentation, provided during onboarding. This site documents the still-image APIs (Skin Analysis and Product Recommendations), which VTO complements rather than overlaps: if you are building real-time try-on, start with VTO; if you are scoring skin from a photo, you are in the right place. ## What VTO does, briefly - **Real-time, in-browser.** Webcam frames are processed by the VTO product directly in the browser; you don't post images to the CV API for try-on use cases. - **Multi-hundred-point face tracking.** Denser and finer-grained than what's needed for still-image analysis, optimised for live video. - **All makeup categories.** Face, lips, eyes, eyebrows. Single products, bundles, full-face looks. - **Inclusive by design.** Tracking optimised across ethnicities, demographics, ages, and genders. - **AR rendering with skin-tone and lighting adjustment.** True-to-product colour, intensity, and finish. - **Mobile and desktop.** Same product, different form factors. ## Why this matters for the CV API VTO and the CV API are complementary, not overlapping: | Use case | Use | | ------------------------------------------------------- | -------------- | | Real-time virtual try-on (lipstick, eyeshadow, looks) | **VTO** | | Hair-colour try-on | **VTO** / AI Hair Color Artist | | Diagnostic skin scoring (wrinkles, redness, age, …) | **Skin Analysis API** | | Personalised product recommendations | **Product Recommendations API** | | Foundation shade matching from a single still | Skin Analysis API (`makeup` component) | ## Why VTO runs on-device VTO processes tens of webcam frames per second to keep the AR overlay smooth. Round-tripping each frame to a server is impractical at that rate — the latency budget for a perceived-instant try-on is well under what a network hop allows, and bandwidth would balloon. So VTO does its face tracking and rendering locally in the browser. A side effect: the webcam video is processed in the browser and is not sent to Revieve during try-on. Compliance and data-handling specifics for your deployment are governed by your Revieve agreement. ## Other Revieve consumer products VTO is one of several consumer-facing products built on the Revieve platform. Each has its own page on revieve.com; integration is sales-led: - **AI Skincare Advisor** — diagnostic skincare consultation built on the Skin Analysis API. - **AI Makeup Advisor** — makeup recommendations + try-on. - **AI Haircare Advisor** — diagnostic haircare consultation. - **AI Hair Color Artist** — virtual hair-colour try-on. These are turnkey solutions, ready to add to your site. The APIs documented here are the building blocks underneath them. --- ## Getting started Source: src/content/docs/guides/getting-started.mdx > Make your first authenticated call to the Skin Analysis API in under five minutes using a JPEG and a Partner ID. import { Steps, Tabs, TabItem, Aside } from "@astrojs/starlight/components"; This guide gets you from zero to a successful round-trip against the test environment. It assumes nothing besides `curl` (or `fetch` / `requests`) and a frontal-face JPEG of at least 600×600 pixels. 1. **Pick or grab a test image.** Any frontal-face JPEG of at least 600×600 pixels works. Strong even lighting and a neutral background give the cleanest results. 2. **Send the image.** ```bash curl -X POST \ "https://partner-test.revieve.com/api/3/analyzeImage/?skintone=0&gender=unknown&components=wrinkles,redness,acne,skin_age" \ -F "partner_id=jmlv6b2qtS" \ -F "image=@./selfie.jpg" ``` ```js const form = new FormData(); form.append("partner_id", "jmlv6b2qtS"); form.append("image", fileInput.files[0]); const url = new URL("https://partner-test.revieve.com/api/3/analyzeImage/"); url.searchParams.set("skintone", "0"); url.searchParams.set("gender", "unknown"); url.searchParams.set("components", "wrinkles,redness,acne,skin_age"); const res = await fetch(url, { method: "POST", body: form }); const data = await res.json(); ``` ```python import requests with open("selfie.jpg", "rb") as f: res = requests.post( "https://partner-test.revieve.com/api/3/analyzeImage/", params={ "skintone": 0, "gender": "unknown", "components": "wrinkles,redness,acne,skin_age", }, data={"partner_id": "jmlv6b2qtS"}, files={"image": f}, ) data = res.json() ``` 3. **Read the top-level response.** ```json { "message": "OK", "face_area": { "bounding_box": [...], "rotation": -2.1 }, "status": [], "results": [ { "description": "wrinkles", "value": 0.34, "message": "Ok", "..." }, { "description": "redness", "value": 0.18, "message": "Ok", "..." } ] } ``` - `message: "OK"` confirms the call succeeded with no quality issues. - Each entry in `results[]` is one metric you asked for. - `status[]` is empty here; if a code shows up, see [Interpreting results](/guides/interpreting-results/). 4. **Iterate on the `components` list.** Trim it to exactly what your UI uses. Fewer components → faster response, smaller payload. ## What's next - [Authentication](/guides/authentication/) — the Partner-ID model in detail. - [Your first skin analysis](/guides/your-first-skin-analysis/) — a longer walk-through that wires the response into a UI. - [Interpreting results](/guides/interpreting-results/) — how to render scores, masks, and overlays. - [API reference](/api/skin-analysis/operations/analyzeimage/) — every parameter, every response field. --- ## Authentication Source: src/content/docs/guides/authentication.mdx > Partner ID model, test vs production credentials, allowed origins, and where the credential rides on each request. import { Aside } from "@astrojs/starlight/components"; Revieve identifies callers by **Partner ID** — a short string issued to your account. There is no OAuth flow, no JWT, no session cookie, and no `Authorization` header. Authentication is a single multipart form field on every request. ## Where to put it The Partner ID rides as a form field in the multipart body of `POST /analyzeImage/`: ```http POST /api/3/analyzeImage/?skintone=0&gender=unknown HTTP/1.1 Content-Type: multipart/form-data; boundary=----X ----X Content-Disposition: form-data; name="partner_id" jmlv6b2qtS ----X Content-Disposition: form-data; name="image"; filename="selfie.jpg" Content-Type: image/jpeg ----X-- ``` That's it. Don't add `Authorization` headers; they aren't read. ## Test vs production | Environment | Partner ID | Base URL | | ----------- | -------------------------- | ----------------------------------------- | | Test | `jmlv6b2qtS` (shared demo), or your own | `https://partner-test.revieve.com/api/3/` | | Production | Issued to your account | `https://partner.revieve.com/api/3/`, or the regional host in your contract | The test ID is shared. Treat it like any public demo key: fine for evaluation, never for real users. Revieve may replace it at any time; if it stops working, find the current one here in the docs or ask the Revieve team. Revieve tells you which Partner ID to use in test and in production. ## Calling from the browser The Partner ID is designed to be used in the browser, and Revieve's own front-end plugin does exactly that. What limits its use is the list of allowed origins that Revieve configures for your account: ask your Revieve contact to add the domains your production site runs on. A browser call from any other origin fails with a CORS error. Calling the API from your own backend works too, but is not required. If you need a new Partner ID, ask your Revieve contact. ## What the server checks - **Partner ID**: missing returns `404`, unknown returns `403`. See [Error handling](/guides/error-handling/). - **Licence**: the Partner ID must be licensed for Skin Analysis and for the components you request; otherwise `403`. - **Region routing** is determined by the production base URL you receive, not by anything in the request. --- ## Your first skin analysis Source: src/content/docs/guides/your-first-skin-analysis.mdx > Ten-minute walk-through wiring a captured JPEG into the Skin Analysis API and rendering the response into a UI. import { Steps, Code, Aside, Tabs, TabItem } from "@astrojs/starlight/components"; import DemoPreview from "../../../components/DemoPreview.astro"; This goes one step beyond [Getting started](/guides/getting-started/): capture an image in a browser, send it to the Skin Analysis API, and render the response into a small UI. The example uses plain HTML and `fetch` so it ports trivially into React, Vue, or any framework. About 60 lines of code, no build step. ## The full example ```html title="index.html" Revieve demo

…or try a sample photo:






```
  
## What it does, step by step 1. **The user picks a JPEG.** Anything ≥ 600×600 px works. The sample strip loads one of the docs' model photos into the same file input, so the rest of the code does not care where the image came from. 2. **We build the URL.** Always send `skintone` and `gender`; without them the server falls back to fixed defaults that may not match your user. If you don't know them, send `skintone=0` and `gender=unknown` to let the analysis estimate them. Optional: `components` (we ask for four). The full list is in the [API reference](/api/skin-analysis/operations/analyzeimage/). 3. **We POST a multipart form.** The body has `partner_id` and `image`. Browsers set the `Content-Type` boundary automatically. 4. **We branch on the response shape.** - `data.message === "OK"` — no global quality issues. Individual metrics can still fail: check each result's `message` and `local_warnings`. - `data.message === "Warning"` — results are usable, but image quality is reduced; consider a UX nudge ("try better lighting"). - `data.message === "Error"` — the analysis could not run and `results` is `null`; show the `description` of the first `status[]` entry with `isError: 1` (earlier entries can be warnings). 5. **We render `results`.** Each entry we asked for here has a `value` between 0 and 1 — multiply by 100 for percentage UI. Not every metric works this way: integer/categorical findings (e.g. `skin_age`, `skin_type`) leave `value` null and carry their result in `sum_measures[]` instead — see below. ## Where to go from here - For richer rendering, the `measurement_locations[]` and `mask_shapes` fields drive overlay visualizations. See [Interpreting results](/guides/interpreting-results/). - For integer and categorical findings (skin age, skin type, undertone, hair type, eye color), look at `sum_measures[]` rather than the top-level `value` — for these, `value` is null. - For real-time AR try-on, use [Revieve VTO](/products/virtual-try-on/) — the Skin Analysis API is for still-image scoring only. ## Common quality issues | Symptom | Likely cause | Fix | | --------------------------- | --------------------------------------------- | ----------------------------------------- | | `idx: 100` (input format) | Image is not a colour (RGB) image, e.g. grayscale. | Send a colour image. | | `idx: 101` (resolution) | Image smaller than 600×600. | Recapture at higher resolution — don't upscale. | | `idx: 301` (face too small) | Face too small in the frame. | Prompt the user to move closer. | | `idx: 103/104` (lighting) | Over- or under-exposed. | Reshoot in even lighting; warn the user. | | `idx: 201` (no face) | Face is occluded or out of frame. | Prompt the user to recentre. | | `idx: 308` (overexposure) | Hot spot from direct flash. | Use more diffuse light. | --- ## Interpreting results Source: src/content/docs/guides/interpreting-results.mdx > How to read the Skin Analysis response — top-level fields, per-finding shape, masks, visualizations, and what to render. import { Aside } from "@astrojs/starlight/components"; The Skin Analysis response is one JSON document with five top-level fields: `message`, `face_area`, `inverse_color_balance_rb`, `status[]`, and `results[]`. This page explains each and how to render it. A sixth, `composites`, appears only when you request [composite metrics](/concepts/composites/) and Revieve has configured them for your partner ID. ## The shape ```jsonc { "message": "OK" | "Warning" | "Error", "face_area": { "bounding_box": [x_min, y_min, x_max, y_max], "rotation": -2.4 }, "inverse_color_balance_rb": [1.05, 0.98, 1.02], "status": [ { "idx": 308, "description": "Image is overexposed at the face area. Find more diffuse lighting or reduce exposure.", "isError": 0 } ], "results": [ { "description": "redness", "value": 0.23, "value_raw": 3.21, // deprecated "message": "Ok", "local_warnings": [], "measurement_locations": [ /* per-region scores; advanced visualization features live here, on each location's own visualization_data[] */ ], "sum_measures": [/* derived/aggregate */], "visualization_data": null // currently null at finding level — see below } ] } ``` ## `message` — the global verdict The first thing your UI should branch on: - **`OK`** — no global quality issues. Individual metrics can still fail: check each finding's `message` and `local_warnings`. - **`Warning`** — results returned, but `status[]` flags one or more quality issues. Show the score, optionally nudge the user to retry for better fidelity. - **`Error`** — the analysis could not run and `results` is `null`. `status[]` explains why; show that and ask for a new image. ## `face_area` — geometry `bounding_box` is `[x_min, y_min, x_max, y_max]` in pixels of the original image. `rotation` is degrees clockwise from vertical. Use them when overlaying masks or visualizations back onto the source frame. ## `status` — quality codes Each entry has: - **`idx`** — a numeric code (see [Status codes](/concepts/status-codes/) for the full reference). - **`description`** — human-readable. - **`isError`** — `1` is an error (no results), `0` is a warning (results are still returned). Entries are listed in the order they were found. When `message` is `Error`, warnings found earlier come first, so use the first entry with `isError: 1`. When every requested metric failed, `status[]` also contains those metrics' errors, followed by `500`. Common codes: | `idx` | Meaning | Treatment | | ----- | ------------------------------------------- | ---------------------------------- | | 100 | Image not in RGB color format | Surface, ask for retry | | 101 | Image resolution too small | Surface, ask for retry | | 102 | Image aspect ratio too extreme | Surface, ask for retry | | 103/104 | Image too dark / overexposed globally | Optional nudge | | 201 | No face detected | Surface, ask for retry | | 308 | Face area overexposed | Optional nudge | Metric-level codes such as `401` appear in that finding's `local_warnings`, not in `status`. The full list is on [Status codes](/concepts/status-codes/). ## `results[]` — per-component findings Each entry corresponds to one metric you requested. ### `value` vs `value_raw` `value` is normalized to `0..1` for nearly every metric — what you should display. `value_raw` is the pre-normalization value and is **deprecated**: ignore it for new integrations. `skin_age`, `skin_type`, `makeup` and `hair` are exceptions: they leave the top-level `value` null; their results are in `sum_measures` (see below). ### `measurement_locations[]` Where on the face the score was computed. Each entry includes: - A `description` (`"left cheek"`, `"forehead"`, …). `shine`, `glow` and `skin_sagging` also add a `Global` location that covers the whole face. - A `value` for that region. - AOI (area of interest) coordinates: `AOI_x_o`, `AOI_y_o`, `AOI_radius_o` (in original image pixels). - `ut_zone` — `"u-zone"` | `"t-zone"` | `"none"` | `"mixed"`. `mixed` is part of either zone depending on the definition (e.g. `chin`). - Optional `mask_shapes` (with the `masks` component) — the exact area that was analyzed. What was found there is in `visualization_data`. ### `sum_measures[]` Aggregated or categorical sub-findings. Shape varies by metric: - **Makeup** → face shape (1–6), eye color (1–3), skin undertone (−1 / 0 / +1), foundation RGB, Fitzpatrick type. - **Hair** → color array, volume (0–1), type (0–4), frizziness (0 or 1). - **Skin Age** → integer 0–100. - **Skin Type** → integer 1–8 (normal, dry, oily, combination, sensitive variants). ### `visualization_data[]` Optional per-metric advanced visualization — the third tier of [visualization data](/concepts/visualization/) (the first two being AOI circles and mask shapes). Returned only when the corresponding `_visualization` opt-in is in your `?components=...` query (e.g. `acne_visualization`, `wrinkles_visualization`, `redness_visualization`). The field appears at two levels: **read it from each `measurement_locations[]` entry.** Features are currently returned only there; the finding-level `visualization_data` is `null`. ```js const finding = response.results.find((r) => r.description === "redness"); const features = (finding.measurement_locations ?? []).flatMap( (loc) => loc.visualization_data ?? [] ); ``` Each feature is one of three implicit types — determined by the metric, not by a `kind` field: - **Spot** — single point with intensity. Used by acne, freckles, dark spots, hyperpigmentation. `length: 1`, `x[0]` / `y[0]` is the centroid. - **Polyline** — connected line of N points (one wrinkle, one fold). Used by wrinkles. `length: N`, `intensity` is an array of per-point intensities; `length_weighted_intensity` is the canonical "how bad is this wrinkle" composite. - **Polygon area** — enclosed region whose `intensity` is a level index (`1`, `2`, `3`, …), not a normalized score. Used by redness, melasma, shine, glow, skin type, texture, uneven skin tone, pore dilation. For the threshold-based metrics higher levels nest inside lower ones; `shine` and `skin_type` draw their levels from separate source fields and don't nest. `skin_sagging` also uses polygons but carries a continuous intensity instead of levels. See [Visualization data](/concepts/visualization/#intensity-ranges) for per-metric ranges. All coordinates are in original-image pixel space. For paste-ready render code, see [Rendering recipes](/guides/rendering-recipes/). ## `inverse_color_balance_rb` A 3-element array — **not** `[r, g, b]`. The elements are: | Index | Meaning | | ----- | ------- | | `[0]` | inverse **red** white-balance multiplier (`1 / red_correction`) | | `[1]` | inverse **blue** white-balance multiplier (`1 / blue_correction`) | | `[2]` | inverse **luminance** factor (`1 / luminance_correction`) | Green is the reference channel (multiplier `1`), so it has no entry — hence the `rb` ("red/blue") in the name, plus the luminance term. When white balance can't be estimated the array is `[1, 1, 1]` (a no-op). ### What it's for The analysis runs in a **white-balanced ("true colour") space** — the engine internally removes the image's colour cast before measuring. These factors are the **inverse** of that correction, so they let you take a true-colour RGB value and **re-apply the original image's colour cast**. The point is efficiency: instead of colour-correcting the whole user photo (expensive, and a global approximation can make the photo itself look off), you leave the photo untouched and only re-bias the handful of colours you draw on top of it, so they sit naturally on the original image. So use it when you composite a **CV-measured colour** (e.g. a foundation/skin-tone swatch the API returned in true-colour space) onto the **original, uncorrected photo**. Apply per channel: ```js const [iR, iB, iL] = response.inverse_color_balance_rb; // trueColor = [R, G, B] in 0..255 (a colour the API measured in true-colour space) function toImageCast([R, G, B]) { return [ R * iR * iL, // red channel: inverse red WB × luminance G * iL, // green channel: luminance only (green is the reference) B * iB * iL, // blue channel: inverse blue WB × luminance ]; } ``` The result is how that colour appears under the photo's own lighting/cast, so it blends with the un-corrected image. ## A minimal renderer ```js function summarize(response) { if (response.message === "Error") { return { ok: false, reason: response.status?.find((s) => s.isError === 1)?.description }; } const scores = Object.fromEntries( response.results .filter((r) => typeof r.value === "number") .map((r) => [r.description, Math.round(r.value * 100)]) ); return { ok: true, scores, warnings: response.status ?? [] }; } ``` That's enough for a percentage-bar dashboard. Mask overlays are documented in their respective concept pages. --- ## Error handling Source: src/content/docs/guides/error-handling.mdx > HTTP- and document-level error semantics, retry strategy, and a defensive client implementation for the Skin Analysis API. import { Aside } from "@astrojs/starlight/components"; The Skin Analysis API has two layers of failure: HTTP-level (transport, Partner ID and licence) and document-level (image quality, per-metric model confidence). Each calls for different handling. ## HTTP-level | Status | Cause | What to do | | ------ | ---------------------------------------- | ------------------------------------------------------- | | 200 | Success — but check `data.message` | Branch on `message`, then `status[]`. | | 400 | Upload rejected, e.g. the image is not in the `image` field or more than one file was sent | Fix the call. | | 403 | `Unauthorized / Invalid Partner ID`: the Partner ID is unknown | Check the ID and the environment (test and production IDs differ). | | 403 | `Unauthorized / Invalid license for module`: the Partner ID is not licensed for Skin Analysis or for one of the requested components | Remove the component or ask your Revieve contact. | | 404 | `Partner ID required`: no `partner_id` form field | Send the Partner ID in the multipart body. | | 413 | Image larger than 30 MB | Resize client-side; aim for < 5 MB. | | 500 | Analysis failed (`code: "1661"`), or the request had no image | Check that the image is a readable JPEG. Retry once at most. | | 502/503/504 | Transient infrastructure issue | Retry with back-off. | A browser request from an origin that is not on your account's allowed list does not get an HTTP error you can read: the browser blocks the response and reports a CORS or network error. See [Calling from the browser](/guides/authentication/#calling-from-the-browser). ## Document-level A `200 OK` HTTP response can still report problems via `data.message` and `data.status[]`. The handling matrix: | `message` | Meaning | UX | | --------- | -------------------------------------------- | --------------------------------------------------------- | | `OK` | No global quality issues | Render results. Individual metrics can still fail: check each finding's `message`. | | `Warning` | Results usable, quality issue noted | Render results. Optionally surface advice from `status[]`. | | `Error` | The analysis could not run; `results` is `null` | Hide result UI. Surface the `description` of the first `status[]` entry with `isError: 1`. | Per-finding `local_warnings[]` arrays apply at the metric level — e.g. pore dilation may fail because face resolution wasn't sufficient even when the overall call succeeded. Hide that one card, keep the rest. ## A defensive client ```ts async function analyze(file: File | undefined) { // A request without an image returns HTTP 500. Do not send it, and do not retry it. if (!file) { throw new Error("No image to analyze"); } const url = new URL("https://partner-test.revieve.com/api/3/analyzeImage/"); url.searchParams.set("skintone", "0"); url.searchParams.set("gender", "unknown"); const form = new FormData(); form.append("partner_id", PARTNER_ID); form.append("image", file); for (let attempt = 0; attempt < 3; attempt++) { const res = await fetch(url, { method: "POST", body: form }); // 502/503/504 are transient infrastructure errors. Retry with back-off. if ([502, 503, 504].includes(res.status)) { await new Promise((r) => setTimeout(r, 250 * 2 ** attempt)); continue; } // 500 means the analysis failed (code 1661), often because of the image itself. Retry once at most. if (res.status === 500 && attempt === 0) { await new Promise((r) => setTimeout(r, 250)); continue; } if (!res.ok) { throw new ApiError(`HTTP ${res.status}`, res.status); } const data = await res.json(); if (data.message === "Error") { // Warnings can come before the error in status[] const error = data.status?.find((s) => s.isError === 1); throw new AnalysisError( error?.description ?? "Analysis failed", error?.idx, ); } return data; } throw new Error("Exhausted retries"); } ``` ## Surface to users, log to ops The `description` texts in `status[]` and `local_warnings[]` are English developer strings. Map `idx` to your own user-facing, translatable copy, and log the raw codes for debugging. --- ## Rendering recipes Source: src/content/docs/guides/rendering-recipes.mdx > Paste-ready Canvas / SVG renderers for the three advanced-visualization feature types — spots, polylines, polygon-areas. import { Aside, Code, Tabs, TabItem } from "@astrojs/starlight/components"; import DemoPreview from "../../../components/DemoPreview.astro"; ## Overview This guide is paste-and-tune code for drawing the three feature types in [advanced visualization data](/concepts/visualization/#tier-3--advanced-concern-visualization): | Feature type | Metrics | Recipe | |---|---|---| | **Spots** | acne, freckles, dark spots, hyperpigmentation | [→ Spots](#recipe-1--spots) | | **Polylines** | wrinkles + sub-region variants | [→ Polylines](#recipe-2--polylines) | | **Polygon areas** | redness, melasma, shine, glow, texture, uneven skin tone, skin sagging, pore dilation | [→ Polygon areas](#recipe-3--polygon-areas) | The renderers below are vanilla Canvas 2D, no dependencies. Same iteration shape, same render rules, simplified to the essentials of what works for these data types. ## The shared loop Every advanced-visualization render starts with the same nested iteration: ```js // 1. Find the metric in results[]. const finding = response.results.find((r) => r.description === "redness"); if (!finding) return; // 2. Each measurement_locations[] entry can carry visualization_data[]. // Shine also has a "Global" entry covering the zone entries: draw Global only. const locations = finding.measurement_locations ?? []; const global = locations.filter((loc) => loc.description === "Global"); for (const loc of global.length ? global : locations) { // 3. Sort features ascending by intensity before drawing. // Higher-intensity polygons sit INSIDE lower-intensity ones — // drawing low → high gives correct overpainting. Polylines carry an // array of per-point intensities, so sort those by mean_intensity. const level = (f) => (typeof f.intensity === "number" ? f.intensity : f.mean_intensity ?? 0); const features = (loc.visualization_data ?? []) .slice() .sort((a, b) => level(a) - level(b)); for (const f of features) { // mean_intensity is the canonical color-decision input; // fall back to intensity if absent. const colorIntensity = f.mean_intensity ?? f.intensity; drawFeature(ctx, f, colorIntensity); } } ``` Four rules from this loop: 1. **Sort features ascending by intensity** before drawing. Required for area metrics, harmless for spot/line. Keeps render order deterministic. 2. **Prefer `mean_intensity ?? intensity`** for color decisions — `mean_intensity` is more stable than the raw per-coordinate `intensity` on multi-point features. 3. **Stay in original-image pixel space.** All `x` / `y` arrays are in input-image coordinates. Render onto a canvas of the same dimensions as the source image, no transform required. 4. **Draw `Global` only when a metric also has zone entries.** Shine's `Global` entry carries the whole-face areas and its `t-zone` / `u-zone` entries the same areas cut to each zone, so drawing every entry draws most areas twice. Draw `Global`, or the zones, not both. ## Recipe 1 — spots A spot feature is a single point (`length: 1`, `x`, `y` and `intensity` are length-1 arrays; `mean_intensity` holds the same value as a number). ```js // Recipe 1 — spots. Requires nothing. Used via renderMetric (render.js) or directly. /** * Draw a single spot — used for acne, freckles, dark spots, * hyperpigmentation. * * `style` controls the marker shape: * "dot" — two concentric circles (recommended for acne, freckles) * "box" — square outline (dark spots / hyperpigmentation) */ function drawSpot(ctx, feature, intensity, { style, color, scale = 1 }) { const x = feature.x[0]; const y = feature.y[0]; ctx.save(); ctx.strokeStyle = color; ctx.fillStyle = color; ctx.lineWidth = 2 * scale; if (style === "dot") { // Inner solid disc + outer stroke ring. ctx.beginPath(); ctx.arc(x, y, 6 * scale, 0, Math.PI * 2); ctx.fill(); ctx.beginPath(); ctx.arc(x, y, 12 * scale, 0, Math.PI * 2); ctx.lineWidth = 2 * scale; ctx.stroke(); } else if (style === "box") { const size = 18 * scale; ctx.lineWidth = 4 * scale; ctx.strokeRect(x - size / 2, y - size / 2, size, size); } else if (style === "cross") { const size = 14 * scale; ctx.lineWidth = 4 * scale; ctx.beginPath(); ctx.moveTo(x - size / 2, y - size / 2); ctx.lineTo(x + size / 2, y + size / 2); ctx.moveTo(x + size / 2, y - size / 2); ctx.lineTo(x - size / 2, y + size / 2); ctx.stroke(); } ctx.restore(); } ``` Used on: [acne](/concepts/acne/), [freckles](/concepts/freckles/), [dark spots](/concepts/dark-spots/), [hyperpigmentation](/concepts/hyperpigmentation/). Marker size is fixed in viewBox-pixel terms (6/12 px for dots, 18 px for boxes, 14 px for crosses are workable defaults); pass a `scale` if you're rendering on a downsized canvas. ## Recipe 2 — polylines A polyline feature is a connected line — one wrinkle, one fold. `x` and `y` are length-N arrays of points along the line. `intensity` is an array of length N (per-point intensity), and `length_weighted_intensity` is the canonical "how bad is this wrinkle" composite. ```js // Recipe 2 — polylines. Requires nothing. Used via renderMetric (render.js) or directly. const FILTER_STEP = 3; const FILTER_THRESHOLD = 20; /** * Decimate dense point arrays for performance — wrinkles can carry * hundreds of points along a single line. Filtering every Nth point * above a threshold gives a visually identical render at a fraction * of the cost. */ function decimate(arr, step = FILTER_STEP, threshold = FILTER_THRESHOLD) { if (arr.length <= threshold) return arr; return arr.filter((_, i) => i % step === 0 || i === arr.length - 1); } /** * Draw a polyline — used for wrinkles and its sub-region variants * (nasolabial folds, marionette lines, etc.). */ function drawPolyline(ctx, feature, intensity, { color, strokeWidth = 4, scale = 1 }) { const xs = decimate(feature.x); const ys = decimate(feature.y); if (xs.length < 2) return; ctx.save(); ctx.strokeStyle = color; ctx.lineWidth = strokeWidth * scale; ctx.lineCap = "round"; ctx.lineJoin = "round"; ctx.beginPath(); ctx.moveTo(xs[0], ys[0]); for (let i = 1; i < xs.length; i++) ctx.lineTo(xs[i], ys[i]); ctx.stroke(); ctx.restore(); } ``` Used on: [wrinkles](/concepts/wrinkles/). For ranking wrinkles (e.g., "show me the worst 5"), sort the features by `length_weighted_intensity` descending — that composite is built specifically for this use. ## Recipe 3 — polygon areas A polygon-area feature is an enclosed region whose `intensity` is a *categorical integer* indexing levels, counting up from `1`. The top of the range varies by metric — `1..2` up to `1..9` — see the [level table](/concepts/visualization/#intensity-ranges). Each level can come back as several features, one per separate region at that level. For most of these metrics the levels are increasing thresholds on one field, so higher levels sit inside lower ones and layered fills read as a gradient. `skin_sagging` also draws polygons but its `intensity` is a continuous score, not a level. `shine` (`1..4`) and `skin_type` (`1..9`) are different again: their levels come from separate source fields, so treat the integer as a label and give each level its own colour rather than a position on one ramp. ```js // Recipe 3 — polygon areas. Requires nothing. Used via renderMetric (render.js) or directly. /** * Draw a polygon-area feature — used for redness, melasma, shine, skin type, * texture, uneven skin tone, skin sagging, pore dilation. * * Colour: pick one outside the skin-tone gamut (blue, magenta, teal, green), so it reads * as an annotation on every skin tone instead of fusing into it or looking like a skin * condition. For the threshold-based metrics keep ONE colour and carry the level in * opacityForLevel(intensity) — translucent fills of any colour pull towards skin, so keep * them light and let the outline do the work. For shine and skin type (categories, not * levels) map each level to its own colour with colorForLevel(intensity) instead. */ function drawPolygonArea(ctx, feature, intensity, { colorForLevel, opacity = 0.2, opacityForLevel, outline = 2, scale = 1 }) { const xs = feature.x; const ys = feature.y; if (xs.length < 3) return; const color = colorForLevel(intensity); ctx.save(); ctx.beginPath(); ctx.moveTo(xs[0], ys[0]); for (let i = 1; i < xs.length; i++) ctx.lineTo(xs[i], ys[i]); ctx.closePath(); // polygon types are closed shapes — connect last to first ctx.fillStyle = color; ctx.globalAlpha = opacityForLevel ? opacityForLevel(intensity) : opacity; ctx.fill(); if (outline > 0) { ctx.globalAlpha = 0.9; ctx.strokeStyle = color; ctx.lineWidth = outline * scale; ctx.stroke(); } ctx.restore(); } ``` Used on: [redness](/concepts/redness/), [melasma](/concepts/melasma/), [texture](/concepts/texture/), [uneven skin tone](/concepts/uneven-skin-tone/), [skin sagging](/concepts/skin-sagging/), [shine](/concepts/shine/), [glow](/concepts/glow/). Because the shared loop sorts features ascending by intensity, the highest level naturally lands on top. With one colour and `opacityForLevel` rising with the level (the recipes use 0.12, 0.22, 0.32), the layered fill reads as a density map — outer (low) areas stay faint, inner (high) areas dominate — while the outline keeps every region visible on every skin tone. Use a colour outside the skin-tone gamut (blue, magenta, teal, green): warm colours fuse into light skin and look like the condition itself. For `shine` and `skin_type`, keep the sort for deterministic draw order but pick `colorForLevel` per level rather than as a ramp, since their levels aren't a severity sequence. ## Putting it together One function selects the finding and walks its features in the right order; each metric is then a single call that names the recipe and the colours: ```js title="render.js" // renderMetric: the shared loop. Requires one of the draw recipes to pass as options.draw. function renderMetric(ctx, response, metric, options) { const finding = response.results.find((r) => r.description === metric); if (!finding) return; // Shine has a "Global" entry with the whole-face areas plus "t-zone" / "u-zone" entries // with the same areas cut to each zone. Draw Global only, or most areas draw twice. const locations = finding.measurement_locations ?? []; const global = locations.filter((loc) => loc.description === "Global"); for (const loc of global.length ? global : locations) { // Polylines carry an array of per-point intensities; sort those by mean_intensity. const level = (f) => (typeof f.intensity === "number" ? f.intensity : f.mean_intensity ?? 0); const features = (loc.visualization_data ?? []) .slice() .sort((a, b) => level(a) - level(b)); for (const f of features) { const intensity = f.mean_intensity ?? f.intensity; options.draw(ctx, f, intensity, options); } } } ``` Every concept page shows its own call like this one, in the Code tab beside its reference image. The preview below draws three of them at once: freckles, wrinkles and redness. The preview runs on recorded partner-test responses for a set of licensed model photos, drawn on the analysed photo in source-image coordinates. Toggle the layers, switch model with the thumbnails, and hold the photo to see it without overlays. Note how freckle markers and wrinkle lines differ between faces, and how the redness levels nest. ## Complete example Everything above in one file: upload a photo, request a metric with its visualization channel, draw the photo on a canvas of the same size, make one metric call. ```html title="index.html" Revieve — draw an overlay

```
## Get the helpers The recipes are plain scripts with no dependencies, served from this site at stable URLs: - One file, classic script: `https://api.revieve.com/demos/recipes/revieve-render.js` (defines `renderMetric`, `drawSpot`, `drawPolyline`, `drawPolygonArea`, `decimate` as globals) - One file, ES module: `https://api.revieve.com/demos/recipes/revieve-render.mjs` (same functions as named exports) - Per recipe: `https://api.revieve.com/demos/recipes/spots.js`, `polylines.js`, `polygon-areas.js`, `render.js` - Per metric call, as shown on each concept page: `https://api.revieve.com/demos/recipes/metrics/.js`, for example `metrics/redness.js` Each file starts with a comment saying what it requires. The functions expect a 2D context `ctx` on a canvas sized to the analysed image and the parsed `analyzeImage` JSON as `response`; nothing else is assumed. The current version is in the header of the bundle. Copy the files into your project and pin them; they are small enough to read in full. ## Other rendering targets - **Server-side / Python.** Use OpenCV (`cv2.fillPoly`, `cv2.polylines`, `cv2.circle`) or `matplotlib.pyplot` — both are workable for batch rendering and report generation. - **SVG.** Build a ``, ``, or `` element per feature inside an `` matching the input image. Same iteration; different output target. - **Native (iOS / Android).** No first-party recommendation from Revieve at this time; use the platform's native graphics APIs (Core Graphics on iOS, Canvas on Android) with the same iteration logic. ## Related - **[Visualization data](/concepts/visualization/)** — the three-tier model and feature-shape reference. - **[Masks](/concepts/masks/)** — the tier-2 region-boundary format and its drawing program. - **[Sub-area divisions](/concepts/sub-areas/)** — face-region splits used by `measurement_locations[]`. --- ## Image quality and resolution Source: src/content/docs/guides/image-quality.mdx > What the CV needs in an input image — lighting, face position, resolution thresholds, and the eyeglasses / pore-dilation gotchas. Tells you why an image got rejected and how to prevent it. import { Aside } from "@astrojs/starlight/components"; ## Overview The Skin Analysis API rejects an image (returns `data.message: "Error"`) or warns about it (`"Warning"`) for two main reasons: **lighting** and **face positioning**. A third, less-frequent reason is resolution — the image must be at least 600×600 px and the face within it at least 300 px wide, while `pore_dilation` asks for considerably more. Use this guide to coach users through better captures, or to bake the constraints into your client-side capture flow. ## What the CV needs ### Lighting - **Enough light** — not too dim, not blown out. Bright but not overexposed. - **Face turned toward the source of light**, not backlit. - **Diffuse light** — overhead shop lighting, north-facing window, ring light. Avoid direct sunlight or a single bare bulb. - **No shadows** across the face — uneven illumination skews colour-driven metrics (redness, dark spots, undertone). - **Consistent background lighting**. Strong contrast between face and surroundings can confuse the face-detection step. Quality codes you'll see in `status[]` for lighting issues: - `103` (warning) — image too dark globally. - `104` (warning) — image overexposed globally. - `307` (warning) — face area too dark. - `308` (warning) — face area overexposed. - `309` / `310` / `311` (warning) — face channel clipping (blue / green / red overexposed). - `312` (warning) — asymmetric exposure on the face. - `313` (warning) — hard shadows on the face. ### Face positioning - **Face the camera straight on**, neutral expression. - **Empty space around the face** — leave enough margin so the head isn't tightly framed. - **No tilt** — chin neutral, head not rotated to either side. - **Whole face must fit in frame** — forehead, cheeks, and chin all visible. Quality codes: - `201` (error) — no face detected. - `202` (warning) — multiple faces detected; only the best fit is analyzed. - `203` / `204` (warning) — face detection is uncertain to very uncertain. - `302` / `304` (error) — face too tilted to the side / down. - `303` / `305` / `306` (warning) — face possibly tilted to the side / down / up. - `315`–`318` (error) — face partially outside the frame (forehead / lower face / right / left). - `319` (warning) — face too tightly framed. A useful pattern is to recommend **passport-photo-style** capture conditions to users — that framing maps almost exactly to what the CV needs. ### Resolution Three separate thresholds apply, and they're easy to conflate — the image size and the face size are measured independently: | Measured on | Requirement | If not met | |---|---|---| | The image, both dimensions | ≥ 600 px | `101` (error) — image rejected, nothing is analyzed | | Face width | ≥ 300 px | `301` (error) — image rejected, nothing is analyzed | | Face width, for `pore_dilation` only | ≥ 1200 px for full quality | 600–1199 px → `2001` (warning), runs in an upsizing fallback and still returns scores. Below 600 px → `2000` (error), `pore_dilation` aborts with `value: null` while every other requested metric still returns normally. | **"Face width"** here is the width of the face region the CV crops out of your image, not a measurement of the face itself. That crop carries a margin around the face, so it runs somewhat wider than the visible face. Clearing the two hard floors is not the same as capturing well. A 600×600 image passes, but a face filling half of it is only ~300 px across — right at the abort boundary, with no headroom for a user who stands slightly further back. Aim comfortably above the minimum, and if `pore_dilation` is in your component list, frame so the face region alone is ≥ 1200 px wide. Quality codes for resolution: - `101` (error) — image smaller than 600 px in either dimension. - `102` (error) — image aspect ratio too extreme to downsample safely. - `301` (error) — face narrower than 300 px. Asks the user to take the photo closer. - `2000` (error) — face narrower than 600 px; `pore_dilation` aborted. - `2001` (warning) — face between 600 and 1199 px; `pore_dilation` results may be unreliable. ## Eyeglasses The CV detects eyeglasses (status code `314`, warning) but **does not compensate for them**. Eye-area results are unreliable, and `acne` is not analysed when `314` is present (`local_warnings` code `3000`). Best UX: ask the user to remove glasses before capture. ## Why two captures of "the same image" can return different scores If two integrations get different scores for the same selfie, here's the usual cause list: - **Different environments.** Test and production can run different CV versions. - **Time gap.** A CV release between the two captures can shift specific metrics — release notes call out which. - **Different image resolutions.** Resolution affects every metric, so the same scene captured at different resolutions gives slightly different scores. For the same image, components, and CV version, results are expected to be the same, or to differ only minimally. If you see clearly different results for identical requests, report it to Revieve. ## What you control - **Capture conditions** — give users live coaching (a head outline, light meter, distance hint). - **Component list** — narrowest set that surfaces what your UI renders. Smaller component lists mean faster responses. Keep the list the same between calls whose scores you compare. - **Retry UX** — when `data.message: "Error"`, show the `description` of the first `status[]` entry with `isError: 1` and re-capture rather than failing silently. - **Defensive rendering** — hide the cards whose `local_warnings[]` indicates the metric was unusable; render the ones that succeeded. ## Related - **[Status codes](/concepts/status-codes/)** — full reference for every `idx` value. - **[Error handling](/guides/error-handling/)** — the HTTP- vs document-level model and a defensive client. - **[Pore dilation](/concepts/pore-dilation/)** — why this metric benefits from higher resolution. --- ## Concepts Source: src/content/docs/concepts/index.mdx > What each skin, makeup, and hair metric actually measures, what the API returns, and how to render it. import { LinkCard, CardGrid } from "@astrojs/starlight/components"; This section is the *visual* counterpart to the OpenAPI reference. The reference tells you the field names; concept pages tell you what those fields *mean* — clinically, visually, and as data on a face. Every concept page follows the same shape: 1. **Overview** — definition in beauty / dermatology terms. 2. **Machine-readable summary** — one fenced YAML block with request, response path, value range, related components. 3. **Visualization example** — the metric's visualization data drawn on a model photo, with the code that draws it, where data is available. 4. **Rendering notes** — how to turn data into a UI affordance. 5. **Edge cases and `local_warnings[]`** — known footguns and the metric-specific status codes. ## Start with ## Skin ## Composite findings ## Partner composite scores ## Visualization ## Reference --- ## Wrinkles Source: src/content/docs/concepts/wrinkles.mdx > Per-region wrinkle severity (0..1) returned as polyline features — point-by-point coordinates per detected line — with a length × intensity composite for ranking. import VisualizationExample from "../../../components/VisualizationExample.astro"; ## Overview Wrinkles measures the visible depth, count, and distribution of lines on the face. The `value` is a normalized severity score; `wrinkles_visualization` returns one **polyline feature per detected line** — `x[]` / `y[]` arrays of point coordinates that draw the actual line back onto the source image, plus per-point and aggregate intensity values. ```yaml component: wrinkles request: query: "components=wrinkles,wrinkles_visualization" response_path: "results[].description == \"wrinkles\"" value_range: [0, 1] also_request: - wrinkles_visualization # polyline features, one per detected line warnings: [] # no wrinkles-specific codes; see local_warnings below ``` ## Sub-region locations Within the single `wrinkles` finding, `measurement_locations[]` carries one entry per face sub-region (**12 in total**) — you receive these descriptions verbatim and can style different sub-regions differently: | `measurement_locations[].description` | Region | `ut_zone` | |---|---|---| | `forehead worry lines` | Horizontal lines across the forehead. | `t-zone` | | `between-brows frown lines` | Glabellar / "11" lines. | `t-zone` | | `noseline bunny lines` | Wrinkles across the nose bridge. | `t-zone` | | `left side eye crow's feet` / `right side eye crow's feet` | Lines radiating from the outer corner of the eye. | `none` | | `left side tearline` / `right side tearline` | Lines below the inner corner of the eye. | `none` | | `left side nasolabial line` / `right side nasolabial line` | Nasolabial folds. | `u-zone` | | `left side marionette line` / `right side marionette line` | Marionette lines from mouth corners. | `u-zone` | | `vertical lip lines` | Lines around the lips. | `t-zone` | The `ut_zone` tags are set from 3.30.0 (currently in the test environment only). In 3.29.1, every wrinkles location reports `"none"`. See [Sub-areas](/concepts/sub-areas/) for how `ut_zone` works. These are descriptions on the same finding, **not** separate top-level metrics — there's no `nasolabial_folds` or `crows_feet` component to request. Each entry also carries its own per-region score — `value` (0..1 severity for that sub-region), a deprecated `value_raw`, and a `Wrinkle intensity` sub-measure in `measures[]` — so you can surface region-level scores, not just the aggregate `value` on the finding. ## Visualization example ```js title="metrics/wrinkles.js" // Requires render.js and polylines.js from /demos/recipes/ (or revieve-render.js). // ctx: 2D context of a canvas sized to the analysed image. response: parsed analyzeImage JSON. // Wrinkles: one polyline per line. Magenta reads on every skin tone and is not a colour skin ever has. renderMetric(ctx, response, "wrinkles", { draw: drawPolyline, color: "#DD33FF", strokeWidth: 3, }); ``` ## Rendering notes For a numeric UI: ```js const w = response.results.find((r) => r.description === "wrinkles"); const score = Math.round(w.value * 100); ``` For drawing the lines themselves, request `wrinkles_visualization` and iterate. Each `visualization_data[]` feature is a **polyline** — `x[]` and `y[]` are arrays of length N covering the points along one detected line: ```js for (const loc of w.measurement_locations ?? []) { // The location's description (e.g. "left side nasolabial line") // tells you which face region this group of lines belongs to — // useful for region-specific styling. for (const line of loc.visualization_data ?? []) { // line.x and line.y are length-N arrays // line.intensity is an array of per-point intensities // line.length_weighted_intensity is a composite ranking value // line.length is the point count; line.mean_intensity / line.median_intensity are summary stats drawPolyline(ctx, line, line.length_weighted_intensity, { color: "#DD33FF" }); } } ``` Three details that matter for polylines: 1. **Decimate dense lines.** A wrinkle feature can carry hundreds of points. Keep every Nth point above a threshold — every 3rd above 20 is a workable default. Visually identical, much cheaper. 2. **`length_weighted_intensity`** is the canonical "how bad is this wrinkle" composite — combines line length with per-point intensity. Sort features descending by it to surface the worst N findings. 3. **Stroke style.** A 1–2 px stroke at low opacity reads better than a hard line. Paste-ready code: [Rendering recipes → Polylines](/guides/rendering-recipes/#recipe-2--polylines). ## Edge cases - **Male users.** For male users — `gender=male`, or `gender=unknown` when the analysis estimates the user as male — the beard-area regions (`left side marionette line`, `right side marionette line`, `vertical lip lines`) return `value: null` (with null `visualization_data` and a null `Wrinkle intensity`). Skip null entries when iterating `measurement_locations[]`. - **Smiling expressions** dynamically increase apparent wrinkle count. Capture in a neutral expression for trend tracking. - **Heavy makeup** reduces wrinkle visibility. The API does not detect whether makeup is worn, so show a standing "based on visible skin" disclaimer rather than conditioning it on a makeup signal. - **Low resolution** reduces line-finding precision. `wrinkles` adds no threshold of its own beyond the API-wide resolution floors — see [Image quality → Resolution](/guides/image-quality/#resolution). ## `local_warnings[]` The `wrinkles` metric emits no metric-specific `local_warnings[]` codes. Global status codes still apply; see [Status codes](/concepts/status-codes/). ## Related - **[Visualization data](/concepts/visualization/)** — Cat D (AOI + mask + advanced); polyline-type features with per-point intensities and the `length_weighted_intensity` composite. - **[Rendering recipes → Polylines](/guides/rendering-recipes/#recipe-2--polylines)** — paste-ready renderer with the dense-point decimation pattern. - **[Sub-area divisions](/concepts/sub-areas/)** — wrinkles uses a custom division (the sub-regions listed above), not the standard primary or alternative face splits. --- ## Redness Source: src/content/docs/concepts/redness.mdx > Erythema scoring (0..1) per face region, with mask shapes and a polygon-area visualization channel. import VisualizationExample from "../../../components/VisualizationExample.astro"; import { Aside } from "@astrojs/starlight/components"; ## Overview Redness metric responds to variations of the amount of red color (caused by e.g. local inflammation) in the skin disregarding the base skin tone. ```yaml component: redness request: query: "components=redness" response_path: "results[].description == \"redness\"" value_range: [0, 1] # normalized severity also_request: - redness_visualization # polygon-area features, 3 intensity levels by default - redness_absolute # alternative overall score (top-level value only) warnings: [] # redness emits no metric-specific codes ``` ## What the API returns Request the component: ```http ?components=redness ``` The corresponding entry in `results[]`: ```jsonc { "description": "redness", "value": 0.18, // 0..1, normalized severity "message": "Ok", "local_warnings": [], "measurement_locations": [ { "description": "left cheek", "value": 0.21, "AOI_x_o": 412, "AOI_y_o": 580, "AOI_radius_o": 90, "ut_zone": "u-zone" }, { "description": "right cheek", "value": 0.19, "..." }, { "description": "forehead", "value": 0.11, "..." } // …11 regions in total (cheeks, forehead, nose, chin, around-mouth, around/under-eye). // A region that isn't analyzed returns value -1. // The overall score is the top-level `value` — there is no "Global" region entry. ], "sum_measures": [] } ``` If you also request `redness_visualization`, you get a `visualization_data[]` array of **polygon-area features** with 3 intensity levels by default (per-feature `intensity` is a category integer `1..3`, not a continuous score). Higher-intensity polygons sit *inside* lower-intensity ones — render with low opacity and the layering produces a heatmap-like gradient. See [Rendering recipes → Polygon areas](/guides/rendering-recipes/#recipe-3--polygon-areas). `redness_absolute` is a variant of this metric on a different output scale, provided for integrations set up with it. Use `redness` unless Revieve has configured your integration otherwise; see [Metric variants](/concepts/metric-relationships/#metric-variants). It returns only the top-level `value`: no regions, mask shapes, or visualization data. ## Visualization example ```js title="metrics/redness.js" // Requires render.js and polygon-areas.js from /demos/recipes/ (or revieve-render.js). // ctx: 2D context of a canvas sized to the analysed image. response: parsed analyzeImage JSON. // Redness: polygon areas at levels 1..3, drawn low to high so higher levels sit on top; the level shows as a denser fill of the same colour. renderMetric(ctx, response, "redness", { draw: drawPolygonArea, colorForLevel: () => "#3377FF", // one colour, outside the skin-tone gamut opacityForLevel: (level) => [0.12, 0.22, 0.32][level - 1] ?? 0.32, // the level is the fill density }); ``` ## Rendering notes For a numeric UI: ```js const redness = response.results.find((r) => r.description === "redness"); const score = Math.round(redness.value * 100); // 0..100 ``` For a regional breakdown: ```js const regions = redness.measurement_locations .filter((m) => m.value >= 0) // skip unavailable regions (value -1) .sort((a, b) => b.value - a.value); ``` For a heatmap-style overlay: 1. Request `redness_visualization` alongside `redness`. 2. Sort `visualization_data[]` ascending by `intensity` (categorical 1..3). 3. For each feature, fill the polygon defined by its `x[]` / `y[]` arrays with a colour outside the skin-tone gamut (the recipes use blue), at a low opacity that rises with the level (0.12, 0.22, 0.32), with a 2 px outline in the same colour. Warm colours fuse into light skin and read as the condition itself. 4. Higher-intensity polygons naturally render on top, producing a layered gradient. 5. The polygon colours here are ones you choose, so colour balance doesn't apply to them. Only if you also overlay a CV-measured colour (e.g. a skin/foundation swatch) do you re-bias it with [`inverse_color_balance_rb`](/guides/interpreting-results/#inverse_color_balance_rb) so it matches the original photo. Paste-ready code: [Rendering recipes → Polygon areas](/guides/rendering-recipes/#recipe-3--polygon-areas). ## Edge cases - **Heavy makeup** can mask redness, so the score may understate true erythema when coverage products are worn. The API has no makeup-coverage signal to gate on, so surface a "based on visible skin" disclaimer rather than trying to auto-hide. ## `local_warnings[]` for this metric The `redness` metric emits no metric-specific `local_warnings[]` codes; it inherits the global image-quality codes. A region that isn't analyzed returns `value: -1` (no status code). See [Error handling](/guides/error-handling/). --- ## Hyperpigmentation Source: src/content/docs/concepts/hyperpigmentation.mdx > Overall pigmentation score (0..1) with area and spot sub-scores, an adjusted variant and a per-spot visualization channel. import VisualizationExample from "../../../components/VisualizationExample.astro"; import { Aside } from "@astrojs/starlight/components"; ## Overview Hyperpigmentation measures areas of skin that are darker than the surrounding tissue — sun damage, post-inflammatory marks, melasma overlap, age spots. The finding also returns two sub-scores in `sum_measures`: a diffuse `area` component and a discrete dark-`spot` component. `hyperpigmentation_adjusted` is an alternative overall pigmentation score, calculated differently from `hyperpigmentation` (see [Choosing metrics](/concepts/metric-relationships/)). The visualization channel returns **spot-type features** — one feature per detected pigmented spot, suitable for marker overlays. ```yaml component: hyperpigmentation request: query: "components=hyperpigmentation,hyperpigmentation_adjusted,hyperpigmentation_visualization" response_path: "results[].description == \"hyperpigmentation\"" value_range: [0, 1] also_request: - hyperpigmentation_adjusted # alternative overall score - hyperpigmentation_visualization # spot-type features, intensity range [0..400] warnings: [401] ``` ## Visualization example ```js title="metrics/hyperpigmentation.js" // Requires render.js and spots.js from /demos/recipes/ (or revieve-render.js). // ctx: 2D context of a canvas sized to the analysed image. response: parsed analyzeImage JSON. // Hyperpigmentation: spots, drawn as boxes (same family as dark spots). renderMetric(ctx, response, "hyperpigmentation", { draw: drawSpot, style: "box", color: "#DD33FF", }); ``` ## When to use which variant | Goal | Use | | ----------------------------------------------------------- | ----------------------------- | | User-relative dashboard ("your level vs. last month") | `hyperpigmentation` | | Integrations set up with the variant ([Metric variants](/concepts/metric-relationships/#metric-variants)) | `hyperpigmentation_adjusted` | | Per-spot marker rendering on the face | `hyperpigmentation_visualization` | ## Rendering notes ```js const hp = response.results.find((r) => r.description === "hyperpigmentation"); const score = Math.round(hp.value * 100); ``` Beyond the top-level `value`, the finding exposes two `sum_measures` — `area` (diffuse pigmentation) and `spot` (discrete dark spots), each `0..1`. Each `measurement_locations[]` entry carries the same `area` / `spot` measures plus its own `value` and `mask_shapes`. When a region's mask can't be sampled, that region signals unavailability in two different ways — guard for both: - its `area` and `spot` **measures** come back as **`-1`**; - the region's own **`value`** comes back as **`null`**, not `-1`. Either way it means "region unavailable," not a real low score. (The standalone [`melasma`](/concepts/melasma/), [`freckles`](/concepts/freckles/) and [`dark_spots`](/concepts/dark-spots/) metrics are simpler here — their region `value` is `-1` in the same situation.) For per-spot markers, iterate each measurement location's `visualization_data[]` (each feature is a single spot — `length: 1`, `x[0]` / `y[0]` is the centroid, `intensity` is the feature's severity in `[0..400]`). The marker colours are ones you choose, so colour balance doesn't apply to them; only re-bias a CV-measured colour with [`inverse_color_balance_rb`](/guides/interpreting-results/#inverse_color_balance_rb) if you overlay one. Paste-ready: [Rendering recipes → Spots](/guides/rendering-recipes/#recipe-1--spots). `hyperpigmentation_visualization` contains only the dark-spot features. Its default threshold can differ from that of `dark_spots_visualization`; when both are requested, they match. ## `local_warnings[]` Inherits global image-quality codes. Region-mask failures surface as `idx: 401`. ## Related - **Standalone pigmentation metrics:** [`melasma`](/concepts/melasma/), [`freckles`](/concepts/freckles/), [`dark_spots`](/concepts/dark-spots/). - **[Choosing metrics](/concepts/metric-relationships/)** — `hyperpigmentation_adjusted` is covered under Metric variants. - **[Visualization data](/concepts/visualization/)** — Cat D (AOI + mask + advanced); spot-type features, intensity range `[0..400]`. - **[Rendering recipes → Spots](/guides/rendering-recipes/#recipe-1--spots)** — paste-ready dot / box / cross renderers. --- ## Acne Source: src/content/docs/concepts/acne.mdx > Acne severity (0..1) with a per-lesion visualization channel. import VisualizationExample from "../../../components/VisualizationExample.astro"; import { Aside } from "@astrojs/starlight/components"; ## Overview Acne measures the presence and severity of inflammatory and non-inflammatory lesions — papules, pustules, comedones — across the face. The `value` is a normalized score; `acne_visualization` returns per-lesion intensities suitable for marker overlays. ```yaml component: acne request: query: "components=acne,acne_visualization" response_path: "results[].description == \"acne\"" value_range: [0, 1] also_request: - acne_visualization # per-lesion spots, intensity [0..2500] - acne_normalized_visualization # same spots, intensity [0..1] warnings: [401, 3000] ``` ## Visualization example ```js title="metrics/acne.js" // Requires render.js and spots.js from /demos/recipes/ (or revieve-render.js). // ctx: 2D context of a canvas sized to the analysed image. response: parsed analyzeImage JSON. // Acne: spots, drawn as dots. Each feature is one lesion. renderMetric(ctx, response, "acne", { draw: drawSpot, style: "dot", color: "#DD33FF", }); ``` ## Rendering notes ```js const acne = response.results.find((r) => r.description === "acne"); const score = Math.round(acne.value * 100); // Per-lesion markers — visualization_data lives on each measurement_locations[] // entry, not on the finding directly. Each feature is a "spot" type: // length-1 x[] and y[] arrays, intensity is a one-element array (use mean_intensity). const lesions = (acne.measurement_locations ?? []).flatMap( (loc) => loc.visualization_data ?? [] ); ``` Spot-type features render naturally as a dot marker. A common style is **two concentric circles** (a 6 px filled disc inside a 12 px stroke ring); square outlines or crosses also work. The response also carries a `Spots number` sum-measure (raw count of detected spots), but avoid surfacing it as a clinical "active acne" count — the `value` is a severity score, not a lesion count, and the count itself is sensitive to image quality. Paste-ready code: [Rendering recipes → Spots](/guides/rendering-recipes/#recipe-1--spots). ## Edge cases - **`acne` aborts on some global image-quality warnings.** Unlike other metrics, it will not return a score when the image carries `204`, `312`, `313`, `314` or `319` — see the `local_warnings[]` section below. ## `local_warnings[]` `idx: 3000` (error) — acne measurement aborted due to image quality concerns. `acne` is stricter than the other metrics about image quality. Five codes that are only *warnings* at the response level cause acne to abort: `204` (face detection very uncertain), `312` (unsymmetric exposure), `313` (hard shadows), `314` (eyeglasses detected) and `319` (face too tightly framed). When one of them is present: - acne returns no score — `value` is `null` and `message` is `"Error"`; - `3000` is added to the finding's `local_warnings[]`; - the triggering code is **also** copied into `local_warnings[]` with its `isError` raised to `1`, even though the same code appears in the top-level `status[]` as a warning (`isError: 0`). So don't be surprised to see the same `idx` with a different `isError` in the two places — inside the acne finding it means "this blocked acne", at the top level it means "this is a quality warning for the image". Every other requested metric still returns normally. ## Related - **[Visualization data](/concepts/visualization/)** — Cat D (AOI + mask + advanced); spot-type features. Intensity range `[0..2500]` (`[0..1]` with `acne_normalized_visualization`). - **[Rendering recipes → Spots](/guides/rendering-recipes/#recipe-1--spots)** — paste-ready dot / box / cross renderers. --- ## Texture Source: src/content/docs/concepts/texture.mdx > Surface roughness (texture, 0..1) with a polygon-area visualization channel. import VisualizationExample from "../../../components/VisualizationExample.astro"; ## Overview Texture measures small-scale surface roughness of the skin. ```yaml component: texture request: query: "components=texture,texture_visualization" response_path: "results[].description == \"texture\"" value_range: [0, 1] also_request: - texture_visualization # polygon-area features, 2 intensity levels by default warnings: [] # texture emits no metric-specific codes ``` ## Visualization example ```js title="metrics/texture.js" // Requires render.js and polygon-areas.js from /demos/recipes/ (or revieve-render.js). // ctx: 2D context of a canvas sized to the analysed image. response: parsed analyzeImage JSON. // Texture: polygon areas, levels 1..3 as a ramp. renderMetric(ctx, response, "texture", { draw: drawPolygonArea, colorForLevel: () => "#3377FF", // one colour, outside the skin-tone gamut opacityForLevel: (level) => [0.12, 0.22, 0.32][level - 1] ?? 0.32, // the level is the fill density }); ``` ## Rendering notes ```js const tex = response.results.find((r) => r.description === "texture"); ``` Beyond the top-level `value`, `texture` returns a per-region breakdown in `measurement_locations[]` — one entry per face region, each with its own `value` (`0..1`), `mask_shapes` (with the `masks` component), and polygon-area `visualization_data` (with `texture_visualization`). Some regions may not be analyzed for every face. Such a region returns **`value: -1`** with null `mask_shapes` and no visualization data — treat it as "region unavailable," not a real low score, and skip it when rendering or averaging. ## Edge cases - Recommend high-quality capture since texture analysis relies on high image resolution and low amount of filtering. ## `local_warnings[]` The `texture` metric emits no metric-specific `local_warnings[]` codes; it inherits the global image-quality codes. A region that isn't analyzed returns `value: -1` (no status code). ## Related - **[Choosing metrics](/concepts/metric-relationships/)** — `texture` is standalone; `smoothness` (a separate metric) is the inverse of `uneven_skin_tone`. - **[Visualization data](/concepts/visualization/)** — Cat D (AOI + mask + advanced); 2 intensity levels by default. - **[Rendering recipes → Polygon areas](/guides/rendering-recipes/#recipe-3--polygon-areas)** — paste-ready renderer. --- ## Shine Source: src/content/docs/concepts/shine.mdx > Surface shine — combined diffuse sheen and specular highlights — per zone (0..1), with a polygon-area visualization channel for oiliness and glossiness UX. import VisualizationExample from "../../../components/VisualizationExample.astro"; ## Overview Shine measures visible surface shine on the face — the glossiness from sebum, sweat, or product. It reflects both **diffuse sheen** and **specular highlights**, which are also reported separately in `sum_measures`. Higher values typically indicate the T-zone (forehead, nose), and the per-zone values are what to surface if you drive routine recommendations from shine. ```yaml component: shine request: query: "components=shine,shine_visualization" response_path: "results[].description == \"Skin shine\"" # NOTE: request component is `shine`, response description is `Skin shine` value_range: [0, 1] also_request: - shine_visualization # polygon-area features, 4 categories: low-diffuse, high-diffuse, low-specular, high-specular warnings: [] # shine emits no metric-specific codes ``` ## Visualization example ```js title="metrics/shine.js" // Requires render.js and polygon-areas.js from /demos/recipes/ (or revieve-render.js). // ctx: 2D context of a canvas sized to the analysed image. response: parsed analyzeImage JSON. // Shine: the response description is "Skin shine". Its four levels are categories // (low/high diffuse, low/high specular), not a severity ramp, so give each its own colour. renderMetric(ctx, response, "Skin shine", { draw: drawPolygonArea, colorForLevel: (level) => ["#149CB8", "#3377FF", "#DD33FF", "#14B814"][level - 1] ?? "#14B814", // categories: low diffuse, high diffuse, low specular, high specular opacity: 0.25, }); ``` ## Rendering notes ```js // Request component is `shine`, but the response finding's description is "Skin shine". const shine = response.results.find((r) => r.description === "Skin shine"); // Per-zone entries are "t-zone" and "u-zone". The "Global" entry has value: null — // it only carries whole-face visualization data. The whole-face score is shine.value. const byZone = Object.fromEntries( shine.measurement_locations .filter((m) => m.description !== "Global") .map((m) => [m.description, m.value]), ); ``` Beyond the top-level `value`, the finding exposes three `sum_measures` — `Diffuse shine`, `Specular shine`, and `Specular shine intensity` — so you can separate matte sheen from sharp specular hotspots when driving recommendations. From 3.30.0 (currently in the test environment only), the `t-zone` and `u-zone` entries also carry `Diffuse shine` and `Specular shine` in their `measures[]`, so you can make the same split per zone. The `Global` entry doesn't carry them: the whole-face values are the `sum_measures`. The `ut_zone` field on each measurement location distinguishes `t-zone` from `u-zone` — useful for routine personalization (oily T-zone vs. dry U-zone). For visualization, the `Global` entry carries the whole-face polygons, and the `t-zone` / `u-zone` entries carry the same polygons cut to each zone (the zones overlap, e.g. at the chin). Draw from `Global` only — or from the zones only — not from every entry. ## Edge cases - **Direct flash** dramatically inflates shine scores. Diffuse light is critical. - **Sweat or recently-applied product** reads as shine. ## `local_warnings[]` The shine metric emits no metric-specific `local_warnings[]` codes; it inherits the global image-quality codes. ## Related - **[Visualization data](/concepts/visualization/)** — Cat D (AOI + mask + advanced); 4 fixed categories with special meanings: low/high diffuse shine, low/high specular shine. - **[Rendering recipes → Polygon areas](/guides/rendering-recipes/#recipe-3--polygon-areas)** — paste-ready renderer. --- ## Glow Source: src/content/docs/concepts/glow.mdx > Skin glow — a whole-face score and per-zone scores (0..1), with a two-level polygon-area visualization channel. import { Aside } from "@astrojs/starlight/components"; import VisualizationExample from "../../../components/VisualizationExample.astro"; ## Overview Skin glow measure. The `value` is a 0..1 score — higher means more and stronger glow property of the skin. Besides the whole-face score, the finding reports a score for the `t-zone` and the `u-zone`. ```yaml component: glow request: query: "components=glow,glow_visualization" response_path: "results[].description == \"glow\"" value_range: [0, 1] also_request: - glow_visualization # polygon-area features, 2 levels: low and high highlights warnings: [] # glow emits no metric-specific codes ``` ## Visualization example ```js title="metrics/glow.js" // Requires render.js and polygon-areas.js from /demos/recipes/ (or revieve-render.js). // ctx: 2D context of a canvas sized to the analysed image. response: parsed analyzeImage JSON. // Glow: polygon areas at levels 1..2 (low, high), drawn low to high so level 2 sits on top. renderMetric(ctx, response, "glow", { draw: drawPolygonArea, colorForLevel: () => "#3377FF", // one colour, outside the skin-tone gamut opacityForLevel: (level) => [0.15, 0.3][level - 1] ?? 0.3, // the level is the fill density }); ``` ## Rendering notes ```js // Request component and response description are both `glow`. const glow = response.results.find((r) => r.description === "glow"); // Per-zone entries are "t-zone" and "u-zone". The "Global" entry has value: null — // it only carries whole-face visualization data. The whole-face score is glow.value. const byZone = Object.fromEntries( glow.measurement_locations .filter((m) => m.description !== "Global") .map((m) => [m.description, m.value]), ); ``` The finding has no `sum_measures`, and its measurement locations carry no `measures[]`: the scores are the top-level `value` and the per-zone `value`s. `glow_visualization` returns polygon areas on two levels: `1` for low and `2` for high. Level `2` areas lie inside level `1` areas, so drawing level `1` first and level `2` on top gives a two-step map. For visualization, the `Global` entry carries the whole-face polygons, and the `t-zone` / `u-zone` entries carry the same polygons cut to each zone (the zones overlap, e.g. at the chin). Draw from `Global` only — or from the zones only — not from every entry. ## Edge cases - **Direct flash** creates strong highlights and dramatically inflates glow scores. Diffuse light is critical. - **Sweat or recently-applied product** can inflate the glow measure. ## `local_warnings[]` The glow metric emits no metric-specific `local_warnings[]` codes; it inherits the global image-quality codes. ## Related - **[Shine](/concepts/shine/)** — surface shine per zone. A separate finding: request `shine` too if you want to show both. - **[Visualization data](/concepts/visualization/)** — Cat D (AOI + mask + advanced); 2 levels: low and high highlights. - **[Rendering recipes → Polygon areas](/guides/rendering-recipes/#recipe-3--polygon-areas)** — paste-ready renderer. --- ## Pore dilation Source: src/content/docs/concepts/pore-dilation.mdx > Visible pore size and density (0..1) with a polygon-area visualization. Requires sufficient face area resolution. import VisualizationExample from "../../../components/VisualizationExample.astro"; import { Aside } from "@astrojs/starlight/components"; ## Overview Pore dilation measures the visible size and density of skin pores — a function of sebum production, age, sun damage, and skin type. The metric is highly sensitive to image resolution; the model returns a status warning when the face area is too small to resolve individual pores reliably. ```yaml component: pore_dilation request: query: "components=pore_dilation,pore_dilation_visualization" response_path: "results[].description == \"pore_dilation\"" value_range: [0, 1] # value is null when analysis is aborted (see below) also_request: - pore_dilation_visualization warnings: [2000, 2001] face_width_px: minimum: 600 # below this -> 2000 (error), analysis aborted, value null full_quality: 1200 # 600-1199 -> 2001 (warning); >=1200 -> no warning ``` ## Visualization example ## Rendering notes ```js const pores = response.results.find((r) => r.description === "pore_dilation"); // The finding is present whenever requested, but `value` is null when the // analysis was aborted (face under 600 px). Guard on the value, not the finding. if (!pores || pores.value == null) { // hide the pores card; surface the resolution warning (2000 / 2001) if present } ``` The visualization channel returns polygon-area features with **2 intensity levels**. Render them like any polygon-area metric — draw each feature's coordinate path, low intensity to high. Paste-ready code: [Rendering recipes → Polygon areas](/guides/rendering-recipes/#recipe-3--polygon-areas). ### Regional breakdown `measurement_locations[]` carries one entry per face zone — `left cheek`, `right cheek`, `forehead left`, `forehead center`, `forehead right`, `nose`, `left lower face`, `right lower face`, `chin` — each with its own `value`, AOI, and mask shapes. The overall `value` is computed from a subset of the most reliable zones, so it is not the average of the regional values; all zones are still returned with their own scores. Some zones may not be analyzed for every face and return **`value: null`**. The entries are still present, so guard per-region as well as at finding level. Note this is `null`, not the `-1` that some other metrics use for an unavailable region. ## Edge cases - **Face width under 600 px** → status `2000`, analysis aborted, `value: null`; treat as "data unavailable" rather than zero. - **Face width 600–1199 px** → status `2001`; scores are returned but flagged unreliable. - **Smoothing / beauty filters applied client-side** remove the fine detail the metric measures, so scores drop toward zero regardless of the user's actual pores. - **Heavy foundation** fills and conceals pores, lowering the score. ## `local_warnings[]` - `2000` (error) — face area resolution too low (face width under 600 px); pore analysis aborted, `value` is `null`. - `2001` (warning) — face area resolution low (face width 600–1199 px); results returned via an upsizing fallback and may be unreliable. These are the only codes the metric emits. (The canonical `2000` text reads "…at minimum 1200 pixels wide," which the spec marks as outdated — the effective floor is 600 px.) ## Related - **[Visualization data](/concepts/visualization/)** — Cat D (AOI + mask + advanced); 2 intensity levels by default. - **[Rendering recipes → Polygon areas](/guides/rendering-recipes/#recipe-3--polygon-areas)** — paste-ready polygon-area renderer. --- ## Melasma Source: src/content/docs/concepts/melasma.mdx > Detection of larger, irregular pigmentation patches, distinct from discrete dark spots. 0..1 normalized score with mask overlays. import VisualizationExample from "../../../components/VisualizationExample.astro"; ## Overview Melasma is a specific type of hyperpigmentation that presents as larger, irregular patches — typically on cheeks, forehead, and upper lip. ```yaml component: melasma request: query: "components=melasma,melasma_visualization" response_path: "results[].description == \"melasma\"" value_range: [0, 1] also_request: - melasma_visualization # polygon-area features, 3 intensity levels by default warnings: [] # melasma emits no metric-specific codes ``` ## Visualization example ```js title="metrics/melasma.js" // Requires render.js and polygon-areas.js from /demos/recipes/ (or revieve-render.js). // ctx: 2D context of a canvas sized to the analysed image. response: parsed analyzeImage JSON. // Melasma: polygon areas, levels 1..3 as a ramp. renderMetric(ctx, response, "melasma", { draw: drawPolygonArea, colorForLevel: () => "#3377FF", // one colour, outside the skin-tone gamut opacityForLevel: (level) => [0.12, 0.22, 0.32][level - 1] ?? 0.32, // the level is the fill density }); ``` ## Rendering notes ```js const m = response.results.find((r) => r.description === "melasma"); ``` When both `hyperpigmentation` and `melasma` register, surface them as separate findings — they trigger different product categories (sunscreen + tranexamic acid for melasma vs. vitamin C / retinoid for general pigment). Melasma also returns a per-region breakdown in `measurement_locations[]` — one entry per face region, each with its own `value` (`0..1`), `mask_shapes`, and (when `melasma_visualization` is requested) polygon-area `visualization_data`. A region that isn't analyzed returns **`value: -1`** — treat that as "region unavailable," not a real low score. ## `local_warnings[]` The `melasma` metric emits no metric-specific `local_warnings[]` codes. It inherits global image-quality codes; a skin-mask sampling failure is reported as `401` on the `hyperpigmentation` finding, not on `melasma`. ## Related - **[Visualization data](/concepts/visualization/)** — Cat D (AOI + mask + advanced); 3 intensity levels. Per-feature `intensity` is a level index `1..3`, not a continuous score. - **[Rendering recipes → Polygon areas](/guides/rendering-recipes/#recipe-3--polygon-areas)** — paste-ready renderer. --- ## Freckles Source: src/content/docs/concepts/freckles.mdx > Discrete small-pigment-spot detection (0..1 score) with per-spot coordinates for marker rendering. import VisualizationExample from "../../../components/VisualizationExample.astro"; ## Overview Freckles measures discrete, small, round pigment spots — distinct from larger melasma patches and considered generally smaller than dark spots. ```yaml component: freckles request: query: "components=freckles,freckles_visualization" response_path: "results[].description == \"freckles\"" value_range: [0, 1] also_request: - freckles_visualization # per-spot coordinates and intensities warnings: [] # freckles emits no metric-specific codes ``` ## Visualization example ```js title="metrics/freckles.js" // Requires render.js and spots.js from /demos/recipes/ (or revieve-render.js). // ctx: 2D context of a canvas sized to the analysed image. response: parsed analyzeImage JSON. // Freckles: one spot per feature. Dots are the recommended marker for freckles and acne. renderMetric(ctx, response, "freckles", { draw: drawSpot, style: "dot", color: "#DD33FF", }); ``` ## Rendering notes ```js const fr = response.results.find((r) => r.description === "freckles"); // visualization_data lives on each measurement_locations[] entry. // Each feature is a "spot": length-1 x[]/y[] arrays, intensity is a one-element array (use mean_intensity). const markers = (fr.measurement_locations ?? []).flatMap( (loc) => loc.visualization_data ?? [] ); ``` Use small dots for markers — large overlays read as alarming on what is often a desirable trait. Consider opt-in toggling rather than always-on display. Paste-ready: [Rendering recipes → Spots](/guides/rendering-recipes/#recipe-1--spots). Each `measurement_locations[]` entry also carries its own per-region `value` (`0..1`) alongside its `mask_shapes` and spot `visualization_data`. A region that isn't analyzed returns **`value: -1`** — treat that as "region unavailable," not a real low score. ## Edge cases - **Cultural/aesthetic context matters** — many users do not consider freckles a "concern." Default to neutral copy in the UI. ## `local_warnings[]` The `freckles` metric emits no metric-specific `local_warnings[]` codes. It inherits global image-quality codes; a skin-mask sampling failure is reported as `401` on the `hyperpigmentation` finding, not on `freckles`. ## Related - **[Visualization data](/concepts/visualization/)** — Cat D (AOI + mask + advanced); spot-type features, intensity range `[0..400]`. - **[Rendering recipes → Spots](/guides/rendering-recipes/#recipe-1--spots)** — concentric-circle dots are the recommended marker style. --- ## Dark spots Source: src/content/docs/concepts/dark-spots.mdx > Larger, distinct, deeper-pigmented spots (0..1) — distinct from freckles and from diffuse hyperpigmentation. Includes an adjusted variant. import VisualizationExample from "../../../components/VisualizationExample.astro"; ## Overview Dark spots picks up deeper-pigmented marks — sun spots, age spots, post-inflammatory hyperpigmentation. Larger than freckles; more discrete than melasma patches. ```yaml component: dark_spots request: query: "components=dark_spots,dark_spots_adjusted,dark_spots_visualization" response_path: "results[].description == \"dark_spots\"" value_range: [0, 1] also_request: - dark_spots_adjusted # alternative overall score (top-level value only) - dark_spots_visualization # spot-type features, intensity range [0..400] warnings: [] # dark_spots emits no metric-specific codes ``` ## Visualization example ```js title="metrics/dark-spots.js" // Requires render.js and spots.js from /demos/recipes/ (or revieve-render.js). // ctx: 2D context of a canvas sized to the analysed image. response: parsed analyzeImage JSON. // Dark spots: spots, drawn as boxes so they read differently from acne dots. renderMetric(ctx, response, "dark_spots", { draw: drawSpot, style: "box", color: "#DD33FF", }); ``` ## Rendering notes ```js const ds = response.results.find((r) => r.description === "dark_spots"); // visualization_data lives on each measurement_locations[] entry, not on the // top-level finding. Each feature is a "spot": length-1 x[]/y[] arrays. const markers = (ds.measurement_locations ?? []).flatMap( (loc) => loc.visualization_data ?? [] ); ``` For "treat these specific spots" UIs, render those markers prominently. For routine recommendations, the aggregate `value` is enough. Each `measurement_locations[]` entry also carries its own per-region `value` (`0..1`) alongside its `mask_shapes`. A region that isn't analyzed returns **`value: -1`** — treat that as "region unavailable," not a real low score. ## Edge cases - Distinction between **Freckles** and darks spots can be partially overlapping in some cases. ## `local_warnings[]` The `dark_spots` metric emits no metric-specific `local_warnings[]` codes. It inherits global image-quality codes; a skin-mask sampling failure is reported as `401` on the `hyperpigmentation` finding, not on `dark_spots`. ## Related - **[Visualization data](/concepts/visualization/)** — Cat D (AOI + mask + advanced); spot-type features, intensity range `[0..400]`. - **[Rendering recipes → Spots](/guides/rendering-recipes/#recipe-1--spots)** — box outlines are the recommended marker; dot or cross styles also work. --- ## Dull skin Source: src/content/docs/concepts/dull-skin.mdx > Dullness severity (0..1) derived from the shine analysis. Whole-face score, no visualization. ## Overview Dull skin measures the absence of natural luminosity. The score is derived from the `shine` analysis. ```yaml component: dull_skin request: query: "components=dull_skin" response_path: "results[].description == \"dull_skin\"" value_range: [0, 1] # -1 when unavailable warnings: [] # dull_skin emits no metric-specific codes ``` ## Rendering notes ```js const dull = response.results.find((r) => r.description === "dull_skin"); ``` `dull_skin` doesn't have a visualization channel — it's a whole-face score. Surface it as a single dial or score, not a heatmap. When the underlying analysis is unavailable, `dull_skin` returns `-1` instead of a real score. Guard for it (e.g. `dull.value >= 0`) and show an "n/a" treatment rather than a bogus dial. ## Edge cases - **Foundation and finishing products** change how much light the skin surface returns, so they move the score — the reading reflects the product on the skin as much as the skin itself. Ask users to capture bare-faced for trend tracking. ## `local_warnings[]` The `dull_skin` metric emits no metric-specific `local_warnings[]` codes; it inherits the global image-quality codes. ## Related - **[Radiance](/concepts/radiance/)** — a separate score; it also uses the `shine` analysis but is not the inverse of `dull_skin`. - **[Choosing metrics](/concepts/metric-relationships/)** — `dull_skin` is derived from `shine`. - **[Visualization data](/concepts/visualization/)** — Cat A (no spatial output). No per-feature data, no AOIs, no mask shapes. UI should be a single dial / number, never a face overlay. --- ## Radiance Source: src/content/docs/concepts/radiance.mdx > Radiance score (0..1, a smoothness + shine combination) and its variant radiance_adjusted. Whole-face scores, no visualization. ## Overview Radiance is a score that combines `smoothness` and `shine`. `radiance_adjusted` is a variant of this metric on a different output scale, provided for integrations set up with it. Use `radiance` unless Revieve has configured your integration otherwise; see [Metric variants](/concepts/metric-relationships/#metric-variants). ```yaml component: radiance components: - radiance - radiance_adjusted request: query: "components=radiance,radiance_adjusted" response_path: - "results[].description == \"radiance\"" - "results[].description == \"radiance_adjusted\"" value_range: [0, 1] # null when unavailable warnings: [] # these metrics emit no metric-specific codes ``` ## Rendering notes ```js const radiant = response.results.find((r) => r.description === "radiance"); ``` These metrics don't have a visualization channel — they're whole-face scores. Surface as a single dial or score, not a heatmap. When the underlying analysis is unavailable, `radiance` and `radiance_adjusted` return `null` instead of a real score. Guard for it (e.g. `radiant.value != null`) and show an "n/a" treatment rather than a bogus dial. ## Edge cases - **Foundation and finishing products** change how much light the skin surface returns, so they move these scores — the reading reflects the product on the skin as much as the skin itself. Ask users to capture bare-faced for trend tracking. ## `local_warnings[]` These metrics emit no metric-specific `local_warnings[]` codes; they inherit the global image-quality codes. ## Related - **[Dull skin](/concepts/dull-skin/)** — a separate dullness score derived from `shine`; radiance is not its inverse. - **[Uneven skin tone and smoothness](/concepts/uneven-skin-tone/)** — `smoothness`, one of the radiance inputs. - **[Choosing metrics](/concepts/metric-relationships/)** — `radiance` combines `smoothness` + `shine`. - **[Visualization data](/concepts/visualization/)** — Cat A (no spatial output). No per-feature data, no AOIs, no mask shapes. UI should be a single dial / number, never a face overlay. --- ## Uneven skin tone and smoothness Source: src/content/docs/concepts/uneven-skin-tone.mdx > Variation in skin colour across the face (uneven_skin_tone, 0..1) and its inverse smoothness score, with a polygon-area visualization for "where is the unevenness. import VisualizationExample from "../../../components/VisualizationExample.astro"; ## Overview Uneven skin tone measures how much facial skin colour varies. Analysis includes variations in darkness-lightness and variations of the chromatic nature (blue-yellow / red-green). The metric is sensitive to a large spectrum of spatial scales from the smaller details to smoother trends across larger distances. However, the smallest details covered by the texture metric are not included to the uneven skin tone analysis. Smoothness is its inverse, normalized for "good number goes up" UIs. Both are computed from the same underlying analysis. ```yaml component: uneven_skin_tone components: - uneven_skin_tone - smoothness request: query: "components=uneven_skin_tone,smoothness,uneven_skin_tone_visualization" response_path: - "results[].description == \"uneven_skin_tone\"" - "results[].description == \"smoothness\"" value_range: [0, 1] also_request: - uneven_skin_tone_visualization warnings: [] # these metrics emit no metric-specific codes ``` ## When to use which - **`uneven_skin_tone`** — diagnostic UIs ("where does the tone vary"). - **`smoothness`** — improvement-tracking UIs ("your tone is more even — score increases as condition improves"). Don't surface both in the same UI; users find the inversion confusing. ## Visualization example ```js title="metrics/uneven-skin-tone.js" // Requires render.js and polygon-areas.js from /demos/recipes/ (or revieve-render.js). // ctx: 2D context of a canvas sized to the analysed image. response: parsed analyzeImage JSON. // Uneven skin tone: polygon areas, levels 1..3 as a ramp. renderMetric(ctx, response, "uneven_skin_tone", { draw: drawPolygonArea, colorForLevel: () => "#3377FF", // one colour, outside the skin-tone gamut opacityForLevel: (level) => [0.12, 0.22, 0.32][level - 1] ?? 0.32, // the level is the fill density }); ``` ## Rendering notes ```js const ust = response.results.find((r) => r.description === "uneven_skin_tone"); const sm = response.results.find((r) => r.description === "smoothness"); ``` For an improvement-over-time UI, prefer `smoothness`. For a "where is my tone uneven" diagnostic, prefer `uneven_skin_tone`. This is a complement to `hyperpigmentation` and `dark_spots` — surface them together for a complete pigmentation story. Avoid using all of them as separate dials in the same UI; pick one summary score and put the others in a "details" panel. Beyond the top-level `value`, each finding carries two `sum_measures` — `Luminance variation` and `Chroma variation` (on `smoothness` these read inverted, so a higher number is the better outcome) — plus a per-region breakdown in `measurement_locations[]` (one entry per face region, each with its own `value` and polygon-area `visualization_data`). A region that isn't analyzed returns **`value: -1`** — treat that as "region unavailable," not a real low score. ## Edge cases - **Lighting gradients** (window light from one side) materially elevate this score. Encourage front-on diffuse lighting. ## `local_warnings[]` These metrics emit no metric-specific `local_warnings[]` codes; they inherit the global image-quality codes. A region that isn't analyzed returns `value: -1` (no status code). ## Related - **[Choosing metrics](/concepts/metric-relationships/)** — `smoothness` is the inverse of `uneven_skin_tone` (same analysis). - **[Visualization data](/concepts/visualization/)** — Cat D (AOI + mask + advanced); 2 intensity levels by default (categorical `1..2`). - **[Rendering recipes → Polygon areas](/guides/rendering-recipes/#recipe-3--polygon-areas)** — paste-ready renderer. - **`smoothness` shares this metric's advanced visualization data.** The API has no separate `smoothness_visualization` switch — request `uneven_skin_tone_visualization` and the response carries advanced viz on both metrics. The polygons are the same on both: on `smoothness` they still mark the uneven areas, not inverted ones. --- ## Sagging and firmness Source: src/content/docs/concepts/skin-sagging.mdx > Skin laxity (sagging, 0..1) and the inverse firmness score, with a regional visualization channel. import VisualizationExample from "../../../components/VisualizationExample.astro"; ## Overview Sagging measures visible loss of skin elasticity — most prominent at the jawline, jowls and lower cheek. Firmness is its inverse. Both are computed from the same analysis. Visualization markers identify the regions contributing most to the score. ```yaml component: skin_sagging components: - skin_sagging - skin_firmness request: query: "components=skin_sagging,skin_firmness,skin_sagging_visualization" response_path: - "results[].description == \"skin_sagging\"" - "results[].description == \"skin_firmness\"" value_range: [0, 1] also_request: - skin_sagging_visualization warnings: [3001, 3002, 4000] # 3001/3002 -> skin_sagging, 4000 -> skin_firmness ``` ## When to use which - **`skin_sagging`** — diagnostic UI for anti-aging routines. - **`skin_firmness`** — improvement-over-time UI ("your firmness improved"). ## Visualization example ```js title="metrics/skin-sagging.js" // Requires render.js and polygon-areas.js from /demos/recipes/ (or revieve-render.js). // ctx: 2D context of a canvas sized to the analysed image. response: parsed analyzeImage JSON. // Skin sagging: polygon areas, levels 1..3 as a ramp. renderMetric(ctx, response, "skin_sagging", { draw: drawPolygonArea, colorForLevel: () => "#3377FF", // one colour, outside the skin-tone gamut opacityForLevel: (level) => [0.12, 0.22, 0.32][level - 1] ?? 0.32, // the level is the fill density }); ``` ## Rendering notes ```js const sag = response.results.find((r) => r.description === "skin_sagging"); const firm = response.results.find((r) => r.description === "skin_firmness"); ``` `skin_sagging` returns a single `measurement_locations[]` entry, described as `Global`. It is **not** a region score — its `value` is `null`, and it exists to carry the whole-face `visualization_data`. The score you display is the finding's top-level `value`. The entry is present on every successful run, with an empty `visualization_data` when `skin_sagging_visualization` wasn't requested. This is a slow-changing metric — month-over-month tracking is appropriate; week-over-week noise will dominate signal. ## Edge cases - **`value` is `null` when the analysis fails** — `skin_sagging` then carries `3001` or `3002` (and `skin_firmness` carries `4000`). Render an "n/a" treatment rather than a score. ## `local_warnings[]` - `3001` (error, on `skin_sagging`) — Cannot analyze skin sagging since eyebag analysis had failed. - `3002` (error, on `skin_sagging`) — Cannot analyze skin sagging since wrinkle analysis from required locations had failed. - `4000` (error, on `skin_firmness`) — Skin firmness not analyzed due to error in skin sagging analysis. ## Related - **[Choosing metrics](/concepts/metric-relationships/)** — `skin_firmness` is the inverse of `skin_sagging`; sagging combines `wrinkles` + `eyes`. - **[Visualization data](/concepts/visualization/)** — Cat D− (advanced visualization structure but with simpler outputs — relevant finding-area data only). Polygon-area type, intensity range `[0..1]`. - **[Rendering recipes → Polygon areas](/guides/rendering-recipes/#recipe-3--polygon-areas)** — paste-ready renderer; a neutral white overlay reads better here than the warm-color ramp used elsewhere — the metric is more "regions contributing to the score" than a severity heatmap. --- ## Skin age Source: src/content/docs/concepts/skin-age.mdx > Estimated apparent skin age as an integer 0..100. Distinct from chronological age — derived from visible skin features. import { Aside } from "@astrojs/starlight/components"; ## Overview Skin age estimates the apparent age of the user's skin from visible signs of aging in the face image. It is **not** chronological age — two people of the same chronological age can receive different estimates. ```yaml component: skin_age request: query: "components=skin_age" response_path: "results[].description == \"skin_age\"" value: null # top-level value is unused sum_measures: - skin_age # integer apparent skin age (~0..100) warnings: [7000] ``` ## Rendering notes ```js const age = response.results.find((r) => r.description === "skin_age"); // The integer is in sum_measures (description "skin_age"), not the top-level value. const years = age?.sum_measures.find((m) => m.description === "skin_age")?.value; // integer ~0..100, or null // The sum-measure is present even when the analysis failed (status 7000), // carrying value: null. Guard on the value, not on the measure existing. if (years == null) { // hide the skin-age card } ``` UX considerations: - **Surface with care.** Many users find a high estimate distressing. Pair with copy that emphasizes lifestyle factors and improvement potential. - **Treat it as an estimate, not a measurement.** The result can shift between captures of the same person as lighting, expression and framing change. Establish your own expected variation on your capture flow before you present it as a trackable number. - **Show a range, not a point.** "Your skin reads as 32–35" reads better than "34." ## `local_warnings[]` - `7000` (error) — Skin Age analysis aborted due to image quality concerns or internal error. When `7000` is present the finding is still returned, with `message: "Error"` and the `skin_age` sum-measure carrying `value: null`. Treat the null as "unavailable" rather than assuming the measure is missing. --- ## Skin type Source: src/content/docs/concepts/skin-type.mdx > Categorical skin-type classifier returning an integer 1..8 (in sum_measures) across normal, dry, oily, combination, and sensitive variants. import { Aside } from "@astrojs/starlight/components"; ## Overview Skin type returns a categorical classification — not a `0..1` score. The classification is an integer `1..8` mapping to dermatological skin types and their sensitive variants, useful for routine recommendations. It is returned in **`sum_measures[]`** (description `"skin_type"`) — the finding's top-level `value` is unused. A per-zone breakdown (`t-zone` / `u-zone`) is also returned in `measurement_locations[]`. ```yaml component: skin_type request: query: "components=skin_type,skin_type_visualization" response_path: 'results[].description == "skin_type"' value: null # top-level value is unused sum_measures: - skin_type # integer category 1..8 (see mapping below) measurement_locations: - t-zone # per-zone skin_type + contributing scores - u-zone also_request: - skin_type_visualization # composite polygon-area features: # levels 1-4 = shine data, # levels 5-6 = pore dilation data, # levels 7-9 = redness data warnings: [] # no skin_type-specific status codes ``` ## Value mapping | Value | Type | | ----- | ---------------------- | | 1 | Normal | | 2 | Dry | | 3 | Oily | | 4 | Combination | | 5 | Sensitive | | 6 | Dry sensitive | | 7 | Oily sensitive | | 8 | Combination sensitive | ## Rendering notes Read the integer from `sum_measures[]`, not from `value`: ```js const SKIN_TYPE = { 1: "Normal", 2: "Dry", 3: "Oily", 4: "Combination", 5: "Sensitive", 6: "Dry sensitive", 7: "Oily sensitive", 8: "Combination sensitive", }; const t = response.results.find((r) => r.description === "skin_type"); const skinTypeId = t?.sum_measures.find((m) => m.description === "skin_type")?.value; const label = SKIN_TYPE[skinTypeId]; ``` For routine recommendations, surface the label and pair with `shine`, `texture`, and `pore_dilation` for nuance. ### Per-zone breakdown `measurement_locations[]` carries one entry per face zone — `t-zone` and `u-zone` — each with its own `skin_type` integer (same `1..8` mapping) plus the contributing per-zone scores (`Skin shine`, `pore_dilation`, `redness`, `dull_skin`) in its `measures[]`, and the zone's mask shapes. Use these when you want to show, e.g., an oily T-zone alongside a normal U-zone rather than a single whole-face label. ## Edge cases - **Recently-applied product** can shift the classifier toward "oily" or "combination" depending on finish. - **Sensitive variants** are inferred from redness and visible irritation patterns; they are conservative — many users with sensitive skin will be classified as their non-sensitive base type. - **Pore data unavailable** (e.g. face resolution too low for pore analysis) — `skin_type` is still returned, classified without pore data, so it may be less accurate. No status code is added to `skin_type`; in the zone `measures[]`, `pore_dilation` is `null`. Request `pore_dilation` too if you want to see the resolution warning. ## `local_warnings[]` The `skin_type` metric emits no metric-specific `local_warnings[]` codes (it sets `message: "Ok"`). It inherits the global image-quality codes; its contributing metrics (`shine`, `redness`, `pore_dilation`) carry their own codes if requested. ## Related - **[Choosing metrics](/concepts/metric-relationships/)** — `skin_type` composites `shine`, `pore_dilation`, `redness`, and `dull_skin`. - **[Visualization data](/concepts/visualization/)** — `skin_type_visualization` is a composite Type-2 stream: levels 1-4 carry shine data, 5-6 pore dilation, 7-9 redness. Each level is a polygon-area feature. - **[Rendering recipes → Polygon areas](/guides/rendering-recipes/#recipe-3--polygon-areas)** — same renderer as the underlying metrics. --- ## Eye area Source: src/content/docs/concepts/eyes.mdx > Periorbital concerns — under-eye darkness (dark circles) and eyebag prominence — surfaced via the eyes component, both per eye and as an aggregate. import VisualizationExample from "../../../components/VisualizationExample.astro"; ## Overview The `eyes` component analyses the periorbital region — the under-eye area and surrounding skin. It returns an aggregate severity score plus two sub-scores: **eyebags** (puffiness / under-eye edges) and **dark circles** (under-eye darkness). The sub-scores come back both globally (in `sum_measures[]`) and per eye (in `measurement_locations[]`), suitable for driving eye-cream and concealer recommendations. ```yaml component: eyes request: query: "components=eyes" response_path: "results[].description == \"eyes\"" value_range: [0, 1] # aggregate = mean of the two per-eye scores sum_measures: - eyebags # 0..1 - dark circles # 0..1 (note: space, not snake_case) measurement_locations: - left eye # per-eye eyebags + dark circles, with mask shapes - right eye warnings: [] # the eyes metric emits no metric-specific status codes ``` ## Visualization example ## Rendering notes The two sub-scores are in `sum_measures[]` — note the descriptions are space-separated, not snake_case: ```js const eyes = response.results.find((r) => r.description === "eyes"); const eyebags = eyes.sum_measures.find((m) => m.description === "eyebags")?.value; const darkCircles = eyes.sum_measures.find((m) => m.description === "dark circles")?.value; ``` For a per-eye breakdown, read `measurement_locations[]` — one entry per eye, each carrying its own `eyebags` and `dark circles` measures (and mask shapes for overlays): ```js const perEye = eyes.measurement_locations.map((loc) => ({ side: loc.description, // "left eye" | "right eye" eyebags: loc.measures.find((m) => m.description === "eyebags")?.value, darkCircles: loc.measures.find((m) => m.description === "dark circles")?.value, })); ``` Surface the two sub-scores separately rather than as a single aggregate — users have very specific eye-area concerns and product preferences. ## Edge cases - **Glasses** make this analysis unreliable. Eyeglasses are flagged globally in `status[]` as `314` ("Eyeglasses detected. Remove eyeglasses before taking the photo. Results are unreliable."), not as an eyes-specific warning. ## `local_warnings[]` The `eyes` metric does not emit any metric-specific `local_warnings[]` codes. Watch the global `status[]` instead — in particular `314` (eyeglasses detected) degrades eye-area results. Note also that if you request `skin_sagging`, a failed eyebag analysis surfaces there as `3001` ("Cannot analyze skin sagging since eyebag analysis had failed."), since sagging depends on the eye-area analysis. --- ## Makeup Source: src/content/docs/concepts/makeup.mdx > Composite makeup analysis — face shape, skin undertone, foundation RGB, Fitzpatrick type, eye color — for shade-finding and try-on UX. import { Aside } from "@astrojs/starlight/components"; ## Overview The `makeup` component bundles several categorical attributes useful for cosmetics personalization: detected face shape, skin undertone, the user's foundation colour as RGB, Fitzpatrick skin type, and eye color. Most values come back via `sum_measures[]` rather than as a numeric `value`. ```yaml component: makeup request: query: "components=makeup" response_path: "results[].description == \"Makeup\"" # NOTE: request component is `makeup`, response description is `Makeup` value_range: null # composite — read sum_measures[] sum_measures: - Face shape # integer 1..6 - Eye color # integer 1..3, or -1 when unavailable - Skin undertone # integer -1, 0, +1, or null when unavailable - Skin foundation RGB # [[r, g, b], ""] - Skin Fitzpatrick type # integer 1..6, or null when unavailable - Skin foundation raw RGB # same format as Skin foundation RGB, estimated without the skin tone input warnings: [99, 1000, 1101, 1102, 1111, 1112, 1121, 1122, 1191, 1192, 1200, 1201] ``` ## Value mappings | `Face shape` | Shape | | ------------ | -------- | | 1 | Diamond | | 2 | Heart | | 3 | Long | | 4 | Oval | | 5 | Round | | 6 | Square | | `Skin undertone` | Undertone | | ---------------- | --------- | | -1 | Cool | | 0 | Neutral | | +1 | Warm | | `Eye color` | Color | | ----------- | ----- | | -1 | Unavailable — eye-colour analysis did not complete | | 1 | Brown | | 2 | Blue | | 3 | Green | | `Skin Fitzpatrick type` | Type | | ----------------------- | --------------- | | 1 | Always burns | | 2 | Usually burns | | 3 | Sometimes burns | | 4 | Rarely burns | | 5 | Very rarely | | 6 | Never burns | `Skin undertone` and `Skin Fitzpatrick type` come back as `null` when the analysis they depend on did not complete — guard for that rather than assuming a number is always present. ## Rendering notes ```js // Request component is `makeup`, but the response finding's description is "Makeup". const m = response.results.find((r) => r.description === "Makeup"); const measure = (d) => m?.sum_measures.find((s) => s.description === d)?.value; const faceShape = measure("Face shape"); // 1..6 const eyeColor = measure("Eye color"); // 1..3 const undertone = measure("Skin undertone"); // -1 | 0 | +1 const fitzpatrick = measure("Skin Fitzpatrick type"); // 1..6 // "Skin foundation RGB" is [[r, g, b], ""] — check the status first. const [fdnRgb, fdnStatus] = measure("Skin foundation RGB") ?? []; const fdnUsable = fdnStatus !== "Foundation rgb is invalid."; ``` Match foundation by combining RGB and undertone; match lipstick by undertone + Fitzpatrick; match brow products by hair colour (request `hair` separately). ### `measurement_locations[]` are mask carriers The finding returns nine cosmetic-application areas — `Lips`, `Liplines`, `Eyelines`, `Eyeshadow`, `Eyebrows`, `Nose`, `Left cheek`, `Right cheek`, `Skin`. They carry **no score**: `value` is `null` on all of them and there are no AOI coordinates. Their only content is `mask_shapes`, which is returned solely when you also request the `masks` component: ```http ?components=makeup,masks ``` Request `makeup` on its own and the nine entries still appear, but stripped of their shapes — empty by design, not a fault. If you aren't drawing the areas, read `sum_measures[]` and ignore `measurement_locations[]` entirely. See [Masks](/concepts/masks/). ## Edge cases - **Existing makeup** affects the output — the values are sampled from the visible skin surface, so if foundation is worn the sampled shade reflects the product rather than the user's bare skin. The component does **not** detect or report whether makeup is present. ## `local_warnings[]` **Skin tone input:** - `1000` (error) — skin tone input not defined. Unable to proceed. **Eye area — eye state:** - `1101` (error) — eyes look too much closed. Keep eyes open. Eye color analysis aborted. - `1102` (warning) — eyes look quite closed. Keep eyes open. **Eye area — lighting:** - `1111` (error) — eyes region is too dark. Improve lighting on the eyes. Eye color analysis aborted. - `1112` (warning) — eyes region is quite dark. Improve lighting on the eyes. **Eye area — color cast:** - `1121` (error) — eyes whites have a heavy color cast. Correct white balance settings on the camera. Eye color analysis aborted. _(obsolete)_ - `1122` (warning) — eyes whites have a significant color cast. Correct white balance settings on the camera. **Eye color processing errors:** - `99` (error) — eye color detection undefined failure. - `1191` (error) — eye color detection processing error 1. Eye area has no color information. - `1192` (error) — eye color detection processing error 2. Eye area is too dark. **Foundation color:** - `1200` (warning) — color balance not corrected due to eye area low image quality. Skin foundation color analysis might be unreliable. - `1201` (warning) — skin foundation estimation failed. Foundation rbg output is invalid. --- ## Hair Source: src/content/docs/concepts/hair.mdx > Hair colour detection (with named palette), volume, type (coily/curly/straight/wavy), and frizziness. import { Aside } from "@astrojs/starlight/components"; ## Overview The `hair` component returns four sub-findings: detected hair colour (or colours, for highlights and balayage), volume, type, and frizziness. Each detected colour is matched against a named palette of roughly 140 hair shades, and the result carries both that palette entry's name and its RGB — so your UI can show a swatch and a recognisable name together. Note the RGB is the palette shade's, not a raw pixel sample, so the swatch and the name always agree with each other. The names are internal palette identifiers (e.g. `Pitch_Black`, `charcoal_Blackish_Brown`), not display text, and neighbouring shades can be hard to tell apart by name. Use them with caution — if you show colour to users, prefer the RGB swatch or map the shades to your own simpler colour groups. ```yaml component: hair request: query: "components=hair" response_path: "results[].description == \"hair\"" value_range: null sum_measures: - Hair color # [color_structure, message]; color_structure = [[index, name, prevalence, rgb], ...] - Hair volume # 0..1 - Hair type # 0..4 (categorical; 1 deprecated) - Hair frizziness # label: 0 (low) / 1 (high) - Hair frizziness ranged # continuous 0..1 input_hint: hairtype_query: "?hairtype=<-1|0|1|2|3|4>" warnings: [5000, 5002, 5003] ``` ## Value mappings | `hair_type` | Type | | ----------- | ------- | | 0 | Coily | | 1 | DEPRECATED | | 2 | Curly | | 3 | Straight | | 4 | Wavy | The optional `hairtype` query parameter (`-1` for auto, `0`–`4` for explicit) **biases** the model toward the type you supply — useful when your app already captures the user's hair type via questionnaire. It is a hint, not an override: a confident detection can still disagree with the hint, so don't assume the returned `Hair type` equals what you passed in. ## Rendering notes ```js const hair = response.results.find((r) => r.description === "hair"); // "Hair color" value is [colorStructure, message]; the entries are in [0]. const hairColor = hair.sum_measures.find((m) => m.description === "Hair color")?.value; const colors = hairColor?.[0]; // [[index, name, prevalence, [r,g,b]], ...] const volume = hair.sum_measures.find((m) => m.description === "Hair volume")?.value; const hairType = hair.sum_measures.find((m) => m.description === "Hair type")?.value; const frizziness = hair.sum_measures.find((m) => m.description === "Hair frizziness")?.value; // label: 0 (low) / 1 (high) const frizzinessRanged = hair.sum_measures.find((m) => m.description === "Hair frizziness ranged")?.value; // continuous 0..1 ``` For multi-colour hair (highlights, balayage, grown-out roots), `colors[]` carries one entry per detected colour, ordered by `prevalence` descending, with prevalence summing to 1 across the entries. Up to four colours can come back. How many you actually get depends on the image, so read the array rather than assuming a count — surfacing the top one or two is usually enough for a UI. ### Hair mask With the `masks` component (`?components=hair,masks`), the finding also carries the hair outline as finding-level `mask_shapes`. Hair has no `measurement_locations[]`, so this is its only mask. See [Masks](/concepts/masks/). ## Edge cases - **Tied-up hair** can register low volume incorrectly. Capture with hair down for accurate volume scoring. - **Wet hair** reads as straighter and darker. Capture dry for routine recommendations. - **Hair analysis fails** — all hair values come back `null` and `5000` is reported. `5000` is the general hair failure code; `5002` / `5003` may accompany it when the cause is that no or too little hair was detected. ## `local_warnings[]` - `5000` — hair analysis aborted due to image quality concerns or internal error. - `5002` — no hair detected. Hair analysis aborted. (always accompanied by `5000`) - `5003` — not enough hair detected. Hair analysis aborted. (always accompanied by `5000`) --- ## Composite metrics Source: src/content/docs/concepts/composites.mdx > Partner-configured composite scores (composites component) built by the Revieve API from the CV results — 0..100, 100 = best, as a tree of weighted means. import { Aside } from "@astrojs/starlight/components"; ## Overview `composites` combines several CV findings into partner-defined scores, such as an overall skin score with sub-scores like "hydration" or "clarity". The scores form a tree: each leaf reads one CV finding, and each composite node is the weighted mean of its children. The Revieve API builds the composites from the CV results after the analysis. The CV does not compute them, so they don't depend on the CV version, but their values move whenever the underlying CV findings change. ```yaml component: composites request: query: "components=composites," response_path: "composites" # top-level key, next to results[] value_range: [0, 100] # integer, 100 = best; null when nothing under a node could be scored requires: a composite tree configured by Revieve for your partner ID ``` ## Requesting composites Add `composites` to `components`, together with the CV components your tree's leaves read: ```http ?components=composites,acne,redness,texture,wrinkles,pore_dilation ``` `composites` itself is not a CV component, and the API doesn't add CV components on the tree's behalf: - If `composites` is the only token, the CV runs its default set. `hair` and the `redness_absolute` / `*_adjusted` variants are not in the default set. - Otherwise the CV computes only the components you list, so list every component a leaf needs. A leaf whose finding is not in the response counts as missing. ## Response shape ```jsonc { "message": "OK", "results": [ /* unchanged CV findings */ ], "composites": { "root": { "id": "skin_score", "value": 72, "children": [ { "id": "clarity", "value": 75, "children": [ { "metric": "acne", "value": 80 }, { "metric": "redness", "value": 70 } ] }, { "metric": "wrinkles", "value": 69 } ] }, "missing": [] } } ``` - **Composite node** — has `id` (snake_case, defined in your tree), `value` and `children`. - **Leaf** — has `metric` (a name from the table below) and `value`. - **Depth** — at most three levels: the root, composites directly under it, and leaves. A leaf can also sit directly under the root. A composite never contains another composite. - **`missing`** — the leaf metrics that could not be scored for this image. Composites that contain them are averaged over their remaining children; a composite whose children are all missing has `value: null`. Weights are partner configuration and are not in the response. ## Scores differ from `results` The two scales are different on purpose: | | `results[]` | `composites` | |---|---|---| | Range | `0..1` (float) | `0..100` (integer) | | Direction | Higher = more of the measured thing (e.g. more acne) | Higher = better, always | | Example | `acne` `value: 0.2` | `acne` leaf `value: 80` | A leaf is its CV finding's value × 100, rounded, and oriented so that 100 is best: Revieve has decided for each metric whether the CV value needs flipping to `100 − x`, so you can read every leaf the same way. `darkSpots` read from raw `dark_spots` is additionally rescaled to match how Revieve's apps display dark spots. A composite's value is the weighted mean of its children, rounded. `results[]` itself is unchanged when you request `composites`. ## Leaf metrics Leaf names are camelCase names from a fixed list, not the CV `description` strings: | Leaf `metric` | Reads CV finding | |---|---| | `hyperpigmentation` | `hyperpigmentation` | | `melasma` | `melasma` | | `freckles` | `freckles` | | `darkSpots` | `dark_spots_adjusted`, else `dark_spots` | | `wrinkles` | `wrinkles` | | `redness` | `redness_absolute`, else `redness` | | `texture` | `texture` | | `acne` | `acne` | | `smoothness` | `smoothness` | | `skinShine` | `Skin shine` (the `shine` component) | | `radiance` | `radiance_adjusted`, else `radiance` | | `dullSkin` | `dull_skin` | | `unevenSkinTone` | `uneven_skin_tone` | | `eyebags` | `eyes` — `eyebags` sum measure | | `darkcircles` | `eyes` — `dark circles` sum measure | | `poreDilation` | `pore_dilation` | | `skinSagging` | `skin_sagging` | | `skinFirmness` | `skin_firmness` | | `hairVolume` | `hair` — `Hair volume` sum measure | Where a leaf lists two findings, it uses the first one present in the response. So `darkSpots`, `redness` and `radiance` use the alternative score only when you request it. ## Edge cases - **When a leaf counts as missing** — its finding is not in the response, failed, or has no valid `0..1` value (e.g. `-1` or `null`). A finding with local image warnings still counts, except pore dilation, which counts as missing on a warning unless your tree is set up to keep it. - **Global errors** — when the whole analysis fails (`message: "Error"`), `results` is null, every leaf is missing and the root `value` is `null`. ## Related - **[Choosing metrics](/concepts/metric-relationships/)** — the CV findings the leaves read, and how they relate to each other. - **[Interpreting results](/guides/interpreting-results/)** — the rest of the response. - **[Status codes](/concepts/status-codes/)** — the `local_warnings[]` codes a finding can carry. --- ## Masks Source: src/content/docs/concepts/masks.mdx > Tier-2 visualization data — exact region boundaries described as a small drawing program. Returned only when the masks component is requested. import { Aside } from "@astrojs/starlight/components"; ## Overview `masks` is the **second tier** of [visualization data](/concepts/visualization/) — between the cheap [AOI circles](/concepts/visualization/#tier-1--aoi) and the rich [advanced/concern visualization](/concepts/visualization/#tier-3--advanced-concern-visualization). It returns the *exact* region boundary that a metric was measured over, encoded as a small drawing program: an ordered list of shapes to add to (or cut out of) a buffer, optionally followed by an outer mask the result is multiplied against. It's the right tier when you need pixel-accurate region rendering — diagnostic dashboards, before/after panels, "highlight the cheek when discussing redness" UX. For markers/spots/lines on top of the photo, use Tier 3 instead. For a coarse "this is roughly the area" zoom, AOI circles are enough. ## Requesting masks `masks` is a flag, not a metric. Add it to your `?components=...` query alongside the metrics whose region shapes you want: ```http ?components=masks,redness,wrinkles ``` Each finding's `measurement_locations[]` then carries a `mask_shapes` block. Without `masks`, you only get the AOI circles. ### Two places to look `mask_shapes` appears at **two levels**, and several metrics populate both: - **Per measurement location** — the boundary of that one region. This is the common case. - **On the finding itself** — a whole-metric boundary, next to `value` and `sum_measures`. `redness`, `texture`, `uneven_skin_tone`, `smoothness` and `shine` use it for the full sampled skin area; `hair` uses it for the hair outline. For `hair` the finding-level block is the **only** mask — hair has no `measurement_locations` at all, so a renderer that walks locations will find nothing. Check both levels. ## The mask shape schema Each `mask_shapes` block has two parts: ```jsonc { "coordinates": "original", // pixels of the input image "shapes": [ // ordered draw program { "color": 1, "type": "polygon", "params": [[x0, y0], [x1, y1], ...] }, { "color": 0, "type": "ellipse", "params": [cx, cy, rx, ry, rot, a1, a2] } ], "mask": { // optional outer mask, multiplied at the end "color": 1, "type": "polygon", "params": [[x0, y0], [x1, y1], ...] } } ``` - **`coordinates: "original"`** — all `params` values are in the input-image pixel coordinate system (origin top-left, X-right, Y-down). - **`shapes[]`** — the draw program. Each entry has `color`, `type`, `params`. - **`mask`** — optional. If present, the final result is multiplied by this single shape (so anything outside it gets zeroed out). It's a full shape object (`color`, `type`, `params`) — same vocabulary as `shapes[]`. ### Shape types Four shape primitives. Each uses a different `params` layout: | `type` | `params` shape | Notes | |---|---|---| | **`polygon`** | `[[x0, y0], [x1, y1], ...]` | Guaranteed convex. **Connect first point to last explicitly when drawing** — the API omits the closing edge. | | **`unrestricted_polygon`** | `[[x0, y0], [x1, y1], ...]` | Not guaranteed convex. Same closing-edge requirement. | | **`ellipse`** | `[cx, cy, rx, ry, rotation, startAngle, endAngle]` | Standard 7-parameter ellipse — see [OpenCV's `ellipse` function](https://docs.opencv.org/4.x/d6/d6e/group__imgproc__draw.html#ga28b2267d35786f5f890ca167236cbc69) for the canonical interpretation. | | **`polyline`** | `[[x0, y0], [x1, y1], ...]` | A *line*, not an enclosed area. **Don't connect first to last.** | ### `color` — add or cut Each shape's `color` is an integer: - `color: 1` — **add** the shape's pixels to the buffer (set them to 1). - `color: 0` — **cut** the shape's pixels from the buffer (set them to 0). Order matters: shapes are applied left-to-right, each on top of the result so far. So `[ellipse@1, polygon@0]` means "draw the ellipse, then erase the polygon's interior from it." ## Drawing a mask — the buffer-A / buffer-B walkthrough Two single-channel image buffers A and B, both starting empty (all zeros), both the size of the input image. 1. **Buffer A — apply the `shapes[]` program.** For each shape in order, draw its primitive onto A using the shape's `color` (1 fills with 1, 0 fills with 0). 2. **Buffer B — draw the outer `mask` shape (if present).** If `mask` is omitted, treat B as all-ones. Otherwise draw the single `mask` shape onto B with its color. 3. **Final mask = A × B (elementwise).** A pixel ends up `1` only if both buffer A *and* buffer B mark it as 1. Pseudocode: ```js function buildMask({ shapes, mask }, width, height) { const A = new Uint8Array(width * height); // zeros for (const { type, color, params } of shapes) { drawShape(A, type, params, color); } const B = new Uint8Array(width * height).fill(mask ? 0 : 1); if (mask) { drawShape(B, mask.type, mask.params, mask.color); } const final = new Uint8Array(width * height); for (let i = 0; i < final.length; i++) final[i] = A[i] && B[i] ? 1 : 0; return final; } ``` `drawShape` is wherever your renderer's primitives live — `` 2D context, OpenCV's `polylines` / `fillPoly` / `ellipse`, an SVG path builder, etc. Python + `matplotlib.pyplot` or OpenCV is a common choice for server-side / batch rendering. ## Why most metrics' masks look the same Most metrics' `mask_shapes` start from the same shared origin — the facial skin area — and then add or cut metric-specific regions. So if you compare `mask_shapes` across `redness`, `texture`, and `uneven_skin_tone`, large parts of their `shapes[]` arrays will be identical. That's expected; it's the shared face-area scaffold. ## Edge cases - **Without `masks`, fall back to AOIs.** You can still draw approximate regions from each measurement location's `AOI_x_o` / `AOI_y_o` / `AOI_radius_o` — circles around each area of interest. Less precise, much smaller payload. - **`local_warnings[]`** — a skin-mask sampling failure surfaces as `idx: 401` on `hyperpigmentation` and `acne` (the metrics that sample masks). Other mask-using metrics instead return `value: -1` or `null` (depending on the metric) for the affected region rather than a code. Treat as advisory; the rest of the metric's output is still usable. ## Related - **[Visualization data](/concepts/visualization/)** — the three-tier model and which metrics support which tier. - **[Rendering recipes](/guides/rendering-recipes/)** — renderers for the Tier 3 features; for masks, use the walkthrough above. - **[Status codes](/concepts/status-codes/)** — `401` and other masking diagnostics. --- ## Visualization data Source: src/content/docs/concepts/visualization.mdx > How the Skin Analysis API returns spatial information for rendering — three tiers (AOIs, masks, advanced/concern visualization), the coordinate system, the per-metric support matrix, and the intensity-range table. import { Aside } from "@astrojs/starlight/components"; ## Overview Most Skin Analysis findings come with **spatial information** — *where* on the face the metric was measured, and what specifically was detected. Use it to draw markers on the user's photo, or to generate before/after panels. The API exposes spatial data in **three tiers**, ordered by detail: 1. **AOI** (Area Of Interest) — a single circle `(x, y, radius)` per region. Present on the measurement locations of scored metrics. Cheapest to render. 2. **Mask** — a binary mask described as a list of drawing operations. Returned only when the `masks` component is requested. Captures exact region boundaries. 3. **Advanced (concern) visualization** — per-metric feature data: spots, polylines, or polygon-areas with intensities. Returned only when the `_visualization` opt-in is included in the request. Tier 3 is the right tier for drawing the detected features on the photo. Tier 1 is enough for "zoom in on this region" UX. Tier 2 is for diagnostic dashboards and before/after panels where exact region shapes matter. ## Coordinate system All spatial values — AOI centers, mask shape vertices, advanced-visualization x/y arrays — are in the **input image's pixel coordinate system**: - Origin `(0, 0)` is the **top-left corner**. - X axis points right. - Y axis points down. - Bottom-right corner is `(W, H)` where W, H are the input image's pixel width and height. You can paint visualizations directly onto a canvas of the original image without any coordinate transform. ## Tier 1 — AOI Every numeric finding's `measurement_locations[]` includes `AOI_x_o`, `AOI_y_o`, `AOI_radius_o`: ```jsonc { "description": "left cheek", "value": 0.21, "AOI_x_o": 412, "AOI_y_o": 580, "AOI_radius_o": 90, "ut_zone": "u-zone" } ``` The AOI is an *approximation* of the region the score was computed over — a circle that bounds the actual mask data. One simple use-case is zooming in on a specific sub-measurement when the user drills into a metric. ## Tier 2 — masks When the `masks` component is included in the request, each `measurement_locations[]` entry gains a `mask_shapes` array describing the exact region boundary as a small drawing program (ordered ellipse / polygon / polyline operations, plus a `mask` shape multiplied at the end). See the dedicated **[Masks](/concepts/masks/)** page for the full vocabulary and the buffer-A/buffer-B implementation walkthrough. ## Tier 3 — advanced (concern) visualization Each metric that supports it has a paired `_visualization` request component. Adding it to your `?components=...` query enables the per-feature data inside `measurement_locations[].visualization_data[]`. ```http ?components=acne,acne_visualization,wrinkles,wrinkles_visualization ``` The supported opt-ins (see the [API reference](/api/skin-analysis/operations/analyzeimage/) for the full list): ``` acne_visualization wrinkles_visualization melasma_visualization acne_normalized_visualization uneven_skin_tone_visualization texture_visualization redness_visualization skin_sagging_visualization shine_visualization hyperpigmentation_visualization glow_visualization freckles_visualization dark_spots_visualization pore_dilation_visualization skin_type_visualization ``` ### Feature shape `visualization_data[]` is a list of features. Each feature is one of three types — the type is implicit (no `kind` field), determined by the metric: | Feature type | What it draws | Metrics | |---|---|---| | **Spot** | A single point with an intensity. Length is always 1. | acne, freckles, dark spots, hyperpigmentation | | **Polyline** | A connected line segment of length-N points (one detected wrinkle, one fold). | wrinkles (and its sub-region variants — see [Wrinkles](/concepts/wrinkles/)) | | **Polygon area** | An area mask delimited by a coordinate path. Intensity is a *categorical integer* indexing levels — except `skin sagging`, whose outlines carry a *continuous* intensity. | redness, melasma, shine, glow, skin type, texture, uneven skin tone, skin sagging, pore dilation | For most polygon-area metrics the response includes one or more features per intensity level (one per separate region), and the levels come from thresholding the same underlying field at increasing cutoffs — so higher levels generally sit *inside* lower ones. That is what makes layered low-opacity fills read as a gradient. Containment is not guaranteed pixel-for-pixel, though: each level is cleaned up with its own morphological pass, so edges can differ slightly. Three metrics do not follow the nested-levels model at all: - **`shine`** — levels 1–2 come from the diffuse-sheen field, levels 3–4 from the specular-highlight field. They are two independent pairs, not one four-step ramp, so level 3 is not "worse" than level 2 and does not sit inside it. - **`skin_type`** — a composite stream: levels 1–4 carry `shine` data, 5–6 `pore_dilation`, 7–9 `redness`. Three unrelated sources sharing one integer axis. - **`skin_sagging`** — one continuous-intensity outline per contributing region, not levels. ### Feature data fields Every feature carries: ```jsonc { "length": 27, // 1 for spots, N for polylines/areas "x": [288.77, 287.29, /* ... */], // length-N x coords (pixels) "y": [51.61, 51.60, /* ... */], // length-N y coords (pixels) "intensity": 0.24, // number for spots; integer for area categories; array for polylines "mean_intensity": 0.240, // average across the feature "median_intensity": 0.248, // median across the feature "length_weighted_intensity": 0.231 // present on every feature; only meaningful for wrinkles } ``` Intensity shape per type: - **Spot** — `intensity` is an array of length 1; `mean_intensity` holds the same value as a number. - **Polyline** — `intensity` is an array of length-N (per-point intensities along the line). - **Polygon area** — `intensity` is a single integer (the category index, e.g. `1` or `2`). `length_weighted_intensity` appears on every feature but is only meaningful for wrinkles — there it ranks findings by both how *long* and how *intense* the wrinkle is, useful when surfacing the worst few to a user. On spot and polygon-area features it is computed from a single value and carries no information; ignore it. The same applies to `mean_intensity` / `median_intensity` on polygon-area features: with one integer level per feature they simply repeat `intensity`. ## Per-metric support matrix Six categories: | Category | What's available | Metrics | |---|---|---| | **A** — none | No spatial data; `value` only. | dull skin, skin firmness, radiance, radiance adjusted, redness absolute, dark spots adjusted, hyperpigmentation adjusted, skin age | | **B** — AOI only | `AOI_*` fields per measurement location. | *(currently empty)* | | **C** — AOI + mask | `AOI_*` + `mask_shapes` (when `masks` requested). No advanced viz. | eyes | | **M** — mask only | `mask_shapes` (when `masks` requested), with no AOI and no score. | makeup, hair | | **D−** — advanced (simpler) | The advanced visualization structure but with simpler outputs (relevant finding areas only, no per-feature detail). | skin sagging | | **D** — AOI + mask + advanced | All three tiers when respective opt-ins are requested. | acne, dark spots, freckles, glow, hyperpigmentation, melasma, pore dilation, redness, shine, skin type, smoothness, texture, uneven skin tone, wrinkles | **Category M is the odd one.** Both metrics carry shapes but nothing numeric attached to them: - `makeup` returns nine cosmetic-application areas as `measurement_locations[]` — `Lips`, `Liplines`, `Eyelines`, `Eyeshadow`, `Eyebrows`, `Nose`, `Left cheek`, `Right cheek`, `Skin` — each with `value: null` and no AOI. They exist only to carry `mask_shapes`. - `hair` has no `measurement_locations` at all; its outline is on the finding's own `mask_shapes`. See [Masks → Two places to look](/concepts/masks/#two-places-to-look). Without the `masks` component neither returns anything spatial. **Smoothness footgun:** `smoothness` shares its advanced-visualization data with `uneven_skin_tone`. To get advanced data for smoothness, request `uneven_skin_tone_visualization` (the API does not have a separate switch). Both metrics will then carry advanced viz in the response. ## Intensity ranges `intensity` means two different things depending on the feature type, and mixing them up is the most common rendering bug: - **Continuous metrics** — `intensity` is a magnitude. Scaling it into a colour ramp is correct, but the range differs per metric, so parameterize the ramp; don't assume `[0, 1]` everywhere. - **Categorical (polygon-area) metrics** — `intensity` is a **level index**, an integer counting up from `1`. It is *not* a normalized score. Feeding it straight into a `0..1` colour ramp renders every level at full saturation. Map each integer to a colour explicitly instead. **Continuous** | Metric | `intensity` range | Notes | |---|---|---| | Wrinkles | ~`[0, 1]` per point | `intensity` is an array — one value per point along the line. | | Acne | `[0, 2500]` | Divide by 2500 for `[0, 1]`, or request `acne_normalized_visualization`. | | Hyperpigmentation / dark spots | `[0, 400]` | | | Freckles | `[0, 400]` | | | Skin sagging | `[0, 1]` | The contributing region's own score, not a level index. | **Categorical — integer level index** | Metric | Levels | Notes | |---|---|---| | Redness | `1..3` | | | Melasma | `1..3` | | | Texture | `1..2` | | | Uneven skin tone | `1..2` | Shared with `smoothness`. | | Pore dilation | `1..2` | | | Shine | `1..4` | Fixed meanings, two independent pairs: `1`/`2` low/high **diffuse**, `3`/`4` low/high **specular**. | | Glow | `1..2` | `1`/`2` low/high highlights. | | Skin type | `1..9` | Composite: `1..4` shine, `5..6` pore dilation, `7..9` redness. | ## Render decision rules Three patterns to bake into your renderer: **1. Prefer `mean_intensity ?? intensity` for color decisions.** When the metric provides a `mean_intensity` (most do for area metrics), it gives a more stable color than the raw per-point `intensity`. Fall back to `intensity` when `mean_intensity` is absent. **2. Sort `visualization_data` ascending by intensity before drawing.** For the nested-level metrics, drawing low → high gives correct overpainting — the high-intensity area lands on top of the low. For spot/line metrics the sort is harmless and keeps render order deterministic. For `shine` and `skin_type` the sort is still worth keeping for determinism, but don't read the ordering as severity: their levels come from different source fields (see [Feature shape](#feature-shape)), so give each level its own colour rather than a single ramp. **3. Decimate dense polylines.** A wrinkle feature can carry hundreds of points. For canvas / SVG / WebGL rendering, keeping every Nth point above a threshold (every 3rd above 20 is a good default) is visually identical and much cheaper. For paste-ready code for the three feature types, see [Rendering recipes](/guides/rendering-recipes/). ## Edge cases - **Regions that aren't analyzed** carry no spatial detail — `value` is `-1` or `null` (depending on the metric), with no `mask_shapes` or `visualization_data`. Skip them when drawing. - **Advanced viz adds payload weight.** Don't request `_visualization` for metrics whose visualizations you won't render — it materially increases response size. ## Related - **[Masks](/concepts/masks/)** — the tier-2 region-boundary format with full shape vocabulary and drawing-syntax walkthrough. - **[Sub-area divisions](/concepts/sub-areas/)** — which face-region split each metric uses for its `measurement_locations[]`. - **[Rendering recipes](/guides/rendering-recipes/)** — paste-ready spot / polyline / area renderers. - **[Interpreting results](/guides/interpreting-results/)** — full response-shape walkthrough; the `value` / `value_raw` / `local_warnings` fields. --- ## Sub-area divisions Source: src/content/docs/concepts/sub-areas.mdx > How face regions are split for per-location measurements. Five division schemes (primary, alternative, UT-zone, custom, none) and which metrics use which. ## Overview When a metric has spatial output, its `measurement_locations[]` array contains one entry per face sub-region. The CV uses **five different division schemes** depending on what each metric actually measures — there's no single canonical face split. Knowing which split a metric uses tells you which `description` strings to expect and how granular the regional breakdown is. ## The five schemes ### 1. Primary division (11 regions) The default sub-area scheme for metrics that benefit from finely separated face regions: ``` chin forehead left side around mouth right side around mouth nose left under-the-eye region right under-the-eye region left side around the eye right side around the eye left cheek right cheek ``` **Used by:** `texture`, `redness`, `uneven_skin_tone`, `smoothness`. ### 2. Alternative division (6 regions) Coarser regions, used by metrics where finer-grained splits don't add diagnostic value: ``` left cheek right cheek forehead nose left lower face right lower face ``` **Used by:** `acne`, `melasma`, `freckles`, `dark_spots`, `hyperpigmentation`. ### 3. UT-zone divisions Splits organised around the **T-zone** (forehead, nose) vs. **U-zone** (cheeks, jaw) distinction. Two granularities exist: **9-region — used by `pore_dilation`:** ``` left cheek right cheek forehead left forehead center forehead right nose chin left lower face right lower face ``` **2-zone — used by `shine`, `glow`, `skin_type`:** just the aggregate zones, `t-zone` and `u-zone`. (`shine` and `glow` additionally include a `Global` entry, which holds whole-face visualization data rather than a score — see [below](#cross-reference).) Each measurement location also carries a `ut_zone` field — `"u-zone"`, `"t-zone"`, `"none"`, or `"mixed"` — useful for routine personalization (oily T-zone vs. dry U-zone). `"mixed"` marks a region that can belong to either zone depending on the definition, e.g. `chin`; the `t-zone` / `u-zone` entries of `shine`, `glow` and `skin_type` include it in both. `"none"` marks regions in neither zone, such as the eye-area regions of the Primary split. ### 4. Custom per-metric Some metrics define their own sub-region vocabulary that fits their specific measurement. - **`eyes`** — `left eye`, `right eye`. - **`wrinkles`** — wrinkle-specific sub-region descriptions like `forehead worry lines`, `between-brows frown lines`, `left side nasolabial line`, `right side marionette line`, `left side eye crow's feet`, etc. From 3.30.0 (currently in the test environment only), most of them carry a `t-zone` or `u-zone` tag; the eye-area lines report `"none"`. See [Wrinkles](/concepts/wrinkles/) for the full list and tags. - **`makeup`** — nine cosmetic-application areas: `Lips`, `Liplines`, `Eyelines`, `Eyeshadow`, `Eyebrows`, `Nose`, `Left cheek`, `Right cheek`, `Skin`. These are unusual in that they carry **no score** — `value` is `null` on every one. They exist purely to hold `mask_shapes`, so they're only useful when you also request the `masks` component. See [Makeup](/concepts/makeup/). ### 5. No division Whole-face metrics — `measurement_locations[]` is empty. **Used by:** `hair` (its hair-outline shapes hang off the finding's own `mask_shapes` instead), `skin_age`, and the derived score-only metrics such as `dull_skin`, `radiance`, `skin_firmness`, `redness_absolute`, `dark_spots_adjusted` and `hyperpigmentation_adjusted`. ## Why this matters Three concrete use cases: 1. **Region-aware UI copy.** "More redness around your cheeks than your forehead" comes from looking at the per-location `value` and picking the highest. The set of region names you can expect depends on the scheme — don't hard-code "forehead" if the metric uses the Alternative split. 2. **Routine personalization.** `ut_zone` on each measurement location is the cheapest way to drive "oily T-zone, dry U-zone" routines. It's present on every measurement location, and meaningfully populated on the Primary, Alternative and UT-zone schemes alike — the Alternative split maps cheeks and lower face to `u-zone`, forehead and nose to `t-zone` — and, from 3.30.0, on the `wrinkles` sub-regions. Regions that belong to neither report `"none"` (the eye-area regions of the Primary split, for instance). 3. **Cross-metric comparison.** When you want to overlay redness and texture on the same face region, both use the Primary split — same region names, line up directly. Comparing redness regions to acne regions requires mapping (Alternative → Primary). ## Cross-reference A `Global` entry in `measurement_locations[]` is **not** the whole-face score, despite the name. Its `value` is always `null`; it exists as a container for whole-face `visualization_data`. It appears on three metrics only — `shine`, `glow` and `skin_sagging`. The whole-face score is always the finding's top-level `value`, on every metric including those two. Filter `Global` out when you iterate regions for a score breakdown. ## Related - **[Visualization data](/concepts/visualization/)** — the three-tier model spatial data is layered on top of these sub-area divisions. - **[Wrinkles](/concepts/wrinkles/)** — full custom sub-region list for the wrinkles metric. --- ## Choosing metrics Source: src/content/docs/concepts/metric-relationships.mdx > Which skin metric to request for which UX — inverse pairs and the metric variants. import { Aside } from "@astrojs/starlight/components"; Several metrics come in pairs or variants. Some are the inverse of another, and a few have a variant made for specific integrations. Knowing which is which saves you from requesting two views of the same thing or showing both to a user. This page is that map; each metric links to its own concept page for detail. ## Inverse pairs Two framings of one skin property, so you can speak your product's language without inverting numbers yourself: a severity score for diagnostic views ("here is what to work on") and a "higher is better" score for progress views ("this is improving"). Pick the one that matches the screen; the two sit badly side by side because one goes down as the other goes up. | Severity metric | Inverse ("good number goes up") | | --------------- | ------------------------------- | | [`uneven_skin_tone`](/concepts/uneven-skin-tone/) | `smoothness` | | [`skin_sagging`](/concepts/skin-sagging/) | `skin_firmness` | Both are first-class metrics with their own pages; what each returns (regions, visualization data) is described there and may develop independently. ## Which to request for your UX - **Diagnostic / "what's wrong"** UIs: use the severity metric (`uneven_skin_tone`, `skin_sagging`, `dull_skin`). - **Improvement-over-time / "good number goes up"** UIs: use the inverse where one exists (`smoothness`, `skin_firmness`). `radiance` is a score of its own, not the inverse of `dull_skin`. ## Metric variants Four components are variants of a standard metric on a different output scale, provided for integrations that were set up with them. Use the standard metric unless Revieve has configured your integration otherwise; the two are not meant to be shown together. | Variant | Standard metric | | ------- | --------------- | | `redness_absolute` | [`redness`](/concepts/redness/) | | `dark_spots_adjusted` | [`dark_spots`](/concepts/dark-spots/) | | `hyperpigmentation_adjusted` | [`hyperpigmentation`](/concepts/hyperpigmentation/) | | `radiance_adjusted` | [`radiance`](/concepts/radiance/) | Each returns only the top-level `value`: no regions, mask shapes or visualization data. --- ## Status codes Source: src/content/docs/concepts/status-codes.mdx > Complete reference for the idx codes returned in status[] and per-finding local_warnings[]. Image-quality, face detection, per-metric failures. import { Aside } from "@astrojs/starlight/components"; import StatusCodes from "../../../components/StatusCodes.astro"; Every `analyzeImage` response carries a `status[]` array of `{ idx, description, isError }` entries describing image-quality and pipeline-level issues. Per-finding `local_warnings[]` carry the same shape but scoped to one metric. This page lists every code, in the groups the OpenAPI spec defines. {/* generated from the spec: begin */} ## General codes | idx | isError | Description | |---|---|---| | 99 | 1 | [custom context] undefined failure. | ## Image Preprocessor codes | idx | isError | Description | |---|---|---| | 100 | 1 | Unable to process: image must be in RGB color format. | | 101 | 1 | Unable to process: Image resolution too small. | | 102 | 1 | Unable to downsample image resolution: Image aspect ratio too extreme. | | 103 | 0 | Image too dark. Increase exposure. | | 104 | 0 | Image is overexposed. Find more diffuse lighting. | ## Face Detection codes | idx | isError | Description | |---|---|---| | 201 | 1 | Unable to detect a face | | 202 | 0 | Multiple faces detected. Only the best fit face is analyzed. | | 203 | 0 | Face detection is uncertain. Analysis quality is compromized. | | 204 | 0 | Face detection is very uncertain. Analysis quality is unreliable. | | 205 | 0 | More margin space around the face needed. Results might be compromised. Take the picture a bit further away. [OBSOLETE, 319 covers it] | | 206 | 1 | Facial landmarks are invalid. Aborting processing. | ## Normalizer codes | idx | isError | Description | |---|---|---| | 301 | 1 | The detected face resolution is too small. Take a photo closer to the target. | | 302 | 1 | Face is too much tilted to the side. Face straight at the camera. | | 303 | 0 | Face is possibly tilted to the side. Face straight at the camera. | | 304 | 1 | Face is too much tilted down. Face straight at the camera. | | 305 | 0 | Face is possibly tilted down. Face straight at the camera. | | 306 | 0 | Face is possibly tilted up. Face straight at the camera. | | 307 | 0 | Image too dark at the face area. Increase exposure/light to the face. | | 308 | 0 | Image is overexposed at the face area. Find more diffuse lighting or reduce exposure. | | 309 | 0 | The face area blue channel is clipping (overexposed). Reduce exposure or adjust color balance. | | 310 | 0 | The face area green channel is clipping (overexposed). Reduce exposure or adjust color balance. | | 311 | 0 | The face area red channel is clipping (overexposed). Reduce exposure or adjust color balance. | | 312 | 0 | The face has unsymmetric exposure. Find even illumination. | | 313 | 0 | The face area has hard shadows. Find more diffuse lighting. | | 314 | 0 | Eyeglasses detected. Remove eyeglasses before taking the photo. Results are unreliable. | | 315 | 1 | Forehead is partially outside the image. Make sure the whole face fits the image. Aborting processing. | | 316 | 1 | Lower face is partially outside the image. Make sure the whole face fits the image. Aborting processing. | | 317 | 1 | Face right side is partially outside the image. Make sure the whole face fits the image. Aborting processing. | | 318 | 1 | Face left side is partially outside the image. Make sure the whole face fits the image. Aborting processing. | | 319 | 0 | Face is too tightly framed in the image. Leave more space around the face. | ## Skin masking codes | idx | isError | Description | |---|---|---| | 401 | 0 | Unable to sample skin. Acne/Hyperpigmentation results are unreliable. | ## Miscellaneous global codes | idx | isError | Description | |---|---|---| | 500 | 1 | All metrics had an error. | ## Makeup analysis codes | idx | isError | Description | |---|---|---| | 1000 | 1 | Skin tone input not defined. Unable to proceed. | | 1101 | 1 | Eyes look too much closed. Keep eyes open. Eye color analysis aborted. | | 1102 | 0 | Eyes look quite closed. Keep eyes open. | | 1111 | 1 | Eyes region is too dark. Improve lighting on the eyes. Eye color analysis aborted. | | 1112 | 0 | Eyes region is quite dark. Improve lighting on the eyes. | | 1121 | 1 | Eyes whites have a heavy color cast. Correct white balance settings on the camera. Eye color analysis aborted. [OBSOLETE] | | 1122 | 0 | Eyes whites have a significant color cast. Correct white balance settings on the camera. | | 1191 | 1 | Eye color detection processing error 1. Eye area has no color information. | | 1192 | 1 | Eye color detection processing error 2. Eye area is too dark. | | 1200 | 0 | Color balance not corrected due to eye area low image quality. Skin foundation color analysis might be unreliable | | 1201 | 0 | Skin foundation estimation failed. Foundation rbg output is invalid. | ## Pore dilation | idx | isError | Description | |---|---|---| | 2000 | 1 | Image resolution for the face area is too low. Face at the image has to be at minimum 1200 pixels wide. [Outdated description: The limit is not necessarily 1200 pixels anymore] | | 2001 | 0 | Image resolution for the face area is low. | ## Local metric codes | idx | isError | Description | |---|---|---| | 3000 | 1 | Acne measurement aborted due to image quality concerns. | | 3001 | 1 | Cannot analyze skin sagging since eyebag analysis had failed. | | 3002 | 1 | Cannot analyze skin sagging since wrinkle analysis from required locations had failed. | | 4000 | 1 | Skin firmness not analyzed due to error in skin sagging analysis. | | 5000 | 1 | Hair analysis aborted due to image quality concerns or internal error. | | 5002 | 1 | No hair detected. Hair analysis aborted. | | 5003 | 1 | Not enough hair detected. Hair analysis aborted. | | 7000 | 1 | Skin Age analysis aborted due to image quality concerns or internal error. | {/* generated from the spec: end */} Three codes need care when you read their text. `99` has no fixed text: the bracketed part depends on where the error is raised, and today only the makeup eye-colour analysis emits it. `401` names the sampled region and the metric, for example `Unable to sample image left cheek skin. Acne results are unreliable.`. The `2000` text still says 1200 px; the analysis aborts below 600 px face width, see [Image quality](/guides/image-quality/). ## Use in code ```js // Global errors: the analysis failed as a whole; results is null. if (response.message === "Error") { const err = response.status.find((s) => s.isError === 1); showRetry(err?.idx); // e.g. 201, 301, 315 → ask for a new photo } else { // Per-metric errors: only that finding failed; the others are usable. for (const r of response.results) { const failed = r.local_warnings.some((w) => w.isError === 1); if (failed) hideCard(r.description); } } ``` Branch on `isError`, not on a hand-kept list of codes — new codes keep working. For the most current listing, the OpenAPI spec is canonical: see [`/openapi/skin-analysis.yaml`](/openapi/skin-analysis.yaml). --- ## Changelog Source: src/content/docs/changelog/index.mdx > Human-readable release notes for the Skin Analysis and Product Recommendations APIs. Release notes for the Skin Analysis and Product Recommendations APIs. The [API reference](/api/skin-analysis/) shows the current version's OpenAPI document; this page summarises what changed. For upgrade notes, see [Migrations](/migrations/). ## Skin Analysis - [Version history (3.20.0 → 3.30.0)](/changelog/version-history/) — test: v3.30.0, production: v3.29.1 _Versions 3.20.0 → 3.30.0 are summarized on the [version history page](/changelog/version-history/). Older versions are not summarized._ ## Composite metrics - New `composites` component — partner-configured composite scores that the Revieve API builds from the CV results. It is not tied to a Skin Analysis version. See [Composite metrics](/concepts/composites/). ## Product Recommendations - v0.9.0 — current _No notable behaviour changes since the last release. See the [API reference](/api/product-recommendations/)._ --- ## Skin Analysis changelog Source: src/content/docs/changelog/version-history.mdx > Version-by-version changes to the Skin Analysis API from 3.20.0 to the current release. **Test:** 3.30.0 · **Production:** 3.29.1 --- ## 3.29.1 → 3.30.0 _Test environment only; not yet in production._ - New component `glow` and `glow_visualization`. - `shine` — the `t-zone` and `u-zone` measurement locations now also carry the `Diffuse shine` and `Specular shine` measures. - `wrinkles` — measurement locations now carry `ut_zone` tags (previously all `none`). - Spec corrections, no change in responses: status code `1201` added (it was already emitted); `4000` corrected to an error; `205` marked obsolete (`319` covers tight framing); `gender` enum includes `unknown`; `inverse_color_balance_rb` formula corrected. ## 3.29.0 → 3.29.1 - Acne model updated — reduced false positives; fixed incorrect shape of visualization data intensity in acne analysis. - `ImageVisualizationDataType2` schema — maximum values updated. ## 3.28.0 → 3.29.0 - `acne` — status code `3000` reactivated; analysis is aborted when certain CV warnings are detected. - `acne` — improved analysis parameters. ## 3.27.0 → 3.28.0 - `skin_age` — improved. ## 3.26.0 → 3.27.0 - `makeup` — eye color detection completely revised for better performance. - Status code `1121` is now obsolete due to the improved eye color implementation. - New status code `99` — [custom context] undefined failure. ## 3.25.0 → 3.26.0 - New component `skin_type` and `skin_type_visualization` — categorical skin-type classifier (1–8: normal, dry, oily, combination, sensitive variants). - New component `hyperpigmentation_adjusted` — alternative hyperpigmentation score. - `acne` — changed detection algorithm; now accepts all images that pass general CV quality checks (previously rejected under additional conditions). - Status code `3000` (acne abort) marked obsolete, reflecting the relaxed acne image acceptance above. - `shine` — new measurement locations added: u-zone and t-zone. - Internal improvements affecting all components — individual results can change noticeably compared to 3.25.0, though the average change is small. ## 3.24.0 → 3.25.0 - New component `skin_age` — returns an integer 0–100 estimated skin age. - `gender` parameter now accepts `unknown`. Specifying `female` or `male` is still recommended when known. - New status code `7000` — skin age analysis aborted due to image quality concerns or internal error. ## 3.23.0 → 3.24.0 - Internal improvements. No changes to the public API surface. ## 3.22.1 → 3.23.0 - Internal improvements. No changes to the public API surface. ## 3.22.0 → 3.22.1 - `pore_dilation` — analysis now proceeds at face-area resolutions below the previous hard minimum, rather than aborting. - New status code `2001` (warning) — emitted by `pore_dilation` when face-area resolution is lower than ideal but analysis continues. - Status code `2000` (error) threshold relaxed — the strict 1200 px face-width minimum is no longer enforced; the description text remains unchanged. ## 3.21.1 → 3.22.0 - New component `radiance_adjusted` — alternative radiance score. - `hair` — improved hair detection; affects all sub-findings (colour, volume, type, frizziness). ## 3.21.0 → 3.21.1 - `eyes` — improved dark circles calculation. ## 3.20.0 → 3.21.0 - `pore_dilation` — now analyzes both the U-zone and T-zone of the face, replacing the previous cheek-area-only analysis. - `ut_zone` property added to `ImageMeasurementLocation` across all metrics — reports whether a location is in the U-zone, T-zone, or neither. --- ## 3.25 → 3.29 Source: src/content/docs/migrations/3-25-to-3-29.mdx > Migration guide for upgrading the Skin Analysis API integration from 3.25.0 to 3.29.1. The 3.25 → 3.29 transition is **additive** — no payload field that existed in 3.25.0 changes shape or disappears. New components and a new status code arrive; one schema maximum is corrected. ## Summary - New components you may want to opt into: `skin_type` (with `skin_type_visualization`). `hyperpigmentation_adjusted` is also new — an alternative hyperpigmentation score for special cases; `hyperpigmentation` remains the standard choice. - One new status code: **`99`** (custom-context, undefined failure). Status code `1121` is obsolete, and `acne` now returns `3000` when certain image-quality warnings are present. - The schema `maximum` for visualization intensities was corrected from 500 to 2500 to match actual `acne_visualization` output. If your UI clamps at 500, raise it. - Treat `local_warnings[]` codes as advisory, not contractual: render whatever findings come back, hide the cards that don't. ## Step by step ### 1. Update the spec reference If you generate clients from the OpenAPI document, point your generator at the new spec: - Live URL: `https://api.revieve.com/openapi/skin-analysis.yaml` - Or pin to a commit in this repo. ### 2. Handle the new status code `99` is a generic error code that can be raised wherever a failure has no more specific code. Currently only `makeup` eye-colour analysis emits it, in that finding's `local_warnings[]` — hide that result; the other findings are still usable. Handle it by where it appears, like any other error: in `status[]` it means the whole analysis failed. See [Status codes](/concepts/status-codes/#use-in-code). ### 3. Opt into new components (optional) Add to your `components` query string only what your UI surfaces: ```diff -?components=wrinkles,redness,acne,hyperpigmentation +?components=wrinkles,redness,acne,hyperpigmentation,skin_type ``` Each new component adds work for the model. Don't request what you don't render. ### 4. Adjust visualization rendering `acne_visualization` intensities are on a `[0, 2500]` scale. The schema previously declared a `maximum` of 500 for visualization intensities; 3.29.1 corrects it to 2500 to match actual output. If your renderer clamps at 500, raise it to 2500. ### 5. Code defensively against `local_warnings[]` The `local_warnings[]` array is advisory, not a stable contract. Render whatever findings come back; hide the cards whose `local_warnings[]` indicates an unusable result for that metric. Don't hard-fail the whole UI on any specific code. ## What hasn't changed - The endpoint path and authentication model. - The `image` requirements (JPEG, ≥ 600×600). - The shape of `face_area`, top-level `status`, and `inverse_color_balance_rb`. - The `value` normalisation (`0..1`) on numeric findings. - The deprecation of `value_raw`. ## Compatibility You can't pin the API to an older version — each environment runs a single version. Because the change is additive, a client written against 3.25.0 keeps working on 3.29.1 unchanged; the new components only appear if you request them.