npm package for survey research

The supported Lewsearch integration is one REST endpoint, POST /api/v1/cohort/query. A package named lewsearch appears on npm under the Swarmgram account. Lewsearch does not treat that package as a supported SDK and documents fetch against the REST API. You pass a question, optional options, and a required audience.market. You get a distribution, a confidence tier, and panel composition. REST access is set up for client teams. MCP access is an Enterprise offering configured per workspace.

Supported path: one endpoint

Registry metadata for lewsearch@0.1.0 lists the Swarmgram npm user and a GitHub URL that returned 404 on 2026-09-12. Affiliation of that listing is therefore unresolved as a supported product. Use the documented REST contract on /api-docs:

const res = await fetch("https://lewsearch.com/api/v1/cohort/query", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.LEWSEARCH_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    question: "Would you switch brands for this offer?",
    options: ["Definitely", "Probably", "Probably not", "No"],
    audience: { market: "national_us", n: 500 },
  }),
}).then((r) => r.json());

curl against the same endpoint is on the API page. audience.market is required. An optional request_id is echoed in the response and recorded with usage. Reusing it does not cache inference or guarantee protection against repeated quota reservations.

What actually ships
ItemPublished fact
Supported clientfetch against POST /api/v1/cohort/query
npm listingA package named lewsearch appears on npm under the Swarmgram account. Lewsearch does not treat it as a supported SDK. The supported integration is POST /api/v1/cohort/query.
Included onREST access for client teams. MCP is an Enterprise offering configured for the agreed workspace. Keys are issued by the Lewsearch team.
AuthAuthorization: Bearer sk-lew-…
Accuracy claimThe 500-question benchmark showcase records mean error of 3.72 points per answer in the September 1, 2026 historical evaluation. This is a calibrated retrospective benchmark, not an independent holdout or a guarantee for a new study. A narrower April test on 5 places with 10,000 respondents scored 7.47 points on 404 non-electoral questions.

FAQ

Is there an official Lewsearch npm package?
A package named lewsearch appears on npm under the Swarmgram account. Lewsearch does not treat it as a supported SDK. The supported integration is POST /api/v1/cohort/query.
What endpoint do I call instead?
POST https://lewsearch.com/api/v1/cohort/query. The body is JSON: question, optional options (2 to 6 when you want option shares), and audience.market / audience.n. audience.market is required. Authenticate with a Bearer key (sk-lew-…). Keys are issued with the team. Book a demo.
Is the programmatic panel as accurate as the website?
Calibration does not independently validate a new study or its subgroups. The 500-question benchmark showcase records mean error of 3.72 points per answer in the September 1, 2026 historical evaluation. This is a calibrated retrospective benchmark, not an independent holdout or a guarantee for a new study. A narrower April test on 5 places with 10,000 respondents scored 7.47 points on 404 non-electoral questions. Every response includes a confidence tier. Pass 2 to 6 options when you want option shares. Omit them for a directional free-form read with no numeric accuracy claim.
Who gets API access?
REST API access is set up for client teams. MCP access is an Enterprise offering configured per workspace. Keys, rate limits, and panel size are scoped to the engagement. Accounts and keys are set up by the Lewsearch team. Book a demo. See /api-docs.

Related answers

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