Web API Documentation

v0.12.19
Alpha Release — API endpoints and rate limits are provisional.
Campaign API Key: scitex-cloud-campaign-20260101-20261231-alpha

📊 Stats API

Quick Plot (Try in Browser)

Get a publication-ready figure by simply opening a URL in your browser. No tools needed — just click the link below or paste it in your address bar.

GET /api/stats/plot/

Query Parameters

Parameter Type Required Description
test_name string Required Test name: ttest_ind, ttest_paired, anova, mann_whitney, wilcoxon, kruskal, chi2
data string Required Comma-separated numbers (e.g., 1,2,3,4,5)
data2 string Optional Second group, comma-separated (e.g., 2,3,4,5,6)
alternative string Optional two-sided (default), less, greater

Try It Now

Click this link to see a t-test result figure in your browser:

Browser URL
https://scitex.ai/api/stats/plot/?test_name=ttest_ind&data=1,2,3,4,5&data2=2,3,4,5,6

Response: Raw PNG image (Content-Type: image/png) displayed directly in the browser.

Run Statistical Tests

Execute statistical tests using the scitex.stats backend. Supports t-tests, ANOVA, Mann-Whitney, Wilcoxon, chi-squared, and more. Returns test statistics, p-values, effect sizes, and APA-formatted results.

POST /api/stats/calculate/

Request Body (JSON)

Parameter Type Required Description
test_name string Required Test name: ttest_ind, ttest_paired, anova, mann_whitney, wilcoxon, kruskal, chi2
data array Required First data array (numbers)
data2 array Optional Second data array for two-sample tests
groups array Optional List of arrays for multi-group tests (ANOVA, Kruskal)
alternative string Optional two-sided (default), less, greater
plot boolean Optional Set true to generate a publication-ready figure. Returns figure_base64 (PNG, base64-encoded) in the result
figure_format string Optional Set "png" to return raw PNG image directly (requires plot: true). Viewable in browser. Default: returns base64 in JSON

Example: Independent t-test with Figure

cURL
curl -X POST "https://scitex.ai/api/stats/calculate/" \
     -H "Content-Type: application/json" \
     -d '{"test_name": "ttest_ind", "data": [1,2,3,4,5], "data2": [2,3,4,5,6], "plot": true}'

JSON Response

{
  "success": true,
  "result": {
    "test_method": "Student's t-test (independent)",
    "statistic": -1.0,
    "stat_symbol": "t",
    "pvalue": 0.3466,
    "stars": "ns",
    "significant": false,
    "effect_size": -0.632,
    "effect_size_metric": "Cohen's d",
    "effect_size_interpretation": "medium",
    "power": 0.143,
    "figure_base64": "iVBORw0KGgoAAAANSUhEUgAA...(base64 PNG data)...",
    "formatted": "t = -1.000, p = 0.3466, Cohen's d = -0.632, ns"
  },
  "formatted": "t = -1.000, p = 0.3466, Cohen's d = -0.632, ns"
}

Get Raw PNG Image (Browser-Viewable)

Add "figure_format": "png" to receive a raw PNG image directly instead of JSON. Try pasting this URL-style request into your workflow:

cURL
curl -X POST "https://scitex.ai/api/stats/calculate/" \
     -H "Content-Type: application/json" \
     -d '{"test_name": "ttest_ind", "data": [1,2,3,4,5], "data2": [2,3,4,5,6], "plot": true, "figure_format": "png"}' \
     -o result.png

Response: Raw PNG image (Content-Type: image/png) — open directly in browser or save to file.

CSV Upload Mode New

Upload a CSV file with column names instead of passing inline data arrays. Works with /calculate/, /describe/, /effect-size/, /posthoc/, and /correct/. Same URLs — the API detects the input mode from the Content-Type header.

POST /api/stats/calculate/ multipart/form-data

Form Fields

Field Type Required Description
csv_file file Required CSV or TSV file (max 10 MB)
test_name string Required Statistical test name
data_col string Depends Column name for primary data
data2_col string Optional Column name for second group
group_col string Optional Column name for splitting groups
group_values string Optional Comma-separated group values (e.g., control,treatment)
pvalues_col string Optional Column of p-values (for /correct/)

Example: T-test from CSV (two columns)

cURL
curl -F "[email protected]" \
     -F "test_name=ttest_ind" \
     -F "data_col=control_group" \
     -F "data2_col=treatment_group" \
     "https://scitex.ai/api/stats/calculate/"

Example: ANOVA from CSV (group column)

cURL
curl -F "[email protected]" \
     -F "test_name=anova" \
     -F "data_col=score" \
     -F "group_col=condition" \
     -F "group_values=placebo,low_dose,high_dose" \
     "https://scitex.ai/api/stats/calculate/"

