Skip to content
Open navigation
OpenOpen workspace

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 · Last updated ·
How results are checkedNamed statistical review pending. Selected automated reference cases are published on the validation page.

Start here

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.
  • Local MCP package — install crosstabs 1.5.3 and add crosstabs-headless and crosstabs to your AI client as local (stdio) servers. Survey files stay on your computer.
  • Methodology MCP endpoint — a remote endpoint with five tools: search, fetch, get_headless_capabilities, analyze_crosstab, and render_crosstab. It takes count tables, not survey files, and stores nothing.

AI clients discover MCP tools and their inputs by themselves; opening an MCP endpoint in a browser shows nothing useful. The MCP setup guide has the configuration for Claude Desktop, Claude Code, Codex and other clients, including how to choose which folders the local server may read. The OpenAPI document describes the REST endpoints.

# 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 MCP: install with its own Python (needs uv, and Node.js 22+)
uv tool install --python 3.12 crosstabs==1.5.3
# Full path to give your AI client
echo "$(uv tool dir --bin)/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"
}

Reference

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.

Your own data sources

Pull from databases and survey platforms

The free, MIT-licensed crosstabs Python package (1.5 or later) runs on your own computer and turns a database query or a survey platform's responses into a file you open in the workspace. Credentials stay on your machine (environment variables, or a local sign-in for Google Forms); rows and credentials never reach a Crosstabs server.

  • crosstabs pull runs one read-only SELECT or WITH statement (or reads one table) through a connection URL held in an environment variable, and writes a .sav, .dta, .csv, .xlsx or .parquet file. Database drivers are optional extras such as postgres, mysql, mssql, oracle, snowflake, bigquery, databricks and duckdb.
  • crosstabs pull <platform> fetches responses from Qualtrics, SurveyMonkey, Medallia, Alchemer, Typeform, Google Forms, Forsta/Decipher, QuestionPro, Jotform, SurveySparrow, REDCap, KoboToolbox, ODK Central or LimeSurvey through each platform's API and writes a labelled file, with multi-select questions as 0/1 multiple-response sets. Weights are never applied or guessed.
  • crosstabs connect starts the local bridge: a small program on 127.0.0.1 that hands a table, query result or survey pull straight to the workspace tab that opened it, without writing a file. The workspace's Use the local bridge card pairs with it using a one-time code. How the bridge is protected.
# A read-only query from your own database into an SPSS file
pip install "crosstabs[postgres]>=1.5"
export CROSSTABS_DB_URL='postgresql://analyst@db.example.com/surveys'
crosstabs pull --url-env CROSSTABS_DB_URL --table public.responses --out wave3.sav

# Survey-platform responses (credentials for each platform: crosstabs pull <platform> --help)
pip install "crosstabs[surveys]>=1.5"
crosstabs pull qualtrics --survey SV_abc123XYZ --datacenter iad1 --out wave3.sav

# Or hand results straight to the open workspace tab
pip install "crosstabs[db,surveys]>=1.5"
crosstabs connect --sqlite survey.db

Your database or survey platform still sees the query or API request and the account that made it, under its own policies. The same pulls are available to local MCP clients as the pull_database_query and pull_survey_responses tools on the crosstabs statistics server.

AI and embeds

MCP server for AI assistants

The MCP server runs locally. Install the MIT-licensed crosstabs package and add crosstabs-headless and crosstabs as stdio servers in Claude Desktop, Claude Code, Codex, Cursor or another MCP client; survey files stay on your device. The project server reads only the folders you list in CROSSTABS_MCP_ALLOWED_ROOTS, plus a private exchange folder. See the MCP setup guide for client configuration.

The crosstabs 1.5.3 package has two servers: a 37-tool project server (crosstabs-headless) and a statistics server (crosstabs) with 39 analytical tools, six market-research tools, database and survey-platform pull tools, plus runtime status.

uv tool install --python 3.12 crosstabs==1.5.3
# or: pipx install crosstabs==1.5.3   (Python 3.10+)
# or, without installing: uvx crosstabs

The separate local Codex/Claude plugin repository is at barangaroo/crosstabs-codex-plugin; it pins the older crosstabs 1.4.0 package and is not listed in any plugin directory. Guided weighting preview and apply are available with population targets you supply and your recorded confirmation; saving a sampling weight does not approve a survey design or authorize ordinary inference. Setup instructions and what each route can do 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>