Answers

npm package for survey research

Lewsearch ships a typed JavaScript and TypeScript SDK as npm install lewsearch. The same calibrated panel is also available as POST /api/v1/cohort/query. You pass a question, optional options, and an audience. You get a distribution, a confidence tier, and panel composition. Published accuracy is the same figure as the website.

Install and one call

The package name and install line are taken from the public API docs, not guessed. /api-docs and /enterprise both print npm install lewsearch. The typed client is:

import { Lewsearch } from "lewsearch";

const ls = new Lewsearch({ apiKey: process.env.LEWSEARCH_API_KEY });

const res = await ls.poll({
  question: "Would you switch brands at $4.99?",
  options: ["Definitely", "Probably", "Probably not", "No"],
  audience: { market: "national_us", n: 500 },
});

curl against the same endpoint is documented on the API page. Defaults: market national_us, n clamped to the plan maximum. An optional request_id is an idempotency key.

Worked example: a price loop

The API docs show a demand-curve loop across $2.99, $3.99, $4.99, and $5.99, each call a calibrated poll. That is the developer-shaped version of a concept screen. It is still a synthetic panel, not a checkout experiment. Accuracy: 7.47% MAE on 404 ex-electoral questions, on methodology. Coverage: coverage (27 live panels · U.S. national · 4 census regions (32 audiences)).

What the npm package actually is
ItemPublished fact
Package namelewsearch (npm install lewsearch)
HTTP equivalentPOST /api/v1/cohort/query
AuthAuthorization: Bearer sk-lew-…
Accuracy claim7.47% mean absolute error on 404 ex-electoral questions of a 460-question benchmark vs real polls (Pew, Gallup, UT/Texas Politics Project, PPIC)

FAQ

What is the npm package for Lewsearch survey research?
The package name published on the API docs is lewsearch. Install it with npm install lewsearch. Import { Lewsearch } from "lewsearch". Authenticate with a Bearer key (sk-lew-…).
What endpoint does the SDK wrap?
POST https://lewsearch.com/api/v1/cohort/query. The body is JSON: question, optional options (2–6 for a calibrated multiple-choice read), and audience.market / audience.n.
Is the programmatic panel as accurate as the website?
7.47% mean absolute error on 404 ex-electoral questions of a 460-question benchmark vs real polls (Pew, Gallup, UT/Texas Politics Project, PPIC). Every response includes a confidence tier. Pass 2–6 options for the calibrated path; omit them for a directional free-form read with no numeric accuracy claim.
Who gets API access?
Enterprise deployments expose the REST API and the npm SDK, with per-seat keys. See /enterprise and /api-docs. This page does not invent a public npm download count.

Check the work

Related answers

Canonical: https://lewsearch.com/answers/npm-package-for-survey-research