Developers

API reference

The REST endpoints under /api/v1: the survey format, starting and reading studies, results, limits and errors.

Using an AI agent? One line adds Forepop:

curl -fsSL https://forepop.com/install | sh

Windows, the MCP address and the Claude and ChatGPT apps: Agent install

Base address: https://forepop.com/api/v1. JSON in, JSON out. Every request needs Authorization: Bearer fp_live_YOUR_KEY (see Authentication). Every query is scoped to the key's workspace.

MethodPathWhat it does
GET/balanceThe key's workspace and its answers left.
POST/studies/estimateCheck a study and say what it would spend. Starts nothing.
POST/studiesStart a study. Spends answers. 201.
GET/studiesRecent studies, newest first. ?limit= 1 to 50, default 20.
GET/studies/{id}A study's status and progress.
GET/studies/{id}/resultsA complete study's results, or 409 with its status.

The study body

POST /studies and POST /studies/estimate take the same body: a survey and how many simulated people answer it. Unknown fields are refused.

FieldTypeNotes
survey.titlestringRequired, 1 to 200 characters.
survey.questionsarrayRequired, 1 to 200 questions. See below.
survey.audienceobjectOptional. Leave it out for all US adults 18+. See Audience.
survey.calibrationobjectOptional real answers to compare with, or an earlier wave. See Real answers.
survey.writtenAnswersbooleanOptional. Also write short answers in people's own words for single, rating, nps, slider, concept_test questions.
personasinteger1 to 100000, default 1000. How many simulated people answer.

Questions

FieldTypeNotes
typestringRequired. One of the types below.
textstringThe question as people read it, up to 1000 characters. Required for every type but content.
optionsarray of {label, id?, image?}Up to 100. Labels up to 500 characters.
rowsarray of {label, id?}Matrix statements only.
scale{min?, max?, minLabel?, maxLabel?}Whole numbers. Each type has a default.
idstringOptional; letters, digits, - or _. Needed only when skip logic points at the question.
requiredbooleanDefault true (false for content).
shufflebooleanShuffle the options for each person. Default true for single and multiple.
visibilityobjectWho sees it: {"mode": "everyone"} (default), or {"mode": "skip", "questionId", "optionId"} to show it only to people who picked that option on an earlier question.
imagestringFor concept_test and content: a data:image/png, jpeg, webp or gif base64 URL. Links to elsewhere are refused.
TypeNameNeeds
singleSingle choice2 or more options. One answer each.
multipleMultiple choice2 or more options. Any number of answers each.
image_choiceImage choice2 or more options, each with an image.
rankingRanking2 or more options to put in order.
ratingRating scalescale (default 1 to 5).
npsNPS 0 to 10Nothing else; the scale is 0 to 10.
sliderSliderscale (default 0 to 100).
price_ladderPrice ladder2 or more options, each a price.
price_sensitivityPrice sensitivityscale (default 0 to 100).
best_worstBest-worst3 or more options.
concept_testConcept testAn image of the concept, and scale (default 1 to 5).
matrixMatrix grid2 or more options (the columns) and rows (the statements).
open_textOpen textNothing else. Answers come back as written text.
contentPicture or text blockText or an image that is shown, not asked. Costs nothing.

Option and row ids are made for you when you leave them out. A survey that fails a check answers 422 with every problem found in issues; the checks are the studio's own "Before you run" list.

A fuller study
{
  "survey": {
    "title": "Meal kit concept",
    "questions": [
      {
        "id": "tried",
        "type": "single",
        "text": "Have you ordered a meal kit in the last 12 months?",
        "options": [
          {
            "id": "yes",
            "label": "Yes"
          },
          {
            "id": "no",
            "label": "No"
          }
        ]
      },
      {
        "type": "multiple",
        "text": "Why did you stop or never start?",
        "options": [
          {
            "label": "Too expensive"
          },
          {
            "label": "Too much packaging"
          },
          {
            "label": "Not enough choice"
          },
          {
            "label": "I like to shop myself"
          }
        ],
        "visibility": {
          "mode": "skip",
          "questionId": "tried",
          "optionId": "no"
        }
      },
      {
        "type": "rating",
        "text": "How appealing is a meal kit that costs $8 a serving?",
        "scale": {
          "min": 1,
          "max": 5,
          "minLabel": "Not appealing",
          "maxLabel": "Very appealing"
        }
      },
      {
        "type": "nps",
        "text": "How likely are you to recommend a meal kit to a friend?"
      },
      {
        "type": "matrix",
        "text": "How much do you agree with each statement?",
        "options": [
          {
            "label": "Disagree"
          },
          {
            "label": "Neutral"
          },
          {
            "label": "Agree"
          }
        ],
        "rows": [
          {
            "label": "Cooking at home saves money"
          },
          {
            "label": "I don't have time to plan meals"
          }
        ]
      }
    ]
  },
  "personas": 500
}

Audience

Every study runs for all US adults 18+, and survey.audience can be left out. Other ways of narrowing (another country, an age range, a written description) are refused before anything is spent, with a 422 that says so.

To answer as a narrower group, send audience.filter with one or more of age, gender, income and education, and groupAnswers: true. Values in one list are OR; lists are AND.

Answer as a group
"audience": {
  "filter": {
    "age": [
      "18-34"
    ],
    "gender": [
      "female"
    ]
  },
  "groupAnswers": true
}
FilterValues
age18-34, 35-44, 45-54, 55-64, 65-74, 75+
genderfemale, male
income<$25k, $25-50k, $50-100k, $100k+
educationno diploma, high school, some college, bachelor's, master's+

Real answers to compare with

