openapi: 3.0.2
info:
  title: Anomaly Detection Service
  description: |
      
      Payment anomalies, many of which are caused by fraud, are a challenge for the financial industry. Once a payment is settled, it can be difficult or impossible to recover funds. It becomes increasingly important to identify abnormal transactions promptly and accurately. Instant payments initiatives combined with new liability schemes and growing volumes of reported fraud also put additional pressure on Financial Institutions [FIs] to detect and act on payment anomalies as early as possible to ensure a safe and end-to-end frictionless payment experience. In order to support FIs in detecting these anomalies, Swift developed Anomaly Markers.
      
      With this service, a payment originator (caller) can ask a solution provider to provide information relating to a series of Anomaly Markers.

      An anomaly marker is an indicator, a fact, that can reveal or characterize anomalies. They are represented as account-level statistics. For example:
        - Are there repetitive payments? 
        - Has this bank account already received a payment? 
        - Has this interbank settlement currency been already used by this ordering party?
  
  contact:
    name: Developer Hub
    url: https://developer.swift.com
    email: developer-support@swift.com
  license:
    name: API Restricted License
    url: https://developer.swift.com/api-license
  version: 1.5.0
servers:
- url: https://api-test.swiftnet.sipn.swift.com/swift-anomaly-detection/v1
  description: URL for Test.
- url: https://api.swiftnet.sipn.swift.com/swift-anomaly-detection/v1
  description: URL for Live.
security:
- bearerToken: []
tags:
- name: Anomaly Detection
  description: API to query for anomalies and return a report.
paths:
  /anomaly-data-report:
    post:
      tags:
      - Anomaly Detection
      summary: API to query for anomalies and return a report.
      description: |
        The following anomaly markers can be included in the API response, requested individually, or in one combined request:
          - Detect repetitive payments:
          - Detect new accounts or new currencies
          - Detect unusual amount or unusual volume
          - Detect problematic account reuse
      operationId: getAnomalyDataReport
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AnomalyMarkersParameter2'
            examples:
              AnomalyMarkersParameter2:
                $ref: '#/components/examples/AnomalyMarkersParameter2'
      responses:
        "200":
          description: Report of detected anomalies according to previously set criteria.
          headers:
            X-Request-ID:
              $ref: "#/components/headers/X-Request-ID"
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnomalyDataReport1'
              examples:
                AnomalyDataReport1:
                  $ref: '#/components/examples/AnomalyDataReport1'
        "400":
          $ref: '#/components/responses/400-BadRequest'
        "401":
          $ref: '#/components/responses/401-Unauthorized'
        "403":
          $ref: '#/components/responses/403-Forbidden'
        "404":
          $ref: '#/components/responses/404-NotFound'
        "429":
          $ref: '#/components/responses/429-TooManyRequests'
        "503":
          $ref: '#/components/responses/503-ServiceUnavailable'
        "504":
          $ref: '#/components/responses/504-GatewayTimeout'
