swagger: "2.0"
schemes:
  - https
host: azure.local
info:
  description: The Anomaly Finder API detects anomalies automatically in time series data. It supports two functionalities, one is for detecting the whole series with model trained by the timeseries, another is detecting last point with model trained by points before. By using this service, business customers can discover incidents and establish a logic flow for root cause analysis.
  title: Anomaly Finder Client
  version: "2.0"
  x-apisguru-categories:
    - cloud
  x-logo:
    url: https://api.apis.guru/v2/cache/logo/https_assets.onestore.ms_cdnfiles_onestorerolling-1606-01000_shell_v3_images_logo_microsoft.png
  x-origin:
    - format: swagger
      url: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cognitiveservices/data-plane/AnomalyFinder/stable/v2.0/AnomalyFinder.json
      version: "2.0"
  x-providerName: azure.com
  x-serviceName: cognitiveservices-AnomalyFinder
  x-tags:
    - Azure
    - Microsoft
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  apiKeyHeader:
    in: header
    name: Ocp-Apim-Subscription-Key
    type: apiKey
security:
  - apiKeyHeader: []
parameters:
  Endpoint:
    description: "Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com)."
    in: path
    name: Endpoint
    required: true
    type: string
    x-ms-parameter-location: client
    x-ms-skip-url-encoding: true
