/v1/margin
Margin of error for a sample size
Pruébalo en vivo
10 llamadas gratis al día — sin registro, sin clave API. Pasa por el gateway de oanor.
Funciona. Consigue una clave API y úsala en tu proyecto.
Obtener una clave APIFragmentos de código
curl "https://api.oanor.com/samplesize-api/v1/margin" \ -H "x-oanor-key: oanor_test_..."
await fetch("https://api.oanor.com/samplesize-api/v1/margin", {
headers: { "x-oanor-key": "oanor_test_..." }
});
$ch = curl_init("https://api.oanor.com/samplesize-api/v1/margin");
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/margin",
headers={"x-oanor-key": "oanor_test_..."}
)
Respuesta de ejemplo
Una respuesta real de este endpoint, capturada en la última comprobación de estado.
{
"data": {
"kind": "proportion",
"note": "Proportion margin of error E = z·√(p(1−p)/n). A sample of 385 gives about ±5 % at 95 %.",
"inputs": {
"confidence": 0.95,
"proportion": 0.5,
"sample_size": 385
},
"z_score": 1.959964,
"margin_of_error": 0.04994451,
"margin_of_error_percent": 4.994451
},
"meta": {
"timestamp": "2026-06-05T19:50:22.175Z",
"request_id": "da6c5007-d870-4981-acd8-e8d04727955e"
},
"status": "ok",
"message": "Margin of error",
"success": true
}