If you already fielded the same survey, send its real answers in survey.calibration and the results show each estimate next to the real share, with the gap in points. They are sealed away from the model until the study finishes, so the comparison is blind. With earlier: true they are an earlier wave instead, and lead the results for the questions they cover.

Real answers
{
  "calibration": {
    "filename": "wave-1.csv",
    "respondents": 1012,
    "answers": {
      "QUESTION_ID": {
        "OPTION_ID": 412,
        "OTHER_OPTION_ID": 600
      }
    },
    "earlier": false,
    "fielded": "Oct 2 to Oct 16, 2026"
  }
}
  • answers is keyed by question id, then by answer: the option id for choice questions, or the scale value as a string ("7") when the scale spans 10 or less (NPS included). Wider scales use five bands, such as "0-20". Counts are whole numbers.
  • Give your questions and options ids so the keys match.
  • fielded is optional, up to 60 characters, in your own words.

Check the cost

POST /studies/estimate runs the same checks as starting a study and says what it would spend.

FieldMeaning
validAlways true in a 200; problems come back as a 422.
answers_neededWhat the study would spend: people × questions asked (content blocks are free).
answers_leftThe workspace's balance now.
enoughWhether the balance covers it.
personas, questions_run, questions_skippedThe study as it would run.
answered_as_groupWhether it would be answered as the filter's group.
audienceThe audience as it would be stored.

Start a study

POST /studies answers 201 with study (id, title, status, personas, created_at, finished_at), answers_spent, answered_as_group and hourly_cap ({limit, remaining, resets_at}). The answers are spent when the study starts. A study the engine can't run in the end gives its answers back. Most surveys come back within minutes.

Start a study
curl https://forepop.com/api/v1/studies \
  -H "Authorization: Bearer fp_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d @study.json

List and check studies

Recent studies
curl "https://forepop.com/api/v1/studies?limit=10" \
  -H "Authorization: Bearer fp_live_YOUR_KEY"
One study
curl https://forepop.com/api/v1/studies/STUDY_ID \
  -H "Authorization: Bearer fp_live_YOUR_KEY"

A study's status is queued, running, complete, failed or cancelled. While it runs, progress holds:

Progress
{
  "answered": 420,
  "target": 1000,
  "percent": 42,
  "questions_done": 2,
  "questions_total": 5,
  "started_at": "2026-12-01T10:02:00.000Z",
  "finished_at": null,
  "message": null
}

Check every few minutes at most.

Results

GET /studies/{id}/results returns the numbers behind the studio's results page. Until the study is complete it answers 409 not_ready with its status.

Results (shortened)
{
  "study": {
    "id": "3f6c2a1e-…",
    "title": "Streaming price change",
    "status": "complete",
    "personas": 60,
    "created_at": "…",
    "finished_at": "…"
  },
  "audience": null,
  "calibrated": false,
  "notes": {
    "percent_min_answered": 60,
    "simulated": "Every number is a model estimate. …",
    "error_points": "± is our average error. …"
  },
  "message": null,
  "questions": [
    {
      "id": "q1",
      "type": "single",
      "text": "If your streaming plan went from $12 to $15 a month, what would you do?",
      "answered": 60,
      "shows_percent": true,
      "mean_gap_points": null,
      "error_points": 6,
      "skipped": null,
      "real": null,
      "answers": [
        {
          "id": "q1_o_1",
          "label": "Keep my plan",
          "count": 31,
          "percent": 51.7,
          "real": null,
          "gap_points": null
        },
        "…"
      ]
    }
  ],
  "respondents": [
    {
      "persona": "…",
      "answers": {
        "q1": "Keep my plan"
      }
    }
  ]
}

The numbers above only show the shape; they are not a result.

FieldMeaning
questions[].answers[]Each option: count, percent (null under the minimum), and with real answers real and gap_points.
shows_percentPercents appear once at least 60 answered; below that, counts only.
error_pointsOur average error in points for estimates made this way, measured against real survey results. An average, not a guarantee.
interval_pointsWhen present, the spread of the estimate across different wordings of the question. It understates the error against real answers.
skippedA reason, when the engine couldn't estimate the question faithfully. It then has no answers.
writtenFor open_text: {persona, text} for each written answer.
respondentsEach simulated person: a short persona and their answer to each question, by question id.
notesPlain-language notes on reading the numbers. Pass them on with the results.

Limits

  • Each key can start 60 studies an hour. The count resets at the top of each hour (UTC).
  • A workspace can have 10 studies waiting or running at once. Past that, a new start gets queue_full until one finishes.
  • None of these limit how many answers a study has: that is up to your balance.
  • Each key can send 30 requests per 60 seconds, across the REST API and the MCP server.
  • Each address can send 120 requests a minute.
  • A request body can be up to 6 MB, pictures included.
  • Over a limit, the answer is 429 with a Retry-After header in seconds.

Errors

Every error has the same shape, with a message written to be shown to a person:

An error
{
  "error": {
    "code": "invalid_request",
    "message": "survey.questions[0].options: …",
    "issues": [
      "survey.questions[0].options: …"
    ]
  }
}
StatusCodeWhenExtra fields
401unauthorizedNo key, a malformed key, or a revoked one.
402insufficient_creditsFewer answers left than the study needs.answers_needed
403forbiddenThe key's maker is no longer in its workspace.
404not_foundNo study with that id in the key's workspace.
409not_readyResults asked for before the study is complete.status
413payload_too_largeThe body is over the size limit.
422invalid_requestThe study didn't pass the checks, or limit is out of range.issues
429rate_limited, hourly_cap_reached, queue_fullOver a limit.Retry-After header
503unavailableSomething went wrong on our side. Try again in a moment.
NextMCP serverA remote Model Context Protocol server with six tools to check, start, follow and read Forepop studies.