Executive Summary: A skincare recommender app needs product search, structured ingredient data and a way to find products that match user preferences. This guide connects those pieces with The Beauty API, using Node.js examples for your backend.

The Beauty API brings product records, INCI-linked ingredients and ingredient functions together behind a REST API. That gives you a prepared foundation for search and recommendations, so you can focus on the experience you want to build.

Step 1: Get an API key

Sign up at the developer dashboard and create a key. New customers can start with a seven-day trial containing 100 requests total. The selected paid plan starts after seven days unless cancelled. Paid plans start at $40 a month with 10,000 included calls. Every request carries the key in an x-api-key header:

curl "https://api.thebeautyapi.com/v1/products/search?q=niacinamide" \
  -H "x-api-key: YOUR_API_KEY"

Treat the key as a secret. Call the API from your server (Next.js route handlers, Express, a Lambda), never from the browser or a mobile bundle, and read it from an environment variable. A small helper keeps the rest of the code clean:

const BASE = "https://api.thebeautyapi.com";

async function beauty(path, init = {}) {
  const res = await fetch(BASE + path, {
    ...init,
    headers: {
      "x-api-key": process.env.BEAUTY_API_KEY,
      "content-type": "application/json",
      ...(init.headers || {}),
    },
  });
  if (!res.ok) throw new Error(`Beauty API ${res.status} on ${path}`);
  return res.json();
}

Step 2: Find the product the user is talking about

Recommenders start with a product the user already owns or is considering. GET /v1/products/search matches on brand and name and is built for autocomplete, so you can wire it straight to a search box:

const { results } = await beauty(
  "/v1/products/search?q=" + encodeURIComponent("ordinary niacinamide")
);

// results[0] =>
// {
//   id: "06d9476a-397b-5f61-abc8-640b30a9ae23",
//   brand: "The Ordinary",
//   name: "Niacinamide 10% + Zinc 1%",
//   category: "skincare",
//   image_url: "https://images.thebeautyapi.com/06d9476a-....jpg"
// }

Search returns 20 results per page with a pagination.has_more flag. The image_url is a hosted product photo, so the search dropdown can show thumbnails with no extra work. If your app scans packaging, barcode-enabled plans can resolve a UPC or EAN to the same product with GET /v1/products/barcode/{barcode}.

Step 3: Fetch the product details

The search result is deliberately light. Once the user picks a product, fetch the complete record with GET /v1/products/{id}. This is the payload a recommender runs on:

if (!results.length) throw new Error("No matching products");
const product = await beauty("/v1/products/" + results[0].id);

// product.contains_fragrance       => false
// product.contains_drying_alcohol  => false
// product.contains_parabens        => false
// product.contains_sulfates        => false
// product.contains_silicones       => false
// Example ingredient entry from a single-list product:
// {
//   position: 1,
//   label_name: "Niacinamide 10.0%",
//   concentration: 10,
//   name: "Niacinamide",
//   rating: "direct actives",
//   irritancy: null,
//   comedogenicity: null,
//   functions: ["smoothing"],
//   other_names: "vitamin B3, nicotinamide",
//   ...
// }

Ingredient position preserves order within its list. concentration records a declared percentage where available. The five contains_* fields describe fragrance, drying alcohol, parabens, sulfates and silicones. The Ingredients data reference explains the fields and formula structures.

Step 4: Match ingredient preferences

Read single lists, sections and kit components with this helper. It keeps each match attached to its component and section so your interface can show it in context:

// Keep each component and section attached to its ingredient list.
function ingredientLists(record, component = null) {
  if (Array.isArray(record.components)) {
    return record.components.flatMap(part => ingredientLists(part, part.name));
  }
  if (Array.isArray(record.ingredient_sections)) {
    return record.ingredient_sections.map(section => ({
      component,
      section: section.heading,
      ingredients: section.ingredients ?? [],
    }));
  }
  return [{ component, section: null, ingredients: record.ingredients ?? [] }];
}

Now match the user's selected ingredient functions and names. Return the matching ingredients so your app can explain each suggestion:

function evaluate(product, profile) {
  const wanted = new Set((profile.functions ?? []).map(value => value.toLowerCase()));
  const avoid = new Set((profile.avoid ?? []).map(value => value.toLowerCase()));
  const lists = ingredientLists(product).map(list => ({
    component: list.component,
    section: list.section,
    matches: list.ingredients
      .filter(i => (i.functions ?? []).some(value => wanted.has(value.toLowerCase())))
      .map(i => i.name ?? i.label_name),
    avoidMatches: list.ingredients
      .filter(i => [i.name, i.label_name].some(name =>
        typeof name === "string" && avoid.has(name.toLowerCase())
      ))
      .map(i => i.name ?? i.label_name),
  }));
  return { lists };
}

const profile = { functions: ["humectant", "emollient"], avoid: ["Coconut Oil"] };
const assessment = evaluate(product, profile);

Canonical ingredient names help you compare products using shared terminology. The label name provides display text alongside those links. This example finds exact name and function matches; the ingredient search endpoint can resolve synonyms to IDs for discovery filters.

Step 5: Recommend alternatives

Use product filters to build a shortlist around the user's preferences. GET /v1/products filters by category, brand, origin, the five free-from booleans, and by ingredient. Ingredient filters take ingredient IDs, which you get from GET /v1/ingredients/search:

// 1. Resolve the ingredient the user wants to avoid
const ing = await beauty("/v1/ingredients/search?q=coconut%20oil");
if (!ing.results.length) throw new Error("No matching ingredient");
const coconutOilId = ing.results[0].id;

// 2. Discover fragrance-free skincare that excludes it
const alternatives = await beauty(
  "/v1/products?category=skincare&fragrance_free=true" +
  "&excludes_ingredient=" + coconutOilId + "&page=1"
);

// 3. Hydrate the shortlist in one round trip (up to 50 IDs)
const ids = alternatives.results.slice(0, 10).map(p => p.id);
const full = ids.length ? await beauty("/v1/products/batch", {
  method: "POST",
  body: JSON.stringify({ ids }),
}) : [];

const recommendations = full.filter(Boolean).map(product => ({
  product,
  assessment: evaluate(product, profile),
}));

excludes_ingredient accepts up to ten comma-separated IDs, so a user's whole avoid list can go into a single query. has_ingredient does the reverse for "show me products with azelaic acid". Run the discovery results through evaluate to display the matching ingredients alongside each product.

Production tips

  • Cache product records. The catalog changes on a release cadence, not in real time. Caching /v1/products/{id} responses for a day cuts your bill and keeps recommendations fast.
  • Use batch for routines. A user's routine is a list of IDs. One POST /v1/products/batch call fetches all of them instead of ten sequential requests.
  • Keep explanations specific. Show the ingredient names and functions that match the user's preferences, with their component or section labels.
  • Respect rate limits. Use your plan's request limit and debounce autocomplete calls. The API documentation explains throttling and usage.
  • Describe preference matches. Ingredient functions and reference ratings support product exploration; they do not establish medical suitability.

Prototype offline first

The free 1,000-product sample lets you explore the dataset offline with images. Follow its accompanying schema guide when importing the files; dataset ingredient links use numeric ingredient_id, while API entries use UUID id. The full endpoint reference, including error codes and the barcode base path, is in the API documentation.

The bottom line

Product search, ingredient preference matching and discovery filters give you a practical foundation for a skincare recommender. The Beauty API supplies structured product and ingredient data, leaving you to build the explanations and browsing experience that make your app useful.