---
title: "Detect anomaly status of the latest point in time series."
method: POST
path: "/timeseries/last/detect"
---

# Detect anomaly status of the latest point in time series.

`POST /timeseries/last/detect`

This operation generates a model by using the points that you sent in to the API
and based on all data to determine whether the last point is anomalous.

## Request body

- UnivariateUnivariateDetectionOptions — Request of the entire or last anomaly detection.
  - `series` UnivariateTimeSeriesPoint[], required — Time series data points. Points should be sorted by time stamp in ascending order to match the anomaly detection result. If the data is not sorted correctly or there's a duplicated time stamp, the API won't work. In such a case, an error message is returned.
    - `timestamp` string, date-time — Argument that indicates the time stamp of a data point (ISO8601 format).
    - `value` number, float, required — Measurement of that point.
  - `granularity` 'yearly' | 'monthly' | 'weekly' | 'daily' | 'hourly' | 'minutely' | 'secondly' | 'microsecond' | 'none'
  - `customInterval` integer — A custom interval is used to set a nonstandard time interval. For example, if the series is 5 minutes, the request can be set as {"granularity":"minutely", "customInterval":5}.
  - `period` integer — Argument that indicates the periodic value of a time series. If the value is null or is not present, the API determines the period automatically.
  - `maxAnomalyRatio` number, float — Argument that indicates an advanced model parameter. It's the maximum anomaly ratio in a time series.
  - `sensitivity` integer — Argument that indicates an advanced model parameter between 0 and 99. The lower the value is, the larger the margin value is, which means fewer anomalies will be accepted.
  - `imputeMode` 'auto' | 'previous' | 'linear' | 'fixed' | 'zero' | 'notFill'
  - `imputeFixedValue` number, float — Specifies the value to fill. It's used when granularity is not "none" and imputeMode is "fixed".

## Response `200`

The request has succeeded.

- UnivariateUnivariateLastDetectionResult — Response of the last anomaly detection.
  - `period` integer, required — Frequency extracted from the series. Zero means no recurrent pattern has been found.
  - `suggestedWindow` integer, required — Suggested input series points needed for detecting the latest point.
  - `expectedValue` number, float, required — Expected value of the latest point.
  - `upperMargin` number, float, required — Upper margin of the latest point. UpperMargin is used to calculate upperBoundary, which is equal to expectedValue + (100 - marginScale)*upperMargin. If the value of latest point is between upperBoundary and lowerBoundary, it should be treated as a normal value. Adjusting the marginScale value enables the anomaly status of the latest point to be changed.
  - `lowerMargin` number, float, required — Lower margin of the latest point. LowerMargin is used to calculate lowerBoundary, which is equal to expectedValue - (100 - marginScale)*lowerMargin.
  - `isAnomaly` boolean, required — Anomaly status of the latest point. True means the latest point is an anomaly, either in the negative direction or in the positive direction.
  - `isNegativeAnomaly` boolean, required — Anomaly status of the latest point in a negative direction. True means the latest point is an anomaly and its real value is smaller than the expected one.
  - `isPositiveAnomaly` boolean, required — Anomaly status of the latest point in a positive direction. True means the latest point is an anomaly and its real value is larger than the expected one.
  - `severity` number, float — Severity score for the last input point. The larger the value is, the more severe the anomaly is. For normal points, the severity is always 0.

## Other responses

- `default` — An unexpected error response.

---

[API](https://skmtc.net/azure/apis/cognitiveservices-anomalydetector.md) · [All operations](https://skmtc.net/azure/apis/cognitiveservices-anomalydetector/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/azure/cognitiveservices-anomalydetector/revisions/3d72cecb974e/schema)
