Try for free and save 93% of the time needed to set up dashboards and alerts.
The API gives you possibility to perform calculations based on input data encoded as JSON. The API can be conveniently used from a programming language supporting sending HTTP requests, or directly from a command-line interface using curl or similar tools.

API specification

The format of an API URL is:<name>

where <name> is a name of a calculator. Full URLs with <name> filled are displayed at the bottom of a calculator page, which you can access from the main page.

Calculator's arguments must be encoded as a JSON array. Each type of arguments must be encoded as follows:

  • a single number - as a single number
  • a sequence/vector - as an array
  • a matrix - as an array of arrays (rows)

A JSON-encoded array with arguments must be passed directly as either GET or POST data. The preferred method is to use POST and set Content-Type HTTP header to application/json.

Returned data will be encoded as JSON. In case of an error, a response will have HTTP status code 400 (Bad Request) and will consist of a single string describing the error.


Variance of a sequence - command line usage
$ curl -d '[[1, 1.2, 0.8, 1.3]]'
Passing a matrix - solving linear equations
$ curl -d '[ [[1, 2], [3, 4]], [1, 2] ]'
Generating random samples from the Gaussian distribution
$ curl -d '[5, 0, 1]' 
Python example using requests library
import requests, json

args = [1,2,3,4,5]
r ='',
    headers={'content-type': 'application/json'})
result = r.json()

Using API from Google Apps Script
First we define a generic function for calling any API method:
function callCfx(url, argsArray) {
  var payload = JSON.stringify(argsArray);
  var options = {
     "method" : "post",
     "payload" : payload,
     "contentType": "application/json"
  var result = UrlFetchApp.fetch(url, options);
  return JSON.parse(result.getContentText());
Now we can use it by passing API URL as the first argument and arguments as the second:
var res = callCfx('', [[1,2,3], [1,4,8]]);

Javascript example using jQuery
(due to restrictions on AJAX cross-domain calls this will not work when embedded in a web page)
    url: '',
    data: JSON.stringify([ [[0,1,1], [0,1,2], [0,1,3]], 2 ]),
    success: function(data) {
        // data is a Javascript object - a number or an array

Usage limits

The API is free to use. It accepts input data sizes up to a few megabytes (which equals to hundreds of thousands of numbers). The access can be however throttled or a HTTP response 502 can be returned in case of high system load. Additionally time used by a single API call is limited to a few seconds.