paths:
  /timeseries/entire/detect:
    post:
      description: The operation will generate a model using the entire series, each point will be detected with the same model. In this method, points before and after a certain point will be used to determine whether it's an anomaly. The entire detection can give user an overall status of the time series.
      operationId: EntireDetect
      parameters:
        - description: Time series points and period if needed. Advanced model parameters can also be set in the request.
          in: body
          name: body
          required: true
          schema:
            $ref: "#/definitions/Request"
      responses:
        "200":
          description: Successful operation.
          schema:
            $ref: "#/definitions/EntireDetectResponse"
        default:
          description: Error response.
          schema:
            $ref: "#/definitions/APIError"
      summary: Find anomalies for the entire series in batch.
      x-ms-examples:
        Find anomalies for the entire series in batch example:
          parameters:
            Content-Type: application/json
            Endpoint: "{Endpoint}"
            Ocp-Apim-Subscription-Key: "{API key}"
            body:
              granularity: monthly
              maxAnomalyRatio: 0.25
              sensitivity: 95
              series:
                - timestamp: 1972-01-01T00:00:00Z
                  value: 826
                - timestamp: 1972-02-01T00:00:00Z
                  value: 799
                - timestamp: 1972-03-01T00:00:00Z
                  value: 890
                - timestamp: 1972-04-01T00:00:00Z
                  value: 900
                - timestamp: 1972-05-01T00:00:00Z
                  value: 961
                - timestamp: 1972-06-01T00:00:00Z
                  value: 935
                - timestamp: 1972-07-01T00:00:00Z
                  value: 894
                - timestamp: 1972-08-01T00:00:00Z
                  value: 855
                - timestamp: 1972-09-01T00:00:00Z
                  value: 809
                - timestamp: 1972-10-01T00:00:00Z
                  value: 810
                - timestamp: 1972-11-01T00:00:00Z
                  value: 766
                - timestamp: 1972-12-01T00:00:00Z
                  value: 805
                - timestamp: 1973-01-01T00:00:00Z
                  value: 821
                - timestamp: 1973-02-01T00:00:00Z
                  value: 773
                - timestamp: 1973-03-01T00:00:00Z
                  value: 883
                - timestamp: 1973-04-01T00:00:00Z
                  value: 898
                - timestamp: 1973-05-01T00:00:00Z
                  value: 957
                - timestamp: 1973-06-01T00:00:00Z
                  value: 924
                - timestamp: 1973-07-01T00:00:00Z
                  value: 881
                - timestamp: 1973-08-01T00:00:00Z
                  value: 837
                - timestamp: 1973-09-01T00:00:00Z
                  value: 784
                - timestamp: 1973-10-01T00:00:00Z
                  value: 791
                - timestamp: 1973-11-01T00:00:00Z
                  value: 760
                - timestamp: 1973-12-01T00:00:00Z
                  value: 802
                - timestamp: 1974-01-01T00:00:00Z
                  value: 828
                - timestamp: 1974-02-01T00:00:00Z
                  value: 1030
                - timestamp: 1974-03-01T00:00:00Z
                  value: 889
                - timestamp: 1974-04-01T00:00:00Z
                  value: 902
                - timestamp: 1974-05-01T00:00:00Z
                  value: 969
                - timestamp: 1974-06-01T00:00:00Z
                  value: 947
                - timestamp: 1974-07-01T00:00:00Z
                  value: 908
                - timestamp: 1974-08-01T00:00:00Z
                  value: 867
                - timestamp: 1974-09-01T00:00:00Z
                  value: 815
                - timestamp: 1974-10-01T00:00:00Z
                  value: 812
                - timestamp: 1974-11-01T00:00:00Z
                  value: 773
                - timestamp: 1974-12-01T00:00:00Z
                  value: 813
                - timestamp: 1975-01-01T00:00:00Z
                  value: 834
                - timestamp: 1975-02-01T00:00:00Z
                  value: 782
                - timestamp: 1975-03-01T00:00:00Z
                  value: 892
                - timestamp: 1975-04-01T00:00:00Z
                  value: 903
                - timestamp: 1975-05-01T00:00:00Z
                  value: 966
                - timestamp: 1975-06-01T00:00:00Z
                  value: 937
                - timestamp: 1975-07-01T00:00:00Z
                  value: 896
                - timestamp: 1975-08-01T00:00:00Z
                  value: 858
                - timestamp: 1975-09-01T00:00:00Z
                  value: 817
                - timestamp: 1975-10-01T00:00:00Z
                  value: 827
                - timestamp: 1975-11-01T00:00:00Z
                  value: 797
                - timestamp: 1975-12-01T00:00:00Z
                  value: 843
          responses:
            "200":
              body:
                expectedValues:
                  - 827.7940908243968
                  - 798.9133774671927
                  - 888.6058431807189
                  - 900.5606407986661
                  - 962.8389426378304
                  - 933.2591606306954
                  - 891.0784104799666
                  - 856.1781601363697
                  - 809.8987227908941
                  - 807.375129007505
                  - 764.3196682448518
                  - 803.933498594564
                  - 823.5900620883058
                  - 794.0905641334288
                  - 883.164245249282
                  - 894.8419000690953
                  - 956.8430591101258
                  - 927.6285055190114
                  - 885.812983784303
                  - 851.6424797402517
                  - 806.0927886943216
                  - 804.6826815312029
                  - 762.74070738882
                  - 804.0251702513732
                  - 825.3523662579559
                  - 798.0404188724976
                  - 889.3016505577698
                  - 902.4226124345937
                  - 965.867078532635
                  - 937.3200495736695
                  - 896.1720524711102
                  - 862.0087368413656
                  - 816.4662342097423
                  - 814.4297745524709
                  - 771.8614479159354
                  - 811.859271346729
                  - 831.8998279215521
                  - 802.947544797165
                  - 892.5684407435083
                  - 904.5488214533809
                  - 966.8527063844707
                  - 937.3168391003043
                  - 895.180003672544
                  - 860.3649596356635
                  - 814.1707285969043
                  - 811.9054862686213
                  - 769.1083769610742
                  - 809.2328084659704
                isAnomaly:
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - true
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                isNegativeAnomaly:
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                isPositiveAnomaly:
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - true
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                  - false
                lowerMargins:
                  - 41.389704541219835
                  - 39.94566887335964
                  - 44.43029215903594
                  - 45.02803203993331
                  - 48.14194713189152
                  - 46.66295803153477
                  - 44.55392052399833
                  - 42.808908006818484
                  - 40.494936139544706
                  - 40.36875645037525
                  - 38.215983412242586
                  - 40.196674929728196
                  - 41.17950310441529
                  - 39.70452820667144
                  - 44.1582122624641
                  - 44.74209500345477
                  - 47.84215295550629
                  - 46.38142527595057
                  - 44.290649189215145
                  - 42.58212398701258
                  - 40.30463943471608
                  - 40.234134076560146
                  - 38.137035369441
                  - 40.201258512568664
                  - 41.267618312897795
                  - 39.90202094362488
                  - 44.46508252788849
                  - 45.121130621729684
                  - 48.29335392663175
                  - 46.86600247868348
                  - 44.80860262355551
                  - 43.100436842068284
                  - 40.82331171048711
                  - 40.721488727623544
                  - 38.593072395796774
                  - 40.59296356733645
                  - 41.5949913960776
                  - 40.14737723985825
                  - 44.62842203717541
                  - 45.227441072669045
                  - 48.34263531922354
                  - 46.86584195501521
                  - 44.759000183627194
                  - 43.01824798178317
                  - 40.70853642984521
                  - 40.59527431343106
                  - 38.45541884805371
                  - 40.46164042329852
                period: 12
                upperMargins:
                  - 41.389704541219835
                  - 39.94566887335964
                  - 44.43029215903594
                  - 45.02803203993331
                  - 48.14194713189152
                  - 46.66295803153477
                  - 44.55392052399833
                  - 42.808908006818484
                  - 40.494936139544706
                  - 40.36875645037525
                  - 38.215983412242586
                  - 40.196674929728196
                  - 41.17950310441529
                  - 39.70452820667144
                  - 44.1582122624641
                  - 44.74209500345477
                  - 47.84215295550629
                  - 46.38142527595057
                  - 44.290649189215145
                  - 42.58212398701258
                  - 40.30463943471608
                  - 40.234134076560146
                  - 38.137035369441
                  - 40.201258512568664
                  - 41.267618312897795
                  - 39.90202094362488
                  - 44.46508252788849
                  - 45.121130621729684
                  - 48.29335392663175
                  - 46.86600247868348
                  - 44.80860262355551
                  - 43.100436842068284
                  - 40.82331171048711
                  - 40.721488727623544
                  - 38.593072395796774
                  - 40.59296356733645
                  - 41.5949913960776
                  - 40.14737723985825
                  - 44.62842203717541
                  - 45.227441072669045
                  - 48.34263531922354
                  - 46.86584195501521
                  - 44.759000183627194
                  - 43.01824798178317
                  - 40.70853642984521
                  - 40.59527431343106
                  - 38.45541884805371
                  - 40.46164042329852
  /timeseries/last/detect:
    post:
      description: The operation will generate a model using points before the latest one, In this method, only history points are used for determine whether the target point is an anomaly. Latest point detecting matches the scenario of real-time monitoring of business metrics.
      operationId: LastDetect
      parameters:
        - description: Time series points and period if needed. Advanced model parameters can also be set in the request.
          in: body
          name: body
          required: true
          schema:
            $ref: "#/definitions/Request"
      responses:
        "200":
          description: Successful operation.
          schema:
            $ref: "#/definitions/LastDetectResponse"
        default:
          description: Error response.
          schema:
            $ref: "#/definitions/APIError"
      summary: Detect anomaly status of the latest point in time series.
      x-ms-examples:
        Detect anomaly status of the latest point in time series example:
          parameters:
            Content-Type: application/json
            Endpoint: "{Endpoint}"
            Ocp-Apim-Subscription-Key: "{API key}"
            body:
              granularity: monthly
              maxAnomalyRatio: 0.25
              sensitivity: 95
              series:
                - timestamp: 1972-01-01T00:00:00Z
                  value: 826
                - timestamp: 1972-02-01T00:00:00Z
                  value: 799
                - timestamp: 1972-03-01T00:00:00Z
                  value: 890
                - timestamp: 1972-04-01T00:00:00Z
                  value: 900
                - timestamp: 1972-05-01T00:00:00Z
                  value: 961
                - timestamp: 1972-06-01T00:00:00Z
                  value: 935
                - timestamp: 1972-07-01T00:00:00Z
                  value: 894
                - timestamp: 1972-08-01T00:00:00Z
                  value: 855
                - timestamp: 1972-09-01T00:00:00Z
                  value: 809
                - timestamp: 1972-10-01T00:00:00Z
                  value: 810
                - timestamp: 1972-11-01T00:00:00Z
                  value: 766
                - timestamp: 1972-12-01T00:00:00Z
                  value: 805
                - timestamp: 1973-01-01T00:00:00Z
                  value: 821
                - timestamp: 1973-02-01T00:00:00Z
                  value: 773
                - timestamp: 1973-03-01T00:00:00Z
                  value: 883
                - timestamp: 1973-04-01T00:00:00Z
                  value: 898
                - timestamp: 1973-05-01T00:00:00Z
                  value: 957
                - timestamp: 1973-06-01T00:00:00Z
                  value: 924
                - timestamp: 1973-07-01T00:00:00Z
                  value: 881
                - timestamp: 1973-08-01T00:00:00Z
                  value: 837
                - timestamp: 1973-09-01T00:00:00Z
                  value: 784
                - timestamp: 1973-10-01T00:00:00Z
                  value: 791
                - timestamp: 1973-11-01T00:00:00Z
                  value: 760
                - timestamp: 1973-12-01T00:00:00Z
                  value: 802
                - timestamp: 1974-01-01T00:00:00Z
                  value: 828
                - timestamp: 1974-02-01T00:00:00Z
                  value: 1030
                - timestamp: 1974-03-01T00:00:00Z
                  value: 889
                - timestamp: 1974-04-01T00:00:00Z
                  value: 902
                - timestamp: 1974-05-01T00:00:00Z
                  value: 969
                - timestamp: 1974-06-01T00:00:00Z
                  value: 947
                - timestamp: 1974-07-01T00:00:00Z
                  value: 908
                - timestamp: 1974-08-01T00:00:00Z
                  value: 867
                - timestamp: 1974-09-01T00:00:00Z
                  value: 815
                - timestamp: 1974-10-01T00:00:00Z
                  value: 812
                - timestamp: 1974-11-01T00:00:00Z
                  value: 773
                - timestamp: 1974-12-01T00:00:00Z
                  value: 813
                - timestamp: 1975-01-01T00:00:00Z
                  value: 834
                - timestamp: 1975-02-01T00:00:00Z
                  value: 782
                - timestamp: 1975-03-01T00:00:00Z
                  value: 892
                - timestamp: 1975-04-01T00:00:00Z
                  value: 903
                - timestamp: 1975-05-01T00:00:00Z
                  value: 966
                - timestamp: 1975-06-01T00:00:00Z
                  value: 937
                - timestamp: 1975-07-01T00:00:00Z
                  value: 896
                - timestamp: 1975-08-01T00:00:00Z
                  value: 858
                - timestamp: 1975-09-01T00:00:00Z
                  value: 817
                - timestamp: 1975-10-01T00:00:00Z
                  value: 827
                - timestamp: 1975-11-01T00:00:00Z
                  value: 797
                - timestamp: 1975-12-01T00:00:00Z
                  value: 843
          responses:
            "200":
              body:
                expectedValue: 809.2328084659704
                isAnomaly: false
                isNegativeAnomaly: false
                isPositiveAnomaly: false
                lowerMargin: 40.46164042329852
                period: 12
                suggestedWindow: 49
                upperMargin: 40.46164042329852
