Catalog/psy-survey-sample-size

Statistics

Required survey sample size API

Computes the required survey sample size for a target margin of error on a proportion using Cochran's formula, with finite population correction. Answers 'How many respondents do I need for +/-5% at 95%?', 'How does my finite population reduce the needed sample?'.

Price$0.04per request
MethodPOST
Route/v1/stats/survey-sample-size
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
surveysample-sizecochranproportionpollingfinite-populationplanningsampling
API URLhttps://x402.hexl.dev/v1/stats/survey-sample-size
Integration docs
Example request
{
  "marginOfError": 0.05,
  "proportion": 0.5,
  "populationSize": 10000
}
Example response
{
  "sampleSizeInfinite": 385,
  "sampleSizeFinite": 370,
  "rawSampleSize": 384.1459,
  "marginOfError": 0.05,
  "confidence": 0.95,
  "assumedProportion": 0.5,
  "zCritical": 1.959964,
  "populationSize": 10000,
  "interpretation": "survey 370 respondents for ±5pp at 95% confidence"
}
Input schema
{
  "type": "object",
  "required": [
    "marginOfError"
  ],
  "properties": {
    "marginOfError": {
      "type": "number",
      "description": "target MoE 0..1",
      "examples": [
        0.05
      ]
    },
    "confidence": {
      "type": "number",
      "default": 0.95
    },
    "proportion": {
      "type": "number",
      "default": 0.5
    },
    "populationSize": {
      "type": "integer",
      "description": "optional; enables finite population correction"
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}