Math & Numbers 3 credits COMPUTE

Histogram API

Build histogram bins from number array. Available as a simple REST API — POST your input, get structured JSON back. 3 credits per call, no rate limiting, works in any language with HTTP support.

Try it live →

How it works

POST a JSON object with your input data to /v1/math-histogram. The API processes your request server-side using real computation (not mocked data) and returns a structured JSON response with your results and metadata including credits used and processing time.

Use cases

API Reference

POST https://slopshop.gg/v1/math-histogram
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 Histogram in production.

Example 1
Compute on sample data
Run histogram on a numeric dataset.
curl -X POST https://slopshop.gg/v1/math-histogram \
  -H "Authorization: Bearer $SLOPSHOP_KEY" \
  -H "Content-Type: application/json" \
  -d '{"numbers": [10, 25, 38, 42, 15, 88, 67, 31]}'
Example 2
Process a metrics array
Apply histogram to server latency measurements.
curl -X POST https://slopshop.gg/v1/math-histogram \
  -H "Authorization: Bearer $SLOPSHOP_KEY" \
  -H "Content-Type: application/json" \
  -d '{"numbers": [12, 45, 23, 78, 34, 56, 89, 11, 44, 67]}'
Example 3
Analyze financial data
Use histogram on monthly revenue figures.
curl -X POST https://slopshop.gg/v1/math-histogram \
  -H "Authorization: Bearer $SLOPSHOP_KEY" \
  -H "Content-Type: application/json" \
  -d '{"numbers": [42000, 51000, 38000, 67000, 59000, 44000]}'

Code examples

curl

curl -X POST https://slopshop.gg/v1/math-histogram \
  -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-histogram",
    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-histogram", {
  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-histogram
slop math-histogram '{"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