> ## Documentation Index
> Fetch the complete documentation index at: https://docs.canaryedge.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Detect Last Point

> Azure-compatible endpoint to check if the latest data point is anomalous

Determines whether the most recent point in a series is anomalous, using prior points as context. This endpoint is fully compatible with the Azure Anomaly Detector API. Ideal for real-time streaming detection where new points arrive one at a time.

Both `/anomalydetector/v1.0/timeseries/last/detect` and `/anomalydetector/v1.1/timeseries/last/detect` are supported.

<ParamField body="series" type="array" required>
  Array of data points. The last point is evaluated; prior points provide context. Minimum 12 points, maximum 8640 points. Timestamps must be sorted ascending with no duplicates.
</ParamField>

<ParamField body="granularity" type="string" default="none">
  Time interval between points. One of: `yearly`, `monthly`, `weekly`, `daily`, `hourly`, `minutely`, `secondly`, `microsecond`, `none`.
</ParamField>

<ParamField body="customInterval" type="integer" default={1}>
  Multiplier for granularity.
</ParamField>

<ParamField body="period" type="integer" default={0}>
  Seasonality period. Set to `0` for auto-detection.
</ParamField>

<ParamField body="maxAnomalyRatio" type="number" default={0.25}>
  Maximum fraction of points that can be flagged as anomalies. Must be between 0 and 0.5 (exclusive).
</ParamField>

<ParamField body="sensitivity" type="integer" default={95}>
  Detection sensitivity (0-99). Higher values flag more anomalies.
</ParamField>

<ResponseField name="isAnomaly" type="boolean">
  Whether the last point is anomalous.
</ResponseField>

<ResponseField name="isNegativeAnomaly" type="boolean">
  Whether the last point is a negative anomaly.
</ResponseField>

<ResponseField name="isPositiveAnomaly" type="boolean">
  Whether the last point is a positive anomaly.
</ResponseField>

<ResponseField name="period" type="integer">
  Detected seasonality period.
</ResponseField>

<ResponseField name="expectedValue" type="number">
  The model's predicted value for the last point.
</ResponseField>

<ResponseField name="upperMargin" type="number">
  Upper margin for the last point.
</ResponseField>

<ResponseField name="lowerMargin" type="number">
  Lower margin for the last point.
</ResponseField>

<ResponseField name="suggestedWindow" type="integer">
  Recommended context window size for future requests. Calculated as `period * 4 + 1`, or `max(29, series_length)` if no period is detected.
</ResponseField>

<ResponseField name="severity" type="number">
  Severity score from 0.0 to 1.0.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.canaryedge.com/anomalydetector/v1.1/timeseries/last/detect \
    -H "Content-Type: application/json" \
    -H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" \
    -d '{
      "series": [
        {"timestamp": "2018-03-01T00:00:00Z", "value": 32858923},
        {"timestamp": "2018-03-02T00:00:00Z", "value": 29615278},
        {"timestamp": "2018-03-03T00:00:00Z", "value": 28988966},
        {"timestamp": "2018-03-04T00:00:00Z", "value": 28943783},
        {"timestamp": "2018-03-05T00:00:00Z", "value": 33521547},
        {"timestamp": "2018-03-06T00:00:00Z", "value": 34127843},
        {"timestamp": "2018-03-07T00:00:00Z", "value": 32497298},
        {"timestamp": "2018-03-08T00:00:00Z", "value": 29615278},
        {"timestamp": "2018-03-09T00:00:00Z", "value": 28988966},
        {"timestamp": "2018-03-10T00:00:00Z", "value": 28943783},
        {"timestamp": "2018-03-11T00:00:00Z", "value": 33521547},
        {"timestamp": "2018-03-12T00:00:00Z", "value": 72000000}
      ],
      "granularity": "daily",
      "sensitivity": 95
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "isAnomaly": true,
    "isNegativeAnomaly": false,
    "isPositiveAnomaly": true,
    "period": 7,
    "expectedValue": 28988966.0,
    "upperMargin": 1449448.3,
    "lowerMargin": 1449448.3,
    "suggestedWindow": 29,
    "severity": 0.72
  }
  ```
</ResponseExample>
