Trend

A free anomaly detection and forecasting API. Get started quickly with state-of-the-art algorithms. No need to set up your own infrastructure.

Loading...

Visit Playground

The API does not require authentication. There’s a limit of 1,000 requests per day per IP. Time series posted to the API are never logged or stored.

Anomaly Detection

Detect anomalies in a time series.

The current version uses STL with multiple seasonal components for decomposition.

POST /anomalies HTTP/1.1
Host: trendapi.org
Content-Type: application/json

{
  "series": {
    "2018-01-01": 150,
    "2018-01-02": 125,
    "2018-01-03": 133
  }
}

Returns JSON structured like this:

{
  "anomalies": [
    "2018-01-10",
    "2018-01-13"
  ]
}

Forecasting

Get future predictions for a time series.

The current version uses TBATS for predictions.

POST /forecast HTTP/1.1
Host: trendapi.org
Content-Type: application/json

{
  "series": {
    "2018-01-01": 150,
    "2018-01-02": 125,
    "2018-01-03": 133
  },
  "count": 3
}

Returns JSON structured like this:

{
  "forecast": {
    "2018-03-01": 137.5,
    "2018-03-02": 122.9,
    "2018-03-03": 144.1
  }
}
If you get a flat or linear forecast, this is expected. It means no seasonality is detected in the series.

Errors

The API uses HTTP status codes to indicate errors.

Code Description
400 There’s an issue with the request parameters.
403 Rate limit exceeded.
500 We had a problem with our server.
503 The request took too long. This likely means the API is under heavy load.

The body will contain details about the specific error.

{
  "error": "Missing parameter: series"
}

Clients

A client library is available for Ruby.

Here’s an example with jQuery:

var series = {}, i, date, data;
for (i = 1; i < 30; i++) {
  date = new Date(2018, 3, i);
  series[date.toISOString()] = date.getDay();
}
data = {series: series};

$.post("https://trendapi.org/forecast", data, function(resp) {
  console.log(resp);
}, "json");

About

This service was created by ankane.

A special thanks to Rob J Hyndman for his incredible work on forecasting. Learn more about the topic from his free online book.

Questions or comments? Interested in other APIs? Get in touch.