Math & Numbers 3 credits COMPUTE

Statistics API

Compute comprehensive descriptive statistics from any array of numbers via REST API. Returns mean, median, mode, standard deviation, variance, min, max, sum, count, range, and common percentiles (p25, p50, p75, p90, p95, p99) in a single call.

Try it live →

How it works

POST a JSON array of numbers. The API computes all standard descriptive statistics and returns them as a structured object. Handles arrays of any size up to the API input limit.

Use cases

API Reference

POST https://slopshop.gg/v1/math-statistics
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

Input parameters

ParameterTypeRequiredDescription
input / numbers number | array required The number(s) to compute

Example response

{
  "data": {
    "result": 42.5,
    "input": [
      10,
      20,
      75
    ]
  },
  "meta": {
    "credits_used": 3,
    "engine": "real",
    "ms": 4
  }
}

Examples

Three real-world scenarios showing how developers use Statistics in production.

Example 1
Analyze API latencies
Compute p50/p95/p99 from a sample of API response time measurements.
curl -X POST https://slopshop.gg/v1/math-statistics \
  -H "Authorization: Bearer $SLOPSHOP_KEY" \
  -H "Content-Type: application/json" \
  -d '{"numbers": [12, 45, 23, 67, 89, 34, 12, 56, 78, 23, 44, 102, 15, 33, 28]}'
Example 2
Summarize sales data
Get mean, median, and standard deviation of monthly sales figures.
curl -X POST https://slopshop.gg/v1/math-statistics \
  -H "Authorization: Bearer $SLOPSHOP_KEY" \
  -H "Content-Type: application/json" \
  -d '{"numbers": [42000, 51000, 38000, 67000, 59000, 44000, 71000, 55000, 48000, 62000, 49000, 73000]}'
Example 3
Validate data distribution
Check if a set of model confidence scores has expected distribution before training.
curl -X POST https://slopshop.gg/v1/math-statistics \
  -H "Authorization: Bearer $SLOPSHOP_KEY" \
  -H "Content-Type: application/json" \
  -d '{"numbers": [0.92, 0.87, 0.45, 0.91, 0.23, 0.78, 0.88, 0.61, 0.95, 0.33, 0.72, 0.84]}'

Code examples

curl

curl -X POST https://slopshop.gg/v1/math-statistics \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input": "your data here"}'

Python

import requests

response = requests.post(
    "https://slopshop.gg/v1/math-statistics",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={"input": "your data here"}
)
result = response.json()
print(result["data"])

Node.js

const response = await fetch("https://slopshop.gg/v1/math-statistics", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({ input: "your data here" })
});
const { data } = await response.json();
console.log(data);

CLI

# Install the Slopshop CLI
npm install -g slopshop

# Set your API key
export SLOPSHOP_KEY=your_api_key

# Call math-statistics
slop math-statistics '{"input": "your data here"}'

Pricing

Credits per call
3
credits
Cost per call
$0.003
at Starter tier
Tier
COMPUTE
Pure compute

Credits are purchased in bundles starting at $1 for 1,000 credits. All compute APIs like this one use 3 credits per call — that's $0.003. See all pricing tiers.

Related APIs in Math & Numbers

View the full API catalog · Try in playground · Documentation