/v1/proportion
Sample size for a proportion
Try it live
10 free calls per day — no sign-up, no API key. Goes through the oanor gateway.
It works. Grab an API key and use it in your project.
Get an API keyCode snippets
curl "https://api.oanor.com/samplesize-api/v1/proportion" \ -H "x-oanor-key: oanor_test_..."
await fetch("https://api.oanor.com/samplesize-api/v1/proportion", {
headers: { "x-oanor-key": "oanor_test_..." }
});
$ch = curl_init("https://api.oanor.com/samplesize-api/v1/proportion");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["x-oanor-key: oanor_test_..."]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$out = curl_exec($ch);
import requests
requests.get(
"https://api.oanor.com/samplesize-api/v1/proportion",
headers={"x-oanor-key": "oanor_test_..."}
)
Example response
A real response from this endpoint, captured by the latest health check.
{
"data": {
"note": "Proportion sample size n = z²·p(1−p)/E²; p = 0.5 is the worst case (largest n). With a population N the finite-population correction is applied. A ±5 % margin at 95 % needs 385.",
"inputs": {
"confidence": 0.95,
"proportion": 0.5,
"margin_of_error": 0.05
},
"z_score": 1.959964,
"unrounded": 384.1459,
"required_sample_size": 385
},
"meta": {
"timestamp": "2026-06-05T19:50:22.395Z",
"request_id": "776ba2fe-fbf4-4b28-9c11-ab5961ff28e2"
},
"status": "ok",
"message": "Sample size for a proportion",
"success": true
}