Developers

Free statistics API

JSON endpoints for contingency-table statistics — the same engine that powers the calculators and the workspace. No API key, no signup. CORS is open, so you can call it straight from a browser.

Reviewed by the crosstabs.com methods team · Last updated

Quick start

Pass your observed counts as a matrix. Rows are separated by ;, cells by , — the same format used by shareable calculator links.

# GET — table in the query string
curl "https://www.crosstabs.com/api/v1/chi-square?d=20,30;30,20"

# POST — table as JSON
curl -X POST https://www.crosstabs.com/api/v1/contingency \
  -H "Content-Type: application/json" \
  -d '{"table": [[20, 30], [30, 20]]}'

Response (abridged):

{
  "input": { "table": [[20, 30], [30, 20]], "n": 100, "rows": 2, "cols": 2 },
  "chiSquare": { "chiSquare": 4.0, "degreesOfFreedom": 1, "pValue": 0.0455 },
  "cramersV": { "value": 0.2, "label": "small" },
  "fishersExact": { "pValue": 0.0713, "oddsRatio": 0.4444, "oddsRatioCI": [0.2007, 0.9837] },
  "docs": "https://www.crosstabs.com/developers"
}

Endpoints

GET | POST /api/v1/contingency

Everything — chi-square, G-test, Fisher's exact, odds ratio, Cramér's V, phi, lambda, gamma, Kendall's tau, Somers' d, Theil's U, expected counts.

GET | POST /api/v1/chi-square

Chi-square test of independence with Yates' correction, G-test, Cramér's V, and a low-expected-count warning.

GET | POST /api/v1/fishers-exact

Fisher's exact test (two-sided) for 2×2 tables.

GET | POST /api/v1/odds-ratio

Odds ratio with 95% confidence interval (Woolf's logit method) for 2×2 tables.

Limits & conventions

  • Tables up to 12×12 with non-negative counts.
  • 30 requests per minute per IP. Need more? See the support page.
  • Undefined values (e.g. an infinite odds ratio when a cell is 0) serialize as null.
  • Methods and formulas are documented on the methods page and match the workspace and calculators exactly.
  • Free for any use, including commercial. Please don't use it as a high-volume backend without getting in touch first.

See Methods for formulas and references, and Support to reach us.

MCP server for AI assistants

Want Claude, ChatGPT, or your own agent to run rigorous contingency-table statistics? The open-source crosstabs MCP server exposes 40+ statistical tools (chi-square, exact tests, effect sizes, agreement measures, power analysis) over the Model Context Protocol.

pip install crosstabs

Setup instructions for Claude Desktop, Claude Code, and Cursor are on the MCP server page.

Embeddable calculators

Every calculator can be embedded on your site or course page with a one-line iframe — open any calculator, enter a table, and click Embed this calculator. Example:

<iframe src="https://www.crosstabs.com/embed/chi-square-calculator?d=20,30;30,20"
  width="100%" height="640" loading="lazy"
  style="border:1px solid #e2e8f0;border-radius:12px"
  title="Chi-square calculator — crosstabs.com"></iframe>