definitions:
  APIError:
    description: Error information returned by the API.
    properties:
      code:
        description: The error code.
        enum:
          - InvalidCustomInterval
          - BadArgument
          - InvalidGranularity
          - InvalidPeriod
          - InvalidModelArgument
          - InvalidSeries
        x-ms-enum:
          modelAsString: true
          name: AnomalyFinderErrorCodes
      message:
        description: A message explaining the error reported by the service.
        type: string
    type: object
  EntireDetectResponse:
    properties:
      expectedValues:
        description: ExpectedValues contain expected value for each input point. The index of the array is consistent with the input series.
        items:
          format: float
          type: number
        type: array
      isAnomaly:
        description: IsAnomaly contains anomaly properties for each input point. True means an anomaly either negative or positive has been detected. The index of the array is consistent with the input series.
        items:
          type: boolean
        type: array
      isNegativeAnomaly:
        description: IsNegativeAnomaly contains anomaly status in negative direction for each input point. True means a negative anomaly has been detected. A negative anomaly means the point is detected as an anomaly and its real value is smaller than the expected one. The index of the array is consistent with the input series.
        items:
          type: boolean
        type: array
      isPositiveAnomaly:
        description: IsPositiveAnomaly contain anomaly status in positive direction for each input point. True means a positive anomaly has been detected. A positive anomaly means the point is detected as an anomaly and its real value is larger than the expected one. The index of the array is consistent with the input series.
        items:
          type: boolean
        type: array
      lowerMargins:
        description: LowerMargins contain lower margin of each input point. LowerMargin is used to calculate lowerBoundary, which equals to expectedValue - (100 - sensitivity)*lowerMargin. Points between the boundary can be marked as normal ones in client side. The index of the array is consistent with the input series.
        items:
          format: float
          type: number
        type: array
      period:
        description: Frequency extracted from the series, zero means no recurrent pattern has been found.
        format: int32
        type: integer
      upperMargins:
        description: UpperMargins contain upper margin of each input point. UpperMargin is used to calculate upperBoundary, which equals to expectedValue + (100 - sensitivity)*upperMargin. Anomalies in response can be filtered by upperBoundary and lowerBoundary. By adjusting sensitivity value, less significant anomalies can be filtered in client side. The index of the array is consistent with the input series.
        items:
          format: float
          type: number
        type: array
    required:
      - expectedValues
      - isAnomaly
      - isNegativeAnomaly
      - isPositiveAnomaly
      - lowerMargins
      - period
      - upperMargins
    type: object
  LastDetectResponse:
    properties:
      expectedValue:
        description: Expected value of the latest point.
        format: float
        type: number
      isAnomaly:
        description: Anomaly status of the latest point, true means the latest point is an anomaly either in negative direction or positive direction.
        type: boolean
      isNegativeAnomaly:
        description: Anomaly status in negative direction of the latest point. True means the latest point is an anomaly and its real value is smaller than the expected one.
        type: boolean
      isPositiveAnomaly:
        description: Anomaly status in positive direction of the latest point. True means the latest point is an anomaly and its real value is larger than the expected one.
        type: boolean
      lowerMargin:
        description: "Lower margin of the latest point. LowerMargin is used to calculate lowerBoundary, which equals to expectedValue - (100 - sensitivity)*lowerMargin. "
        format: float
        type: number
      period:
        description: Frequency extracted from the series, zero means no recurrent pattern has been found.
        format: int32
        type: integer
      suggestedWindow:
        description: Suggested input series points needed for detecting the latest point.
        format: int32
        type: integer
      upperMargin:
        description: Upper margin of the latest point. UpperMargin is used to calculate upperBoundary, which equals to expectedValue + (100 - sensitivity)*upperMargin. If the value of latest point is between upperBoundary and lowerBoundary, it should be treated as normal value. By adjusting sensitivity value, anomaly status of latest point can be changed.
        format: float
        type: number
    type: object
  Point:
    properties:
      timestamp:
        description: Timestamp of a data point (ISO8601 format).
        format: date-time
        type: string
      value:
        description: The measurement of that point, should be float.
        format: float
        type: number
    required:
      - timestamp
      - value
    type: object
  Request:
    properties:
      customInterval:
        description: Custom Interval is used to set non-standard time interval, for example, if the series is 5 minutes, request can be set as {"granularity":"minutely", "customInterval":5}.
        format: int32
        type: integer
      granularity:
        description: Can only be one of yearly, monthly, weekly, daily, hourly or minutely. Granularity is used for verify whether input series is valid.
        enum:
          - yearly
          - monthly
          - weekly
          - daily
          - hourly
          - minutely
        type: string
        x-ms-enum:
          modelAsString: false
          name: Granularity
      maxAnomalyRatio:
        description: Optional argument, advanced model parameter, max anomaly ratio in a time series.
        format: float
        type: number
      period:
        description: Optional argument, periodic value of a time series. If the value is null or does not present, the API will determine the period automatically.
        format: int32
        type: integer
      sensitivity:
        description: Optional argument, advanced model parameter, between 0-99, the lower the value is, the larger the margin value will be which means less anomalies will be accepted.
        format: int32
        type: integer
      series:
        description: Time series data points. Points should be sorted by timestamp in ascending order to match the anomaly detection result. If the data is not sorted correctly or there is duplicated timestamp, the API will not work. In such case, an error message will be returned.
        items:
          $ref: "#/definitions/Point"
        type: array
    required:
      - granularity
      - series
    type: object
x-ms-parameterized-host:
  hostTemplate: "{Endpoint}/anomalyfinder/v2.0"
  parameters:
    - $ref: "#/parameters/Endpoint"
  useSchemePrefix: false