Descriptive Statistics

Calculate descriptive statistics: mean, standard deviation, median, quartiles, skewness, kurtosis, and more.

POST /api/stats/describe/

Request Body (JSON)

Parameter Type Required Description
data array Required Array of numbers
percentiles array Optional Custom percentiles, e.g., [25, 50, 75]

Example

cURL
curl -X POST "https://scitex.ai/api/stats/describe/" \
     -H "Content-Type: application/json" \
     -d '{"data": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]}'

JSON Response

{
  "success": true,
  "result": {
    "mean": 5.5,
    "std": 2.872,
    "median": 5.5,
    "q25": 3.25,
    "q75": 7.75,
    "min": 1.0,
    "max": 10.0,
    "count": 10,
    "nanskewness": 0.0,
    "nankurtosis": -1.2
  }
}

Test Recommendations

Get recommendations for appropriate statistical tests based on your data characteristics.

POST /api/stats/recommend/

Request Body (JSON)

Parameter Type Required Description
n_groups integer Optional Number of groups (default: 2)
sample_sizes array Optional List of sample sizes per group
outcome_type string Optional continuous (default) or categorical
design string Optional between (default) or within
paired boolean Optional Whether samples are paired
has_control_group boolean Optional Whether there is a control group
top_k integer Optional Number of recommendations (default: 3)

Example

cURL
curl -X POST "https://scitex.ai/api/stats/recommend/" \
     -H "Content-Type: application/json" \
     -d '{"n_groups": 3, "outcome_type": "continuous", "design": "between"}'

Effect Size

Calculate effect size measures: Cohen's d, eta-squared, epsilon-squared, Cliff's delta, and probability of superiority.

POST /api/stats/effect-size/

Request Body (JSON)

Parameter Type Required Description
measure string Required cohens_d, eta_squared, epsilon_squared, cliffs_delta, prob_superiority
group1 array Required First group data
group2 array Optional Second group data
groups array Optional List of arrays for multi-group measures
paired boolean Optional Whether samples are paired (Cohen's d)

Example

cURL
curl -X POST "https://scitex.ai/api/stats/effect-size/" \
     -H "Content-Type: application/json" \
     -d '{"measure": "cohens_d", "group1": [1,2,3,4,5], "group2": [3,4,5,6,7]}'

Post-hoc Tests

Run pairwise post-hoc comparisons after significant ANOVA or Kruskal-Wallis results.

POST /api/stats/posthoc/

Request Body (JSON)

Parameter Type Required Description
method string Required tukey, games_howell, dunnett
groups array Required List of group arrays
group_names array Optional Names for each group
alpha float Optional Significance level (default: 0.05)

Example

cURL
curl -X POST "https://scitex.ai/api/stats/posthoc/" \
     -H "Content-Type: application/json" \
     -d '{"method": "tukey", "groups": [[1,2,3], [4,5,6], [7,8,9]], "group_names": ["A", "B", "C"]}'

Power Analysis

Calculate statistical power or required sample size for a given effect size.

POST /api/stats/power/

Request Body (JSON)

Parameter Type Required Description
effect_size float Required Expected effect size (Cohen's d)
n integer Optional Sample size (provide to calculate power)
alpha float Optional Significance level (default: 0.05)
power float Optional Desired power (default: 0.8). Used to calculate required n
test_type string Optional one-sample, two-sample (default), paired

Example

cURL
curl -X POST "https://scitex.ai/api/stats/power/" \
     -H "Content-Type: application/json" \
     -d '{"effect_size": 0.5, "power": 0.8, "alpha": 0.05}'

Multiple Comparison Correction

Apply correction methods to a set of p-values: Bonferroni, FDR (Benjamini-Hochberg), Holm, Sidak.

POST /api/stats/correct/

Request Body (JSON)

Parameter Type Required Description
method string Required bonferroni, fdr, holm, sidak
pvalues array Required Array of p-values
alpha float Optional Significance level (default: 0.05)

Example

cURL
curl -X POST "https://scitex.ai/api/stats/correct/" \
     -H "Content-Type: application/json" \
     -d '{"method": "bonferroni", "pvalues": [0.01, 0.04, 0.03, 0.005]}'

Decision Flowchart

Get a statistical test decision tree as Mermaid diagram, JSON, or SVG. Helps choose the right test based on data characteristics.

GET /api/stats/flowchart/

Query Parameters

Parameter Type Required Description
format string Optional mermaid (default), json, svg

Example

cURL
curl "https://scitex.ai/api/stats/flowchart/?format=json"