Developers

Statistics API, OpenAPI & MCP

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.

Published by crosstabs.com · Named statistical review pending · Last updated

Choose an interface

  • OpenAPI 3.1 JSON specification — GET and POST schemas, operation IDs, errors, bounds, examples, CORS preflight, and health checks for the existing aggregate statistics API.
  • Hosted MCP endpoint — a separate 46-tool service. Start with get_started, get_runtime_status, and run_demo_analysis for a synthetic demo without uploads. File uploads need consent and a temporary workspace token.
  • Aggregate-only MCP endpoint — five public tools: search, fetch, get_headless_capabilities, analyze_crosstab, and render_crosstab. No respondent rows or private project storage.
  • Published local Python package — install crosstabs 1.4.0 and run crosstabs-headless as a stdio MCP server.

MCP clients initialize a connection and use tools/list to discover input schemas. MCP endpoints speak a protocol; opening them in an ordinary browser is not a setup flow. The MCP guide contains client configuration. The OpenAPI document describes the REST endpoints, not the separate hosted workspace API.

# Download the machine-readable REST contract
curl https://www.crosstabs.com/openapi.json

# Check runtime health without sending survey data
curl https://www.crosstabs.com/api/health

# Local stdio MCP (configure this command in your AI client)
pip install crosstabs==1.4.0
crosstabs-headless

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,
    "oddsRatioState": "finite",
    "oddsRatioCI": [0.2007, 0.9837],
    "oddsRatioCIStates": ["finite", "finite"]
  },
  "fishersExactUnavailableReason": null,
  "docs": "https://www.crosstabs.com/developers"
}

Endpoints

GET | POST /api/v1/contingency

Chi-square, G-test, Fisher's exact with conditional odds ratio, Cramér's V, phi, lambda, gamma, Kendall's tau, Somers' d, Theil's U, expected counts. Use /api/v1/odds-ratio for the sample odds ratio and Woolf interval.

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.

REST v1 compatibility and deprecation

Public REST v1 compatibility policy: breaking changes use a new major URL prefix rather than silently changing /api/v1. Additive response fields may be introduced; clients should tolerate unknown fields. Current v1 endpoints are not deprecated and have no scheduled sunset. If a deprecation is scheduled, the public changelog and developer documentation will publish the affected endpoints, migration guidance and planned dates. This policy is not an availability SLA or a promise of indefinite service.

Follow the public changelog for published changes. Migration instructions will be linked here when a replacement or scheduled deprecation is announced.

Limits & conventions

  • Inferential endpoints accept 2×2 through 12×12 finite, non-negative integer frequency tables with positive margins and N ≤ 1,000,000,000,000.
  • Fisher uses the two-sided Fisher–Irwin fixed-margin probability ordering for safe-integer counts and enumerates at most 100,000 feasible tables; larger supports return a machine-readable workload_limit reason (HTTP 422 on the dedicated exact endpoint).
  • POST bodies are limited to 16,384 bytes. The four statistics routes share an in-process limit of 30 requests per minute per client IP; separate serverless instances do not share counters. Infrastructure limits may also apply.
  • Unknown /api paths return HTTP 404 JSON with error, code=endpoint_not_found, hint and a documentation link. HEAD returns the status without a body.
  • Errors retain a human-readable error string and add a stable code plus an actionable hint. Fisher workload failures retain the analysis fields as well. Do not retry invalid input unchanged.
  • GET and POST responses expose RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset. Reset is ceiling seconds until the next sliding-window slot, not an epoch timestamp or full quota reset. On HTTP 429, wait the Retry-After seconds before retrying. These counters are process-local and reset on cold starts.
  • The odds-ratio endpoint encodes unbounded zero-cell results as a null numeric value plus an explicit positive_infinity state.
  • Calculation behavior and assumptions are summarized on the methods page and match the workspace and calculators.
  • Free for any use, including commercial. Please don't use it as a high-volume backend without getting in touch first.

See Methods for calculation behavior and assumptions. Email support@crosstabs.com to reach us, or use the support checklist.

MCP server for AI assistants

Connect a compatible Streamable HTTP MCP client to the free hosted service for 46 tools covering evidence, aggregate calculations, temporary projects, background jobs, and file handoff. No sign-in is needed to connect. Hosted uploads leave your device, require consent, and use token-protected workspaces whose access expires after 24 hours.

https://mcp.crosstabs.com/mcp

See the MCP setup and privacy boundaries before uploading. Export before expiry; provider backup retention is separate from active-data cleanup. Client-specific compatibility is not guaranteed.

For on-device processing, the MIT-licensed crosstabs 1.4.0 package provides a separate 35-tool headless server and 39 analytical tools plus runtime status on the Python statistics server. These local tool sets are not the hosted 46-tool list.

pip install crosstabs==1.4.0

The separate local Codex/Claude plugin repository is at barangaroo/crosstabs-codex-plugin. Package 1.4.0 has verified fresh public installs, including 35 local project tools. Guided weighting preview and apply are available with explicit population targets and recorded human confirmation; saving a sampling weight does not approve a survey design or authorize ordinary inference. Plugin source availability, native-host review and directory approval are separate. Exact status, setup instructions, and verified parity boundaries 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>