Answers
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 part of every Enterprise deployment and is 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 an idempotency key, so a retry with the same key is counted once.
| Item | Published fact |
|---|---|
| Supported client | fetch against POST /api/v1/cohort/query |
| npm listing | 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. |
| Included on | REST access for client teams. MCP access in every Enterprise deployment, configured per workspace. Keys are issued by the Lewsearch team. |
| Auth | Authorization: Bearer sk-lew-… |
| Accuracy claim | Calibrated 50-state benchmark: 7.07-point average miss on the best 80% of 1,521 scored questions (1,216 retained). 10.02 points across every scored question. 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?
- Every study is calibrated against published survey data before it reaches you. The calibrated 50-state benchmark: 7.07-point average miss on the best 80% of 1,521 scored questions (1,216 retained). 10.02 points across every scored question. 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 part of every Enterprise deployment and is 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.
Check the work
Related answers
Canonical: https://lewsearch.com/answers/npm-package-for-survey-research