components:
  schemas:
    AccountAnalysis1:
      x-MXComponent: AccountAnalysis1
      type: object
      description: Provides information related to the usage of a (pair of) account(s).
      additionalProperties: false
      properties:
        query_identification:
          x-MXComponent: Max70Text
          description: |
            Identification of the corresponding anomaly marker query.

            Based on datatype Max70Text: Specifies a character string with a maximum length of 70characters.
          type: string
          minLength: 1
          maxLength: 70
        observer:
          $ref: '#/components/schemas/Observer'
        context:
          $ref: '#/components/schemas/DetectionContext'
        execution_result:
          $ref: '#/components/schemas/ExecutionResult'
        execution_fail_code:
          x-MXComponent: Max35Text
          description: |
            Codified reason of a failed anomaly query request.

            Usage: should only be used if Execution Result = FAIL.

            Based on datatype Max35Text: Specifies a character string with a maximum length of 35 characters.
          type: string
          minLength: 1
          maxLength: 35
        execution_fail_text:
          x-MXComponent: Max350Text
          description: |
            Textual reason of a failed anomaly query request.

            Usage: should only be used if Execution Result = FAIL.

            Based on datatype Max350Text: Specifies a character string with a maximum length of 350 characters.
          type: string
          minLength: 1
          maxLength: 350
        anomaly_results:
          #  Report detailing found anomalies.
          $ref: '#/components/schemas/AccountAnomalyResults1'
      required:
      - observer
      - context
      - execution_result
    AccountAnomalyResults1:
      x-MXComponent: AccountAnomalyResults1
      type: object
      description: Report detailing account anomalies.
      additionalProperties: false
      properties:
        first_account_appearance_indicator:
          x-MXComponent: TrueFalseIndicator
          description: |
            Identifies if the (pair of) account number(s) is seen for the first time in a payment.

            Usage:
            True means yes.
            False means no.

            Based on datatype TrueFalseIndicator: A flag indicating a True or False value.
          type: boolean
        first_appearance_date_time:
          x-MXComponent: ISODateTime
          description: |
            Date and time in UTC of first time the (pair of) account number(s) was seen in a payment.

            Rule: only filled in if First Account Appearance is set to No / False.

            Based on datatype ISODateTime: A particular point in the progression of time defined by a mandatory date and a mandatory time component, expressed in either UTC time format (YYYY-MM-DDThh:mm:ss.sssZ), local time with UTC offset format (YYYY-MM-DDThh:mm:ss.sss+/-hh:mm), or local time format (YYYY-MM-DDThh:mm:ss.sss). These representations are defined in "XML Schema Part 2: Datatypes Second Edition - W3C Recommendation 28 October 2004" which is aligned with ISO 8601.
            Note on the time format:
            1) beginning / end of calendar day
            00:00:00 = the beginning of a calendar day
            24:00:00 = the end of a calendar day
            2) fractions of second in time format
            Decimal fractions of seconds may be included. In this case, the involved parties shall agree on the maximum number of digits that are allowed.
          type: string
          format: date-time
        last_appearance_date_time:
          x-MXComponent: ISODateTime
          description: |
            Date and time in UTC of first time the (pair of) account number(s) was last seen in a payment.

            Rule: only filled in if First Account Appearance is set to No / False.

            Based on datatype ISODateTime: A particular point in the progression of time defined by a mandatory date and a mandatory time component, expressed in either UTC time format (YYYY-MM-DDThh:mm:ss.sssZ), local time with UTC offset format (YYYY-MM-DDThh:mm:ss.sss+/-hh:mm), or local time format (YYYY-MM-DDThh:mm:ss.sss). These representations are defined in "XML Schema Part 2: Datatypes Second Edition - W3C Recommendation 28 October 2004" which is aligned with ISO 8601.
            Note on the time format:
            1) beginning / end of calendar day
            00:00:00 = the beginning of a calendar day
            24:00:00 = the end of a calendar day
            2) fractions of second in time format
            Decimal fractions of seconds may be included. In this case, the involved parties shall agree on the maximum number of digits that are allowed.
          type: string
          format: date-time
        count:
          x-MXComponent: nonNegativeInteger
          description: "Number of individual payments in the given context.\n\nUsage: \n\n- If Context is DEBT, this is the number of individual payments sent by debtor\n\n- If Context is CRED, this is the number of individual payments received by creditor\n\n- If Context is PAIR,this is number of individual payments exchanged\n\nBased on datatype nonNegativeInteger: W3C XML Schema Built-in datatype \"nonNegativeInteger\".\n"
          type: integer
          format: int32
      required:
      - first_account_appearance_indicator
      - count
    AnomalyDataReport1:
      x-MXComponent: AnomalyDataReport1
      type: object
      description: Report of detected anomalies according to previously set criteria.
      additionalProperties: false
      properties:
        anomaly_report_id:
          x-MXComponent: UUIDv4Identifier
          description: |
            Unique reference of the anomaly report.

            Usage: correlates the API response with the API request (through the AnomalyMarkersID).

            Based on datatype UUIDv4Identifier: Universally Unique IDentifier (UUID) version 4, as described in IETC RFC 4122 "Universally Unique IDentifier (UUID) URN Namespace".
          type: string
          pattern: ^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$
        new_account_analysis:
          type: array
          description: Details usage of a new (pair of) account(s).
          items:
            $ref: '#/components/schemas/AccountAnalysis1'
        new_currency_analysis:
          type: array
          description: Provides information related to the usage of a currency by a (pair of) account(s).
          items:
            $ref: '#/components/schemas/CurrencyAnalysis1'
        problematic_account_reuse_analysis:
          type: array
          description: Details whether a (pair of) account(s) has already been seen in payments associated to requests for cancellation or returned/rejected payment.
          items:
            $ref: '#/components/schemas/ProblematicAccountReuseAnalysis1'
        repetitive_payments_analysis:
          type: array
          description: Statistics of repetitive payments that have been detected.
          items:
            $ref: '#/components/schemas/RepetitivePaymentsAnalysis1'
        unusual_volume_analysis:
          type: array
          description: Statistics of exchanged messages activity of a (pair of) account(s) leveraging up to 13 months of data.
          items:
            $ref: '#/components/schemas/UnusualVolumeAnalysis1'
        unusual_amount_analysis:
          type: array
          description: 'Statistics of aggregated amounts activity received/sent by a (pair of) account(s) leveraging up to 13 months of data. '
          items:
            $ref: '#/components/schemas/UnusualAmountAnalysis1'
    AnomalyMarkersParameter2:
      x-MXComponent: AnomalyMarkersParameter2
      type: object
      description: |
        Set of criteria to define anomaly markers.

        Usage: Restricted for use for the SWIFT service. Restricted from AnomalyMarkersParameters1.
      additionalProperties: false
      properties:
        anomaly_markers_id:
          x-MXComponent: UUIDv4Identifier
          description: |
            Unique reference of the anomaly markers criteria.

            Usage: This can be used to uniquely identify the response.

            Based on datatype UUIDv4Identifier: Universally Unique IDentifier (UUID) version 4, as described in IETC RFC 4122 "Universally Unique IDentifier (UUID) URN Namespace".
          type: string
          pattern: ^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$
        payment:
          description: |
            Payment criteria for anomaly markers.

            Usage:  These criteria provide information about the payment for which the detection of anomalies is performed.
          $ref: '#/components/schemas/PaymentMarkers2'
        anomaly_markers:
          description: |
            Markers to analyse anomalies to report on.
          $ref: '#/components/schemas/MarkersQueries1'
      required:
      - payment
      - anomaly_markers
    CashAccount216:
      x-MXComponent: CashAccount216
      type: object
      description: |
        Provides the details to identify an account.

        Usage: Restricted for use for the SWIFT service. Restricted from CashAccount215.
      additionalProperties: false
      properties:
        iban:
          x-MXComponent: IBAN2007Identifier
          description: |
            International Bank Account Number (IBAN) - identifier used internationally by financial institutions to uniquely identify the account of a customer. Further specifications of the format and content of the IBAN can be found in the standard ISO 13616 "Banking and related financial services - International Bank Account Number (IBAN)" version 1997-10-01, or later revisions.

            Based on datatype IBAN2007Identifier: The International Bank Account Number is a code used internationally by financial institutions to uniquely identify the account of a customer at a financial institution as described in the 2007 edition of the ISO 13616 standard "Banking and related financial services - International Bank Account Number (IBAN)" and replaced by the more recent edition of the standard.
          type: string
          pattern: ^[A-Z]{2,2}[0-9]{2,2}[a-zA-Z0-9]{1,30}$
        other_identification:
          x-MXComponent: Max34Text
          description: |
            Unique identification of an account, as assigned by the account servicer, using an identification scheme.

            USAGE: If possible this should be an ExternalClearingSystemIdentificationCode as published in the external code sets on  www.iso20022.org .
            In the 2Q2024 update, these are the published codes for this field:


            Based on datatype Max34Text: Specifies a character string with a maximum length of 34 characters.
          type: string
          minLength: 1
          maxLength: 34
        other_identification_scheme_name:
          x-MXComponent: Max4Text
          description: |
            Name of the identification scheme.

            USAGE: If possible this should be an ExternalAccountIdentificationCode as published in the external code sets on www.iso20022.org .
            In the 2Q2024 update, these are the published codes for this field:

            AIIN - IssuerIdentificationNumber - Issuer Identification Number (IIN) - identifies a card issuing institution in an international interchange environment. Issued by ABA (American Bankers Association).
            BBAN - BBANIdentifier - Basic Bank Account Number (BBAN) - identifier used nationally by financial institutions, ie, in individual countries, generally as part of a National Account Numbering Scheme(s), to uniquely identify the account of a customer.
            CUID - CHIPSUniversalIdentifier - (United States) Clearing House Interbank Payments System (CHIPS) Universal Identification (UID) - identifies entities that own accounts at CHIPS participating financial institutions, through which CHIPS payments are effected. The CHIPS UID is assigned by the New York Clearing House.
            UPIC - UPICIdentifier - Universal Payment Identification Code (UPIC) - identifier used by the New York Clearing House to mask confidential data, such as bank accounts and bank routing numbers. UPIC numbers remain with business customers, regardless of banking relationship changes.

            Based on datatype Max4Text: Specifies a character string with a maximum length of 4 characters.
          type: string
          minLength: 1
          maxLength: 4
        other_identification_issuer:
          x-MXComponent: Max35Text
          description: |
            Entity that assigns the identification.

            Based on datatype Max35Text: Specifies a character string with a maximum length of 35 characters.
          type: string
          minLength: 1
          maxLength: 35
        type:
          x-MXComponent: Max4Text
          description: "Specifies the nature, or use of the account.\n\nUSAGE: If possible this should be an ExternalCashAccountTypeCode as published in the external code sets on  www.iso20022.org .\nIn the 2Q2024 update, these are the published codes for this field:\n\nCACC - Current - Account used to post debits and credits when no specific account has been nominated.\nCARD - CardAccount - Account used for credit card payments.\nCASH - CashPayment - Account used for the payment of cash.\nCHAR - Charges - Account used for charges if different from the account for payment.\nCISH - CashIncome - Account used for payment of income if different from the current cash account\nCOMM - Commission - Account used for commission if different from the account for payment.\nCPAC - ClearingParticipantSettlementAccount - Account used to post settlement debit and credit entries on behalf of a designated Clearing Participant.\nLLSV - LimitedLiquiditySavingsAccount - Account used for savings with special interest and withdrawal terms.  \nLOAN - Loan - Account used for loans.\nMGLD - MarginalLending - Account used for a marginal lending facility.\nMOMA - MoneyMarket - \"Account used for money markets if different from the cash account.\nNREX - NonResidentExternal - Account used for non-resident external.\nODFT - Overdraft - Account is used for overdrafts.\nONDP - OverNightDeposit - Account used for overnight deposits.\nOTHR - OtherAccount - Account not otherwise specified. \nSACC - Settlement - Account used to post debit and credit entries, as a result of transactions cleared and settled through a specific clearing and settlement system.\nSLRY - Salary - Accounts used for salary payments.\nSVGS - Savings - Account used for savings.\nTAXE - Tax - Account used for taxes if different from the account for payment.\nTRAN - TransactingAccount - A transacting account is the most basic type of bank account that you can get. The main difference between transaction and cheque accounts is that you usually do not get a cheque book with your transacting account and neither are you offered an overdraft facility.\nTRAS - CashTrading - Account used for trading if different from the current cash account.\nVACC - VirtualAccount - Account created virtually to facilitate collection and reconciliation.\nNFCA - NonResidentForeignCurrencyAccount - Non-Resident Individual / Entity Foreign Current held domestically.\n\nBased on datatype Max4Text: Specifies a character string with a maximum length of 4 characters.\n"
          type: string
          minLength: 1
          maxLength: 4
    CurrencyAnalysis1:
      x-MXComponent: CurrencyAnalysis1
      type: object
      description: Provides information related to the usage of a currency by a (pair of) account(s).
      additionalProperties: false
      properties:
        query_identification:
          x-MXComponent: Max70Text
          description: |
            Identification of the corresponding anomaly marker query.

            Based on datatype Max70Text: Specifies a character string with a maximum length of 70characters.
          type: string
          minLength: 1
          maxLength: 70
        observer:
          $ref: '#/components/schemas/Observer'
        context:
          $ref: '#/components/schemas/DetectionContext'
        execution_result:
          $ref: '#/components/schemas/ExecutionResult'
        execution_fail_code:
          x-MXComponent: Max35Text
          description: |
            Codified reason of a failed anomaly query request.

            Usage: should only be used if Execution Result = FAIL.

            Based on datatype Max35Text: Specifies a character string with a maximum length of 35 characters.
          type: string
          minLength: 1
          maxLength: 35
        execution_fail_text:
          x-MXComponent: Max350Text
          description: |
            Textual reason of a failed anomaly query request.

            Usage: should only be used if Execution Result = FAIL.

            Based on datatype Max350Text: Specifies a character string with a maximum length of 350 characters.
          type: string
          minLength: 1
          maxLength: 350
        anomaly_results:
          #  Report detailing found anomalies.
          $ref: '#/components/schemas/CurrencyAnomalyResults1'
      required:
      - observer
      - context
      - execution_result
    CurrencyAnomalyResults1:
      x-MXComponent: CurrencyAnomalyResults1
      type: object
      description: Report detailing currency anomalies.
      additionalProperties: false
      properties:
        first_currency_appearance_indicator:
          x-MXComponent: TrueFalseIndicator
          description: |
            Identifies if usage of a currency is seen for the first time in a payment.

            Usage:
            True means yes.
            False means no.

            Based on datatype TrueFalseIndicator: A flag indicating a True or False value.
          type: boolean
        first_appearance_date_time:
          x-MXComponent: ISODateTime
          description: |
            Date and time in UTC of first time the currency was seen associated to a (pair of) account number(s) in a pacs.008 or MT103.

            Rule: Only filled in if First Currency Appearance is set to No / False.

            Based on datatype ISODateTime: A particular point in the progression of time defined by a mandatory date and a mandatory time component, expressed in either UTC time format (YYYY-MM-DDThh:mm:ss.sssZ), local time with UTC offset format (YYYY-MM-DDThh:mm:ss.sss+/-hh:mm), or local time format (YYYY-MM-DDThh:mm:ss.sss). These representations are defined in "XML Schema Part 2: Datatypes Second Edition - W3C Recommendation 28 October 2004" which is aligned with ISO 8601.
            Note on the time format:
            1) beginning / end of calendar day
            00:00:00 = the beginning of a calendar day
            24:00:00 = the end of a calendar day
            2) fractions of second in time format
            Decimal fractions of seconds may be included. In this case, the involved parties shall agree on the maximum number of digits that are allowed.
          type: string
          format: date-time
        last_appearance_date_time:
          x-MXComponent: ISODateTime
          description: |
            Date and time in UTC of last time the currency was seen associated to a (pair of) account number(s) in a pacs.008 or MT103

            Rule: only filled in if First Currency Appearance is set to No / False.

            Based on datatype ISODateTime: A particular point in the progression of time defined by a mandatory date and a mandatory time component, expressed in either UTC time format (YYYY-MM-DDThh:mm:ss.sssZ), local time with UTC offset format (YYYY-MM-DDThh:mm:ss.sss+/-hh:mm), or local time format (YYYY-MM-DDThh:mm:ss.sss). These representations are defined in "XML Schema Part 2: Datatypes Second Edition - W3C Recommendation 28 October 2004" which is aligned with ISO 8601.
            Note on the time format:
            1) beginning / end of calendar day
            00:00:00 = the beginning of a calendar day
            24:00:00 = the end of a calendar day
            2) fractions of second in time format
            Decimal fractions of seconds may be included. In this case, the involved parties shall agree on the maximum number of digits that are allowed.
          type: string
          format: date-time
        count:
          x-MXComponent: nonNegativeInteger
          description: "Number of individual payments in the given context.\n\nUsage: \n\n- If Context is DEBT, this is the number of individual payments sent by debtor\n\n- If Context is CRED, this is the number of individual payments received by creditor\n\n- If Context is PAIR,this is number of individual payments exchanged\n\nBased on datatype nonNegativeInteger: W3C XML Schema Built-in datatype \"nonNegativeInteger\".\n"
          type: integer
          format: int32
      required:
      - first_currency_appearance_indicator
      - count
    FinancialInstitutionIdentification28:
      x-MXComponent: FinancialInstitutionIdentification28
      type: object
      description: |
        Specifies the details to identify a financial institution.

        Usage: Restricted for use for the SWIFT service. Restricted from FinancialInstitutionIdentification25.
      additionalProperties: false
      properties:
        bicfi:
          x-MXComponent: BICFIDec2014Identifier
          description: |
            Code allocated to a financial institution by the ISO 9362 Registration Authority as described in ISO 9362 "Banking - Banking telecommunication messages - Business identifier code (BIC)".

            Based on datatype BICFIDec2014Identifier: Code allocated to a financial institution by the ISO 9362 Registration Authority as described in ISO 9362: 2014 - "Banking - Banking telecommunication messages - Business identifier code (BIC)".
          type: string
          pattern: ^[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}$
        name:
          x-MXComponent: Max140Text
          description: |
            Name by which an agent is known and which is usually used to identify that agent.

            Based on datatype Max140Text: Specifies a character string with a maximum length of 140 characters.
          type: string
          minLength: 1
          maxLength: 140
    MarkersQueries1:
      x-MXComponent: MarkersQueries1
      type: object
      description: Anomaly marker criteria.
      additionalProperties: false
      properties:
        new_account:
          type: array
          description: Scope for analysing new account use.
          items:
            $ref: '#/components/schemas/NewAccountScope1'
        new_currency:
          type: array
          description: Scope for analysing new currency use.
          items:
            $ref: '#/components/schemas/NewAccountScope1'
        problematic_account_reuse:
          type: array
          description: |
            Scope for analysing problematic account reuse.

            Usage:
            - present means include problematic account reuse in the report.
            - not present means do not include problematic account reuse in the report.
          items:
            $ref: '#/components/schemas/ProblematicAccountScope1'
        repetitive_payments:
          type: array
          description: Scope of the repetitive payments detection.
          items:
            $ref: '#/components/schemas/RepetitivePaymentsScope1'
        unusual_volume:
          type: array
          description: |
            Scope for analysing the level of exchanged messages activity of a (pair of) account(s).
          items:
            $ref: '#/components/schemas/MonitoredPaymentsScope1'
        unusual_amount:
          type: array
          description: |
            Scope for analysing the aggregated amount on a (pair of) account(s).
          items:
            $ref: '#/components/schemas/MonitoredPaymentsScope1'
    ProblematicAccountScope1:
      x-MXComponent: ProblematicAccountScope1
      type: object
      description: |
        Information defining the scope for analysing an account in the context of anomaly detection.
      additionalProperties: false
      properties:
        query_identification:
          x-MXComponent: Max70Text
          description: "Identification of the corresponding anomaly marker query. \n\nUsage: can be used to match the response to the anomaly marker query.\n\nBased on datatype Max70Text: Specifies a character string with a maximum length of 70characters.\n"
          type: string
          minLength: 1
          maxLength: 70
        observer:
          $ref: '#/components/schemas/Observer'
        context:
          $ref: '#/components/schemas/DetectionContext'
        input_hours_delta:
          x-MXComponent: PositiveNumber
          description: |
            Identifies the period in hours for which anomaly signals from other payments are considered; in particular the usage date of anomaly signals must be checked.

            Usage: in the SWIFT Anomaly Detection service the maximum is 9490 hours, or approximately 13 months.

            Based on datatype PositiveNumber: Number of objects represented as a positive integer.
          type: integer
          format: int32
          minimum: 1
          maximum: 9490
      required:
      - observer
      - context
    NewAccountScope1:
      x-MXComponent: NewAccountScope1
      type: object
      description: Scope for analysing currency use.
      additionalProperties: false
      properties:
        query_identification:
          x-MXComponent: Max70Text
          description: "Identification of the corresponding anomaly marker query. \n\nUsage: can be used to match the response to the anomaly marker query.\n\nBased on datatype Max70Text: Specifies a character string with a maximum length of 70characters.\n"
          type: string
          minLength: 1
          maxLength: 70
        observer:
          $ref: '#/components/schemas/Observer'
        context:
          $ref: '#/components/schemas/DetectionContext'
      required:
      - observer
      - context
    MonitoredPaymentsScope1:
      x-MXComponent: MonitoredPaymentsScope1
      type: object
      description: |
        Information defining the scope for analysing the level of exchanged payments activity of a (pair of) account(s).
      additionalProperties: false
      properties:
        query_identification:
          x-MXComponent: Max70Text
          description: "Identification of the corresponding anomaly marker query. \n\nUsage: can be used to match the response to the anomaly marker query.\n\nBased on datatype Max70Text: Specifies a character string with a maximum length of 70characters.\n"
          type: string
          minLength: 1
          maxLength: 70
        observer:
          $ref: '#/components/schemas/Observer'
        context:
          $ref: '#/components/schemas/DetectionContext'
        monitored_period:
          $ref: '#/components/schemas/MonitoredPeriod'
        cross_currency_indicator:
          x-MXComponent: TrueFalseIndicator
          description: |
            Indicates whether the anomaly marker detection must be done on any currency or only on the same currency as the payment amount.

            Usage:
            True means Yes.
            False means No.

            Based on datatype TrueFalseIndicator: A flag indicating a True or False value.
          type: boolean
      required:
      - observer
      - context
      - monitored_period
      - cross_currency_indicator
    PartyIdentification332:
      x-MXComponent: PartyIdentification332
      type: object
      description: |
        Identification of the party.

        Usage: Restricted for use for the SWIFT service. Restricted from PartyIdentification308.
      additionalProperties: false
      properties:
        any_bic:
          x-MXComponent: AnyBICDec2014Identifier
          description: |
            Business identification code of the organisation.

            Based on datatype AnyBICDec2014Identifier: Code allocated to a financial or non-financial institution by the ISO 9362 Registration Authority, as described in ISO 9362: 2014 - "Banking - Banking telecommunication messages - Business identifier code (BIC)".
          type: string
          pattern: ^[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}$
      required:
      - any_bic
    PaymentMarkers2:
      x-MXComponent: PaymentMarkers2
      type: object
      description: |
        Payment selection criteria to define anomaly markers.

        Usage: Restricted for use for the SWIFT service, restricted from PaymentMarkers1.
      additionalProperties: false
      properties:
        debtor:
          description: |
            Party that owes an amount of money to the (ultimate) creditor.

            Note: subfield multiplicity, presence, and length of this flattened component are aligned with the CBPR market practice.
          $ref: '#/components/schemas/PartyIdentification332'
        debtor_account:
          description: |
            Unambiguous identification of the account of the debtor to which a debit entry will be made as a result of the transaction.

            Note: subfield multiplicity, presence, and length of this flattened component are aligned with the CBPR market practice.
          $ref: '#/components/schemas/CashAccount216'
        debtor_agent:
          description: |
            Financial institution servicing an account for the debtor.

            Note: subfield multiplicity, presence, and length of this flattened component are aligned with the CBPR market practice.
          $ref: '#/components/schemas/FinancialInstitutionIdentification28'
        creditor:
          description: |
            Party to which an amount of money is due.

            Note: subfield multiplicity, presence, and length of this flattened component are aligned with the CBPR market practice.
          $ref: '#/components/schemas/PartyIdentification332'
        creditor_account:
          description: |
            Unambiguous identification of the account of the creditor to which a credit entry will be posted as a result of the payment transaction.

            Note: subfield multiplicity, presence, and length of this flattened component are aligned with the CBPR market practice.
          $ref: '#/components/schemas/CashAccount216'
        creditor_agent:
          description: |
            Financial institution servicing an account for the creditor.

            Note: subfield multiplicity, presence, and length of this flattened component are aligned with the CBPR market practice.
          $ref: '#/components/schemas/FinancialInstitutionIdentification28'
        interbank_settlement_amount:
          $ref: '#/components/schemas/InterbankSettlementAmount'
        uetr:
          x-MXComponent: UUIDv4Identifier
          description: |
            Universally unique identifier to provide an end-to-end reference of a payment transaction.

            Based on datatype UUIDv4Identifier: Universally Unique IDentifier (UUID) version 4, as described in IETC RFC 4122 "Universally Unique IDentifier (UUID) URN Namespace".
          type: string
          pattern: ^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$
    PaymentsCountStatistics1:
      x-MXComponent: PaymentsCountStatistics1
      type: object
      description: Observed numbers of payments sorted per status.
      additionalProperties: false
      properties:
        payment_status:
          x-MXComponent: Max4Text
          description: "Indicates the status of a single payment transaction or of a group of payment transactions.\n\nCurrently available status values are:\n\nACCC - Accepted Credit Settlement Completed - Settlement on the creditor's account has been completed. \nACSP - Accepted Settlement In Process - All preceding checks such as technical validation and customer profile were successful and therefore the payment has been accepted for execution.\nRJCT - Rejected - Payment or individual transaction included in the payment has been rejected.\n\nBased on datatype Max4Text: Specifies a character string with a maximum length of 4 characters.\n"
          type: string
          minLength: 1
          maxLength: 4
        count:
          x-MXComponent: nonNegativeInteger
          description: |
            Number of repetitive payments detected for a given Payment Status.

            Usage: 0 means that no repetitive payment matching the specified criteria have been detected.

            Based on datatype nonNegativeInteger: W3C XML Schema Built-in datatype "nonNegativeInteger".
          type: integer
          format: int32
      required:
      - payment_status
      - count
    PaymentsPercentageStatistics1:
      x-MXComponent: PaymentsPercentageStatistics1
      type: object
      description: Observed statistics of payments sorted per status.
      additionalProperties: false
      properties:
        payment_status:
          x-MXComponent: Max4Text
          description: "Indicates the status of a single payment transaction or of a group of payment transactions.\n\nCurrently available status values are:\n\nACCC - Accepted Credit Settlement Completed - Settlement on the creditor's account has been completed. \nACSP - Accepted Settlement In Process - All preceding checks such as technical validation and customer profile were successful and therefore the payment has been accepted for execution.\nRJCT - Rejected - Payment or individual transaction included in the payment has been rejected.\n\nBased on datatype Max4Text: Specifies a character string with a maximum length of 4 characters.\n"
          type: string
          minLength: 1
          maxLength: 4
        percentage:
          x-MXComponent: PercentageRate
          description: |
            Percentage of payments for a given Payment Status.

            Based on datatype PercentageRate: Rate expressed as a percentage, that is, in hundredths, for example, 0.7 is 7/10 of a percent, and 7.0 is 7%.
          type: number
          format: double
      required:
      - payment_status
      - percentage
    ProblematicAccountAnomaly1:
      x-MXComponent: ProblematicAccountAnomaly1
      type: object
      description: Provides information about the anomaly signal code(s) caught for a given (pair of) account(s).
      additionalProperties: false
      properties:
        anomaly_signal_code:
          $ref: '#/components/schemas/AnomalySignalCode'
        anomaly_code:
          x-MXComponent: Max4Text
          description: |
            Code used in the anomaly signal.

            Based on datatype Max4Text: Specifies a character string with a maximum length of 4 characters.
          type: string
          minLength: 1
          maxLength: 4
        key_word_used_indicator:
          x-MXComponent: TrueFalseIndicator
          description: |
            Informs whether the code was derived based on a keyword present in a narrative.

            Usage:
            True means yes.
            False means no.

            Based on datatype TrueFalseIndicator: A flag indicating a True or False value.
          type: boolean
        key_word_detected:
          x-MXComponent: Max70Text
          description: |
            Keyword present in a narrative that triggered the anomaly marker.

            Based on datatype Max70Text: Specifies a character string with a maximum length of 70characters.
          type: string
          minLength: 1
          maxLength: 70
        usage_date:
          x-MXComponent: ISODate
          description: |
            Date when the anomaly signal was captured.


            Based on datatype ISODate: A particular point in the progression of time in a calendar year expressed in the YYYY-MM-DD format. This representation is defined in "XML Schema Part 2: Datatypes Second Edition - W3C Recommendation 28 October 2004" which is aligned with ISO 8601.
          type: string
          format: date
        payment_date:
          x-MXComponent: ISODate
          description: |
            Date when the underlying payment, for which an anomaly signal was later captured, was originally initiated.

            Based on datatype ISODate: A particular point in the progression of time in a calendar year expressed in the YYYY-MM-DD format. This representation is defined in "XML Schema Part 2: Datatypes Second Edition - W3C Recommendation 28 October 2004" which is aligned with ISO 8601.
          type: string
          format: date
      required:
      - anomaly_signal_code
      - anomaly_code
      - key_word_used_indicator
      - usage_date
    ProblematicAccountAnomalyStatistics1:
      x-MXComponent: ProblematicAccountAnomalyStatistics1
      type: object
      description: Provides overview information about the anomaly signal code(s) caught for a given (pair of) account(s).
      additionalProperties: false
      properties:
        anomaly_signal_code:
          $ref: '#/components/schemas/AnomalySignalCode'
        anomaly_code:
          x-MXComponent: Max4Text
          description: |
            Code used in the anomaly signal.

            Based on datatype Max4Text: Specifies a character string with a maximum length of 4 characters.
          type: string
          minLength: 1
          maxLength: 4
        count:
          x-MXComponent: NonNegativeNumber
          description: |
            Informs whether the code was derived based on a keyword present in a narrative.

            Usage:
            True means yes.
            False means no.

            Based on datatype NonNegativeNumber: Non negative integer.
          type: integer
          format: int32
      required:
      - anomaly_signal_code
      - anomaly_code
      - count
    ProblematicAccountReuseAnalysis1:
      x-MXComponent: ProblematicAccountReuseAnalysis1
      type: object
      description: Provides information about the type of anomaly signal(s) leveraged to flag a potentially problematic (pair of) account(s).
      additionalProperties: false
      properties:
        query_identification:
          x-MXComponent: Max70Text
          description: |
            Identification of the corresponding anomaly marker query.

            Based on datatype Max70Text: Specifies a character string with a maximum length of 70characters.
          type: string
          minLength: 1
          maxLength: 70
        observer:
          $ref: '#/components/schemas/Observer'
        context:
          $ref: '#/components/schemas/DetectionContext'
        input_hours_delta:
          x-MXComponent: PositiveNumber
          description: |
            Identifies the period in hours for which anomaly signals from other payments are considered; in particular the usage date of anomaly signals must be checked.

            Usage: in the SWIFT Anomaly Detection service the maximum is 9490 hours, or approximately 13 months.

            Based on datatype PositiveNumber: Number of objects represented as a positive integer.
          type: integer
          format: int32
          minimum: 1
          maximum: 9490
        execution_result:
          $ref: '#/components/schemas/ExecutionResult'
        execution_fail_code:
          x-MXComponent: Max35Text
          description: |
            Codified reason of a failed anomaly query request.

            Usage: should only be used if Execution Result = FAIL.

            Based on datatype Max35Text: Specifies a character string with a maximum length of 35 characters.
          type: string
          minLength: 1
          maxLength: 35
        execution_fail_text:
          x-MXComponent: Max350Text
          description: |
            Textual reason of a failed anomaly query request.

            Usage: should only be used if Execution Result = FAIL.

            Based on datatype Max350Text: Specifies a character string with a maximum length of 350 characters.
          type: string
          minLength: 1
          maxLength: 350
        anomaly_results:
          #  Report detailing found anomalies.
          $ref: '#/components/schemas/ProblematicAccountReuseAnomalyResults1'
      required:
      - observer
      - context
      - execution_result
    ProblematicAccountReuseAnomalyResults1:
      x-MXComponent: ProblematicAccountReuseAnomalyResults1
      type: object
      description: Report detailing problematic account reuse anomalies.
      additionalProperties: false
      properties:
        anomaly_statistics:
          type: array
          description: Statistical, categorised overview of anomaly occurences.
          items:
            $ref: '#/components/schemas/ProblematicAccountAnomalyStatistics1'
        anomaly:
          type: array
          description: Anomaly signal code(s) captured for a given (pair of) account(s).
          items:
            $ref: '#/components/schemas/ProblematicAccountAnomaly1'
      required:
      - anomaly_statistics
    RepetitivePaymentsAnalysis1:
      x-MXComponent: RepetitivePaymentsAnalysis1
      type: object
      description: Provides anomaly detection report on repetitive payments.
      additionalProperties: false
      properties:
        query_identification:
          x-MXComponent: Max70Text
          description: |
            Identification of the corresponding anomaly marker query.

            Based on datatype Max70Text: Specifies a character string with a maximum length of 70characters.
          type: string
          minLength: 1
          maxLength: 70
        observer:
          $ref: '#/components/schemas/Observer'
        context:
          $ref: '#/components/schemas/DetectionContext'
        execution_result:
          $ref: '#/components/schemas/ExecutionResult'
        execution_fail_code:
          x-MXComponent: Max35Text
          description: |
            Codified reason of a failed anomaly query request.

            Usage: should only be used if Execution Result = FAIL.

            Based on datatype Max35Text: Specifies a character string with a maximum length of 35 characters.
          type: string
          minLength: 1
          maxLength: 35
        execution_fail_text:
          x-MXComponent: Max350Text
          description: |
            Textual reason of a failed anomaly query request.

            Usage: should only be used if Execution Result = FAIL.

            Based on datatype Max350Text: Specifies a character string with a maximum length of 350 characters.
          type: string
          minLength: 1
          maxLength: 350
        input_hours_delta:
          x-MXComponent: PositiveNumber
          description: |
            Identifies the period of maximum 744 hours (31 days) for which the payment characteristics specified in the request, in particular the Input time must be checked against other payments for the detection of repetitive payments.

            Usage: this field accepts integer values from 1 to 744.



            Based on datatype PositiveNumber: Number of hours specified as 1-744; equivalent to max 31 days.
          type: integer
          format: int32
          minimum: 1
          maximum: 744
        amount_match:
          $ref: '#/components/schemas/AmountMatch'
        cross_currency_indicator:
          x-MXComponent: TrueFalseIndicator
          description: |
            Indicates whether the anomaly marker detection must be done on any currency or only on the same currency as the payment amount.

            Usage:
            True means Yes.
            False means No.

            Based on datatype TrueFalseIndicator: A flag indicating a True or False value.
          type: boolean
        anomaly_results:
          #  Report detailing found anomalies.
          $ref: '#/components/schemas/RepetitivePaymentsAnomalyResults1'
      required:
      - observer
      - context
      - execution_result
      - input_hours_delta
      - amount_match
      - cross_currency_indicator
    RepetitivePaymentsAnomalyResults1:
      x-MXComponent: RepetitivePaymentsAnomalyResults1
      type: object
      description: Report detailing statistics of repetitive payments.
      additionalProperties: false
      properties:
        total_count:
          x-MXComponent: nonNegativeInteger
          description: |
            Total count of payments analysed, regardless of status.

            Based on datatype nonNegativeInteger: W3C XML Schema Built-in datatype "nonNegativeInteger".
          type: integer
          format: int32
        payments_statistics:
          type: array
          description: |
            Observed numbers of payments sorted per status.
          items:
            $ref: '#/components/schemas/PaymentsCountStatistics1'
      required:
      - total_count
      - payments_statistics
    RepetitivePaymentsScope1:
      x-MXComponent: RepetitivePaymentsScope1
      type: object
      description: Information defining the repetitive payments detection scope
      additionalProperties: false
      properties:
        query_identification:
          x-MXComponent: Max70Text
          description: "Identification of the corresponding anomaly marker query. \n\nUsage: can be used to match the response to the anomaly marker query.\n\nBased on datatype Max70Text: Specifies a character string with a maximum length of 70characters.\n"
          type: string
          minLength: 1
          maxLength: 70
        observer:
          $ref: '#/components/schemas/Observer'
        context:
          $ref: '#/components/schemas/DetectionContext'
        input_hours_delta:
          x-MXComponent: ThreeHundredThirtySixHoursNumericText
          description: |
            Identifies the period of maximum 336 hours (14 days) for which the payment characteristics specified in the request, in particular the Input time must be checked against other payments for the detection of repetitive payments.

            Usage: this field accepts integer values from 1 to 336.


            Based on datatype ThreeHundredThirtySixHoursNumericText: Number of hours specified as 1-336; equivalent to max 14 days.
          type: integer
          format: int32
          minimum: 1
          maximum: 336
        amount_match:
          $ref: '#/components/schemas/AmountMatch'
        cross_currency_indicator:
          x-MXComponent: TrueFalseIndicator
          description: |
            Indicates whether the anomaly marker detection must be done on any currency or only on the same currency as the payment amount.

            Usage:
            True means Yes.
            False means No.

            Based on datatype TrueFalseIndicator: A flag indicating a True or False value.
          type: boolean
      required:
      - observer
      - context
      - input_hours_delta
      - amount_match
      - cross_currency_indicator
    UnusualAmountAnalysis1:
      x-MXComponent: UnusualAmountAnalysis1
      type: object
      description: Level of aggregated amounts activity received/sent by a (pair of) account(s) leveraging up to 13 months of data.
      additionalProperties: false
      properties:
        query_identification:
          x-MXComponent: Max70Text
          description: |
            Identification of the corresponding anomaly marker query.

            Based on datatype Max70Text: Specifies a character string with a maximum length of 70characters.
          type: string
          minLength: 1
          maxLength: 70
        observer:
          $ref: '#/components/schemas/Observer'
        context:
          $ref: '#/components/schemas/DetectionContext'
        execution_result:
          $ref: '#/components/schemas/ExecutionResult'
        execution_fail_code:
          x-MXComponent: Max35Text
          description: |
            Codified reason of a failed anomaly query request.

            Usage: should only be used if Execution Result = FAIL.

            Based on datatype Max35Text: Specifies a character string with a maximum length of 35 characters.
          type: string
          minLength: 1
          maxLength: 35
        execution_fail_text:
          x-MXComponent: Max350Text
          description: |
            Textual reason of a failed anomaly query request.

            Usage: should only be used if Execution Result = FAIL.

            Based on datatype Max350Text: Specifies a character string with a maximum length of 350 characters.
          type: string
          minLength: 1
          maxLength: 350
        monitored_period:
          $ref: '#/components/schemas/MonitoredPeriod'
        cross_currency_indicator:
          x-MXComponent: TrueFalseIndicator
          description: |
            Indicates whether the anomaly marker detection must be done on any currency or only on the same currency as the payment amount.

            Usage:
            True means Yes.
            False means No.

            Based on datatype TrueFalseIndicator: A flag indicating a True or False value.
          type: boolean
        anomaly_results:
          #  Report detailing found anomalies.
          $ref: '#/components/schemas/UnusualAmountAnomalyResults1'
      required:
      - observer
      - context
      - execution_result
      - monitored_period
      - cross_currency_indicator
    UnusualAmountAnomalyResults1:
      x-MXComponent: UnusualAmountAnomalyResults1
      type: object
      description: |
        Report detailing statistics of payments with unusual amounts.
        .
      additionalProperties: false
      properties:
        normal_average_rate:
          x-MXComponent: PercentageRate
          description: |
            Percentage value of the aggregated amounts activity during the specified monitored period compared to past activity normal average.

            Based on datatype PercentageRate: Rate expressed as a percentage, that is, in hundredths, for example, 0.7 is 7/10 of a percent, and 7.0 is 7%.
          type: number
          format: double
        standard_deviation:
          x-MXComponent: Max20PositiveDecimalNumber
          description: |
            Ratio between the deviation of the exchanged amounts activity (during the specified monitored period) from past activity normal average, and the standard deviation of past activity.

            Based on datatype Max20PositiveDecimalNumber: Number of objects represented as a decimal number, eg, 0.75 or 5.6.
          type: number
          format: double
        high_percentile_indicator:
          x-MXComponent: TrueFalseIndicator
          description: |
            Indicates whether the aggregated amounts activity during the specified monitored period is above a high percentile of past activity, as defined by the service provider.

            Usage: in the SWIFT Anomaly Detection service, this refers to above 95th percentile.

            Usage:
            True means Yes.
            False means No.

            Based on datatype TrueFalseIndicator: A flag indicating a True or False value.
          type: boolean
        low_accuracy_result_indicator:
          x-MXComponent: TrueFalseIndicator
          description: |
            Indicates whether the normal average, standard deviation and high percentile results are potentially of low statistical accuracy because of low availability of relevant historical data points.

            Usage:
            True means Yes.
            False means No.

            Based on datatype TrueFalseIndicator: A flag indicating a True or False value.
          type: boolean
        payments_statistics_distribution:
          type: array
          description: |
            Observed distribution of aggregation window payments per status.
          items:
            $ref: '#/components/schemas/PaymentsPercentageStatistics1'
      required:
      - normal_average_rate
      - standard_deviation
      - high_percentile_indicator
      - low_accuracy_result_indicator
      - payments_statistics_distribution
    UnusualVolumeAnalysis1:
      x-MXComponent: UnusualVolumeAnalysis1
      type: object
      description: Details the level of exchanged payments activity of a (pair of) account(s) leveraging up to 13 months of data.
      additionalProperties: false
      properties:
        query_identification:
          x-MXComponent: Max70Text
          description: |
            Identification of the corresponding anomaly marker query.

            Based on datatype Max70Text: Specifies a character string with a maximum length of 70characters.
          type: string
          minLength: 1
          maxLength: 70
        observer:
          $ref: '#/components/schemas/Observer'
        context:
          $ref: '#/components/schemas/DetectionContext'
        execution_result:
          $ref: '#/components/schemas/ExecutionResult'
        execution_fail_code:
          x-MXComponent: Max35Text
          description: |
            Codified reason of a failed anomaly query request.

            Usage: should only be used if Execution Result = FAIL.

            Based on datatype Max35Text: Specifies a character string with a maximum length of 35 characters.
          type: string
          minLength: 1
          maxLength: 35
        execution_fail_text:
          x-MXComponent: Max350Text
          description: |
            Textual reason of a failed anomaly query request.

            Usage: should only be used if Execution Result = FAIL.

            Based on datatype Max350Text: Specifies a character string with a maximum length of 350 characters.
          type: string
          minLength: 1
          maxLength: 350
        monitored_period:
          $ref: '#/components/schemas/MonitoredPeriod'
        cross_currency_indicator:
          x-MXComponent: TrueFalseIndicator
          description: |
            Indicates whether the anomaly marker detection must be done on any currency or only on the same currency as the payment amount.

            Usage:
            True means Yes.
            False means No.

            Based on datatype TrueFalseIndicator: A flag indicating a True or False value.
          type: boolean
        anomaly_results:
          #  Report detailing found anomalies.
          $ref: '#/components/schemas/UnusualVolumeAnomalyResults1'
      required:
      - observer
      - context
      - execution_result
      - monitored_period
      - cross_currency_indicator
    UnusualVolumeAnomalyResults1:
      x-MXComponent: UnusualVolumeAnomalyResults1
      type: object
      description: |
        Report detailing statistics of payments with unusual volume
        .
      additionalProperties: false
      properties:
        normal_average_rate:
          x-MXComponent: PercentageRate
          description: |
            Percentage value of exchanged payments activity during the specified monitored period compared to past activity normal average.

            Based on datatype PercentageRate: Rate expressed as a percentage, that is, in hundredths, for example, 0.7 is 7/10 of a percent, and 7.0 is 7%.
          type: number
          format: double
        standard_deviation:
          x-MXComponent: Max20PositiveDecimalNumber
          description: |
            Ratio between the deviation of the exchanged payments activity (during the specified monitored period) from past activity normal average, and the standard deviation of past activity.

            Based on datatype Max20PositiveDecimalNumber: Number of objects represented as a decimal number, eg, 0.75 or 45.6.
          type: number
          format: double
        high_percentile_indicator:
          x-MXComponent: TrueFalseIndicator
          description: |
            Indicates whether the exchanged payments activity during the specified monitored period is above a high percentile of past activity, as defined by the service provider.

            Usage: in the SWIFT Anomaly Detection service, this refers to above 95th percentile.

            Usage:
            True means Yes.
            False means No.

            Based on datatype TrueFalseIndicator: A flag indicating a True or False value.
          type: boolean
        low_accuracy_result_indicator:
          x-MXComponent: TrueFalseIndicator
          description: |
            Indicates whether the normal average, standard deviation and high percentile results are potentially of low statistical accuracy because of low availability of relevant historical data points.

            Usage:
            True means Yes.
            False means No.

            Based on datatype TrueFalseIndicator: A flag indicating a True or False value.
          type: boolean
        payments_statistics_distribution:
          type: array
          description: Observed distribution of aggregation window payments per status.
          items:
            $ref: '#/components/schemas/PaymentsPercentageStatistics1'
      required:
      - normal_average_rate
      - standard_deviation
      - high_percentile_indicator
      - low_accuracy_result_indicator
      - payments_statistics_distribution
    Observer:
      description: |
        Observer of the new account.

        Observer of the anomaly marker.

        Code Name Definition:
        *`NETW` - Network - Anomaly is observed by the network.
        *`REQU` - Requestor - Anomaly is observed by the requestor.
      type: string
      enum:
      - NETW
      - REQU
    DetectionContext:
      description: |
        Level at which the detection of new (pair of) account(s) is operated.


        Identifies the level at which the detection of new (pair of) account(s) or currency usage is operated.

        Code Name Definition:
        *`CRED` - Creditor - Anomaly detection at level of creditor account.
        *`DEBT` - Debtor - Anomaly detection at level of debtor account.
        *`PAIR` - Pair - PAIR is used for anomaly detection of payments exchanged between a given debtor and a given creditor account.
      type: string
      enum:
      - CRED
      - DEBT
      - PAIR
    ExecutionResult:
      description: |
        Response of the anomaly marker investigation service.

        Informs in a codified form whether an investigation query was executed successfully or whether it failed.

        Code Name Definition:
        *`FAIL` - Failed - The investigation query failed to execute.
        *`SUCC` - Success - The investigation query was executed successfully.
      type: string
      enum:
      - FAIL
      - SUCC
    AnomalySignalCode:
      description: |
        Type of anomaly signal leveraged to flag a potentially problematic (pair of) account(s).

        Identifies the type of anomaly signal leveraged to flag a potentially problematic (pair of) account(s).

        Code Name Definition:
        *`ABRT` - Abort - Anomaly signal is an abort.
        *`CANC` - RequestForCancellation - Anomaly signal is a request for cancellation.
        *`REJT` - Reject - Anomaly signal is a reject.
        *`RETN` - Return - Anomaly signal is a return.
      type: string
      enum:
      - ABRT
      - CANC
      - REJT
      - RETN
    MonitoredPeriod:
      description: "Period in scope of the anomaly marker. The monitored period defines the new messages that are aggregated over a certain period (the aggregation window) and the message history (the comparison period).\n\nUsage: \n\nThe aggregates of anomaly markers can be defined by the customers following two dimensions:\n\n- Rolling window: a sliding window, evolving with time passing by (for example, monitor the last 2 hours). The possible values of rolling windows are H24 (last 24 hours), D07 (last 7 days), and D30 (last 30 days).\n\n- Building up window: a fixed start window (for example, monitor since Monday 00:00 UTC).\n\nThe monitoring period codes combine the aggregation window (first three characters of the code) and the comparison period (last three caracters of the code). For example, the code D01M06 describes an aggregation window of D01 (one day) and a comparison period of M06 (6 months).\n\n\n\nNote: the usage of time zones is dependent on the setup of the service provider. One service provider can decide to define all timezones in UTC, and another service provide can determine the time zone based on the debtor or creditor agent timezones, for example.\n\nCurrently supported codes: \nD01M06:\nAggregation window: current day, derived from the selected level (debtor or creditor), building up window. Comparison period: daily average from the previous 6 months.\nExample: compare the aggregated messages sent today Tuesday 12 November 2024 since 00:00 UTC against the daily average of messages sent from May 2024 to October 2024.\n\nM01M12:\nAggregation window: current month, derived from the selected level (debtor or creditor), building up window. Comparison period: monthly average from the previous 12 months. Example: compare the aggregated messages sent since Friday 01 November 2024 00:00 UTC until now, and compare against the monthly average of messages sent between November 2023 and October 2024.\n\nH24M06:\nAggregation window: last 24 hours, rolling window. Comparison period: 24 hours average from the previous 6 months. Example: compare the aggregated messages sent during the last 24 hours against the daily average number of messages sent during the last 6 months.\n\nD30M12:\nAggregation window: Last 30 days, rolling window. Comparison period: monthly average from the previous maximum 12 months (if the last 30 days span across 2 months, then the comparison period will be 11 months). Example: compare the aggregated messages sent during the last 30 days against the monthly average number of messages sent during the last 12 months.\n\nD07M06:\nAggregation window: Last 7 days, rolling window. Comparison period: weekly average from the previous 6 months. Example: compare the aggregated messages sent during the last 7 days against a weekly average number of messages sent during the previous 6 months."
      type: string
      enum:
      - D01M06
      - D07M06
      - D30M12
      - H24M06
      - M01M12
    InterbankSettlementAmount:
      description: |
        Amount of money moved between the instructing agent and the instructed agent.

        Based on datatype ActiveCurrencyAndAmount: A number of monetary units specified in an active currency where the unit of currency is explicit and compliant with ISO 4217.
      type: object
      additionalProperties: false
      properties:
        currency:
          x-MXComponent: ActiveCurrencyCode
          type: string
          pattern: ^[A-Z]{3,3}$
        amount:
          type: number
          minimum: 0
      required:
      - currency
      - amount
    AmountMatch:
      description: |
        Identifies whether the anomaly check should be conducted on the basis of an exact Interbank Settlement Amount or rather on the basis of a partial match (95% - 105% of the specified Interbank Settlement Amount).


        Matching requirement for anomaly monitoring purposes.

        Code Name Definition:
        *`CMTC` - CloseMatch - Check should be conducted on a close match of the specified amount, as described in the service provider's service description.
        For example, 95-105% range.
        *`MTCH` - Match - Check should be conducted on an exact match of the specified amount.
      type: string
      enum:
      - CMTC
      - MTCH
    ErrorMessage:
      required:
      - code
      - severity
      - text
      type: object
      properties:
        severity:
          type: string
          description: Specifies the severity of the error.
          enum:
          - Fatal
          - Transient
          - Logic
        code:
          maxLength: 50
          type: string
          description: |
            A unique string which should identify the error and the system or service where it originated.
            * SwAPxxx codes are from Swift API gateway Platform.
            * Sw.RMA.xxx codes are from RMA Service Provider.
        text:
          maxLength: 1000
          type: string
          description: free-text field which should describe the problem and any recovery or remediation steps which can be taken.
      additionalProperties: false
  headers:
    X-Request-ID:
      required: true
      schema:
        type: string
        format: uuid
      examples:
        XRequestIdResponseHeader:
          value: ce480d68-2612-4aef-867a-e91566a1e012
      description: |-
        A Universally Unique Identifier (UUID) generated by the API Gateway for tracking and support purposes.
        The value received by a Service Provider in the X-Request-ID request header must be copied untouched in the X-Request-ID response header.
        This X-Request-ID response header must always be returned to the API consumer, even when the response is an error message.
    Content-Language:
      required: true
      schema:
        type: string
        pattern: "^[a-z]{2}(-[A-Z]{2})?$"
        description: 'More information on the value returned can be found in: https://www.rfc-editor.org/rfc/rfc9110.html#name-content-language.'
      example: en-US
      description: 'The HTTP Content-Language representation header is used to describe the language(s) intended for the audience, so users can differentiate it according to their own preferred language. More information can be found in: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Language.'
  responses:
    "400-BadRequest":
      description: Bad Request
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorMessage'
          examples:
            invalid_request:
              value:
                severity: Fatal
                code: Sw.cm.InvalidRequest
                text: Invalid request
            missing_mandatory_field:
              value:
                severity: Fatal
                code: Sw.cm.MandatoryFieldMissing
                text: Mandatory field %field missing
    "401-Unauthorized":
      description: Unauthorized
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorMessage'
          examples:
            from_authorization_failure:
              value:
                severity: Fatal
                code: Sw.cm.AuthorizationFailure
                text: From %From does not have the appropriate RBAC role
    "403-Forbidden":
      description: Forbidden
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorMessage'
          examples:
            from_authorization_failure:
              value:
                severity: Fatal
                code: Sw.cm.AuthorizationFailure
                text: From %From does not have the appropriate RBAC role
    "404-NotFound":
      description: Not Found
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorMessage'
          examples:
            resource_not_exist:
              value:
                severity: Fatal
                code: SwAP506
                text: Resource does not exist.
    "429-TooManyRequests":
      description: Too Many Requests
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorMessage'
          examples:
            system_too_many_requests:
              value:
                severity: Transient
                code: SwAP507
                text: Request cannot be processed at this time. Please try later. (header Retry-After indicates how long to wait before making a follow-up request).
    "503-ServiceUnavailable":
      description: ServerUnavailable
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorMessage'
    "504-GatewayTimeout":
      description: GatewayTimeout
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorMessage'
          examples:
            service_provider_timeout:
              value:
                severity: Transient
                code: SwAP591
                text: Service provider timeout
  examples:

    AnomalyDataReport1:
      summary: Example of report for one marker of each type
      value:
        anomaly_report_id: 14ebc84f-3135-4cd3-a72e-457167d95bcd
        new_account_analysis:
        - observer: NETW
          context: PAIR
          execution_result: SUCC
          anomaly_results:
            first_account_appearance_indicator: false
            count: 4
        new_currency_analysis:
        - observer: NETW
          context: PAIR
          execution_result: SUCC
          anomaly_results:
            first_currency_appearance_indicator: false
            count: 12
        problematic_account_reuse_analysis:
        - observer: NETW
          context: PAIR
          input_hours_delta: 96
          execution_result: SUCC
          anomaly_results:
            anomaly_statistics:
            - anomaly_signal_code: REJT
              anomaly_code: 'FRAD'
              count: 1
            anomaly:
            - anomaly_signal_code: REJT
              anomaly_code: 'FRAD'
              key_word_used_indicator: false
              usage_date: '2025-01-01'
              payment_date: '2025-01-01'
        repetitive_payments_analysis:
        - observer: NETW
          context: PAIR
          execution_result: SUCC
          input_hours_delta: 7
          amount_match: CMTC
          cross_currency_indicator: false
          anomaly_results:
            total_count: 12
            payments_statistics:
            - payment_status: 'ACCC'
              count: 12
        unusual_volume_analysis:
        - observer: NETW
          context: PAIR
          execution_result: SUCC
          monitored_period: D01M06
          cross_currency_indicator: false
          anomaly_results:
            normal_average_rate: 35
            standard_deviation: 3.14
            high_percentile_indicator: true
            low_accuracy_result_indicator: false
            payments_statistics_distribution:
            - payment_status: 'RJCT'
              percentage: 1.21
        unusual_amount_analysis:
        - observer: NETW
          context: PAIR
          execution_result: SUCC
          monitored_period: D01M06
          cross_currency_indicator: false
          anomaly_results:
            normal_average_rate: 35
            standard_deviation: 3.14
            high_percentile_indicator: true
            low_accuracy_result_indicator: false
            payments_statistics_distribution:
            - payment_status: 'RJCT'
              percentage: 1.21
    AnomalyMarkersParameter2:
      summary: Example of request asking for one marker of each type
      value:
        anomaly_markers_id: 14ebc84f-3135-4cd3-a72e-457167d95bcd
        payment:
          debtor:
            any_bic: CHASUS33
          debtor_account:
            iban: NO93860111171947
          debtor_agent:
            bicfi: CHASUS33
          creditor:
            any_bic: CHASUS33
          creditor_account:
            iban: NO93860111171947
          creditor_agent:
            bicfi: CHASUS33
          interbank_settlement_amount:
            currency: EUR
            amount: 123456.78
          uetr: cda46001-0240-4db1-b01a-0694a7693b89
        anomaly_markers:
          new_account:
          - observer: NETW
            context: PAIR
          new_currency:
          - observer: NETW
            context: PAIR
          problematic_account_reuse:
          - observer: NETW
            context: PAIR
            input_hours_delta: 96
          repetitive_payments:
          - observer: NETW
            context: PAIR
            input_hours_delta: 7
            amount_match: CMTC
            cross_currency_indicator: false
          unusual_volume:
          - observer: NETW
            context: PAIR
            monitored_period: D01M06
            cross_currency_indicator: false
          unusual_amount:
          - observer: NETW
            context: PAIR
            monitored_period: D01M06
            cross_currency_indicator: false

  securitySchemes:
  
    bearerToken:
      type: http
      scheme: bearer
      bearerFormat: opaque OAuth 2.0