Research API
A calibrated panel, in one HTTP call.
Ask any question in code and get back how a representative panel of people would answer: a structured distribution with an honest confidence read and panel composition. No survey to build, no panel to recruit. Published accuracy: 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).
POST /api/v1/cohort/query · Bearer sk-lew-… · included on Pro and Enterprise
What you get
One endpoint
POST a question, options, and an audience. Get a calibrated answer distribution back as JSON.
Structured output
Every response includes panel composition, a confidence tier, and a one-line summary.
Targetable & metered
Set the market and panel size; usage is metered by respondents queried against your plan's monthly pool.
Quick start
One HTTP call.
One endpoint over plain HTTP, so it works from any language with no client library.
curl
curl https://lewsearch.com/api/v1/cohort/query \
-H "Authorization: Bearer sk-lew-..." \
-H "Content-Type: application/json" \
-d '{
"question": "Would you switch brands at $4.99?",
"options": ["Definitely", "Probably", "Probably not", "No"],
"audience": { "market": "national_us", "n": 500 }
}'TypeScript / JavaScript
There is no published npm package yet. Use fetch:
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 at $4.99?",
options: ["Definitely", "Probably", "Probably not", "No"],
audience: { market: "national_us", n: 500 },
}),
}).then((r) => r.json());
console.log(res.summary);
// "Among US adults (n=500), Probably leads at 38% (vs No 27%...). Directional read."
console.log(res.distribution, res.confidence);Programmatic research
Wire the panel into your own tools.
Price sensitivity at scale
Loop the same concept across price points and read the demand curve from thousands of calibrated respondents. Conjoint-style insight in minutes, before you field a custom study.
Message testing across segments
Fire the same claim at dozens of audience definitions in parallel and compare how each segment splits. Find the angle that lands before you spend on media.
Concept & feature screening
Rank features, names, or positioning across a representative panel programmatically. Wire it straight into your prioritization pipeline.
Always-on research ops
Embed calibrated reads into dashboards, agents, and internal tools. Every response ships an honest confidence tier and panel composition, so automation stays defensible.
Example: a price demand curve
// Trace a demand curve across price points, in minutes.
const prices = [2.99, 3.99, 4.99, 5.99];
for (const price of prices) {
const res = await poll({
question: "Would you buy this at $" + price + "?",
options: ["Yes", "No"],
audience: { market: "national_us", n: 1000 },
});
const yes = res.distribution.find((d) => d.option === "Yes")?.pct ?? 0;
console.log("$" + price + " -> " + yes + "% would buy");
}
// poll() is your own four-line wrapper around the fetch above.Endpoint reference
POST /api/v1/cohort/query
Authenticate with Authorization: Bearer sk-lew-…. Body is JSON.
Request body
| Field | Type | Description |
|---|---|---|
| question | string · required | The question to put to the panel. |
| options | string[] · optional | 2-6 options for a calibrated multiple-choice read. Omit for a directional free-form read (no numeric accuracy claim). |
| audience.market | string · required | Market id, e.g. national_us, columbus, atlanta, texas. Unknown or missing ids are rejected. |
| audience.n | number · optional | Panel size. Clamped to your plan's per-query maximum. |
| request_id | string · optional | Idempotency key. A retried request with the same id is billed once. |
Response
{
"ok": true,
"request_id": "b1f2...",
"mode": "mc",
"question": "Would you switch brands at $4.99?",
"summary": "Among US adults (n=500), Probably leads at 38% ...",
"distribution": [
{ "option": "Probably", "pct": 38.0, "count": 190 },
{ "option": "No", "pct": 27.0, "count": 135 }
],
"panel_composition": {
"n_real": 500, "n_synthetic": 0, "n_total": 500,
"market_mode": "live_panel", "market": "national_us"
},
"confidence": { "score": 0.74, "label": "Directional", "tier": "amber" },
"usage": { "respondents_billed": 500, "month_used": 12500, "month_limit": 1000000 }
}Always check confidence.tier before leaning on a number. Pass 2-6 options for the calibrated multiple-choice path; omit them for a directional free-form read.
Keys & scale
The API is included on Pro.
Pro · no add-on fee
Pro includes the research API: up to five active keys, 30 requests a minute, panels up to 1,000 respondents a call, and 400,000 respondents a month across your keys. Email us and we will issue your first key while the key manager ships in the terminal. Free and Starter accounts get a demo key good for five calls.
See Pro pricing →Enterprise · dedicated inference
An Enterprise deployment runs on a dedicated Lewis instance, so there are no external API calls and no per-call inference cost. Rate limits and the monthly respondent pool are sized to your contract. Per-seat keys and an audit log are built during onboarding.
See Enterprise →Get started
The API is included with Pro.
npm package for survey research · MCP server for market research