openapi: 3.0.0
info:
  description: >
    This is the specification of the bLink 'custody-services' module API. (as
    implemented by providers (e.g. financial institutions) and used by SIX) 

    It is part of the OpenWealth APIs for the connectivity between custody banks
    and WealthTechs (e.g. Portfolio Management Systems). This API allows the
    user to receive data from custody banks regarding accounts and positions.
    The API is designed to be used for either update end of day data batches or
    single near-realtime account/position information. Furthermore, this API
    allows the user to receive data from custody banks regarding transactions.
    In this version only transactions which include effective cash or securities
    movements are in scope and corporate actions are delivered only on a
    informative basis.
  version: 1.0.10.4-fi
  title: bLink API - custody services module
  contact:
    name: SIX BBS AG
    url: https://www.six-group.com/en/products-services/banking-services/blink.html
servers:
  - url: >-
      https://api-cert.six-group.com/api/bankingservices/b-link-consent-2/custody-services/v1
paths:
  /customerAccounts:
    parameters:
      - $ref: '#/components/parameters/cursor'
      - $ref: '#/components/parameters/limit'
      - $ref: '#/components/parameters/correlation_in_header'
      - $ref: '#/components/parameters/authorization_in_header'
      - $ref: '#/components/parameters/clientid_in_header'
      - $ref: '#/components/parameters/agent_in_header'
      - $ref: '#/components/parameters/optional_targetid_in_header'
      - $ref: '#/components/parameters/optional_psu_ip_in_header'
      - $ref: '#/components/parameters/optional_psu_user_agent_in_header'
    get:
      summary: >-
        Returns all customers and respective accounts accessible for the logged
        in user.
      description: >-
        This endpoint returns a highlevel list of customers and the respective
        accounts accessible for the logged in user. Paging is done based on the
        customerOverview object, i.e. if limit is set to 1, then 1
        customerOverview will be returned per page.
      operationId: getCustomerAccounts
      tags:
        - customeraccounts
      responses:
        '200':
          description: Returns a list with all customers and the respective accounts.
          headers:
            X-Correlation-ID:
              $ref: '#/components/headers/X-Correlation-ID'
            nextCursor:
              $ref: '#/components/headers/nextCursor'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/customerOverview'
        '400':
          $ref: '#/components/responses/standard400'
        '401':
          $ref: '#/components/responses/standard401'
        '403':
          $ref: '#/components/responses/standard403'
        '404':
          $ref: '#/components/responses/standard404'
        '405':
          $ref: '#/components/responses/standard405'
        '500':
          $ref: '#/components/responses/standard500'
        '501':
          $ref: '#/components/responses/standard501'
        '503':
          $ref: '#/components/responses/standard503'
  /customerAccounts/{customerId}:
    parameters:
      - $ref: '#/components/parameters/customerIdParam'
      - $ref: '#/components/parameters/cursor'
      - $ref: '#/components/parameters/limit'
      - $ref: '#/components/parameters/correlation_in_header'
      - $ref: '#/components/parameters/authorization_in_header'
      - $ref: '#/components/parameters/clientid_in_header'
      - $ref: '#/components/parameters/agent_in_header'
      - $ref: '#/components/parameters/optional_targetid_in_header'
      - $ref: '#/components/parameters/optional_psu_ip_in_header'
      - $ref: '#/components/parameters/optional_psu_user_agent_in_header'
    get:
      summary: >-
        Returns a specific customers and respective accounts accessible for the
        logged in user.
      description: >-
        This endpoint returns a highlevel list of a customer and the respective
        accounts accessible for the logged in user.
      operationId: getCustomerAccountsByCustomerId
      tags:
        - customeraccounts
      responses:
        '200':
          description: Returns a the specified customers and the respective accounts.
          headers:
            X-Correlation-ID:
              $ref: '#/components/headers/X-Correlation-ID'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/customerOverview'
        '400':
          $ref: '#/components/responses/standard400'
        '401':
          $ref: '#/components/responses/standard401'
        '403':
          $ref: '#/components/responses/standard403'
        '404':
          $ref: '#/components/responses/standard404'
        '405':
          $ref: '#/components/responses/standard405'
        '500':
          $ref: '#/components/responses/standard500'
        '501':
          $ref: '#/components/responses/standard501'
        '503':
          $ref: '#/components/responses/standard503'
  /customers/{customerId}/positions:
    parameters:
      - $ref: '#/components/parameters/customerIdParam'
      - $ref: '#/components/parameters/dateParam'
      - $ref: '#/components/parameters/endOfDayParam'
      - $ref: '#/components/parameters/dateTypeParam'
      - $ref: '#/components/parameters/cursor'
      - $ref: '#/components/parameters/limit'
      - $ref: '#/components/parameters/correlation_in_header'
      - $ref: '#/components/parameters/authorization_in_header'
      - $ref: '#/components/parameters/clientid_in_header'
      - $ref: '#/components/parameters/agent_in_header'
      - $ref: '#/components/parameters/optional_targetid_in_header'
      - $ref: '#/components/parameters/optional_psu_ip_in_header'
      - $ref: '#/components/parameters/optional_psu_user_agent_in_header'
    get:
      summary: Returns all positions for a specific customer.
      description: >-
        Returns all positions (incl. investment cash accounts) for a specific
        customer. Paging is done based on the account object, i.e. if limit is
        set to 1, then 1 account will be returned per page.
      operationId: getPositionsByCustomerId
      tags:
        - positions
      responses:
        '200':
          description: Position List
          headers:
            X-Correlation-ID:
              $ref: '#/components/headers/X-Correlation-ID'
            nextCursor:
              $ref: '#/components/headers/nextCursor'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/customerAndStatementResponse'
        '400':
          $ref: '#/components/responses/standard400'
        '401':
          $ref: '#/components/responses/standard401'
        '403':
          $ref: '#/components/responses/standard403'
        '404':
          $ref: '#/components/responses/standard404'
        '405':
          $ref: '#/components/responses/standard405'
        '500':
          $ref: '#/components/responses/standard500'
        '501':
          $ref: '#/components/responses/standard501'
        '503':
          $ref: '#/components/responses/standard503'
  /accounts/{accountId}/positions:
    parameters:
      - $ref: '#/components/parameters/accountIdParam'
      - $ref: '#/components/parameters/dateParam'
      - $ref: '#/components/parameters/endOfDayParam'
      - $ref: '#/components/parameters/dateTypeParam'
      - $ref: '#/components/parameters/cursor'
      - $ref: '#/components/parameters/limit'
      - $ref: '#/components/parameters/correlation_in_header'
      - $ref: '#/components/parameters/authorization_in_header'
      - $ref: '#/components/parameters/clientid_in_header'
      - $ref: '#/components/parameters/agent_in_header'
      - $ref: '#/components/parameters/optional_targetid_in_header'
      - $ref: '#/components/parameters/optional_psu_ip_in_header'
      - $ref: '#/components/parameters/optional_psu_user_agent_in_header'
    get:
      summary: Returns the positions for a customer's specific account.
      description: >-
        Returns all positions for a specific account. Paging is done based on
        the position object, i.e. if limit is set to 1, then 1 position will be
        returned per page.
      operationId: getPositionsByAccountId
      tags:
        - positions
      responses:
        '200':
          description: Position List
          headers:
            X-Correlation-ID:
              $ref: '#/components/headers/X-Correlation-ID'
            nextCursor:
              $ref: '#/components/headers/nextCursor'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/customerAndStatementResponse'
        '400':
          $ref: '#/components/responses/standard400'
        '401':
          $ref: '#/components/responses/standard401'
        '403':
          $ref: '#/components/responses/standard403'
        '404':
          $ref: '#/components/responses/standard404'
        '405':
          $ref: '#/components/responses/standard405'
        '500':
          $ref: '#/components/responses/standard500'
        '501':
          $ref: '#/components/responses/standard501'
        '503':
          $ref: '#/components/responses/standard503'
  /customers/{customerId}/transactions:
    parameters:
      - $ref: '#/components/parameters/customerIdParam'
      - $ref: '#/components/parameters/dateParam'
      - $ref: '#/components/parameters/dateTypeParam'
      - $ref: '#/components/parameters/endOfDayParam'
      - $ref: '#/components/parameters/cursor'
      - $ref: '#/components/parameters/limit'
      - $ref: '#/components/parameters/correlation_in_header'
      - $ref: '#/components/parameters/authorization_in_header'
      - $ref: '#/components/parameters/clientid_in_header'
      - $ref: '#/components/parameters/agent_in_header'
      - $ref: '#/components/parameters/optional_targetid_in_header'
      - $ref: '#/components/parameters/optional_psu_ip_in_header'
      - $ref: '#/components/parameters/optional_psu_user_agent_in_header'
    get:
      summary: Returns transactions for a specific customer.
      description: >-
        Returns all transactions for the a specific customer. Paging is done
        based on the transaction object, i.e. if limit is set to 1, then 1
        transaction will be returned per page.
      operationId: getTransactionsByCustomerId
      tags:
        - transactions
      responses:
        '200':
          description: Returns a transaction list for a specific customer.
          headers:
            X-Correlation-ID:
              $ref: '#/components/headers/X-Correlation-ID'
            nextCursor:
              $ref: '#/components/headers/nextCursor'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/transactionAndStatementResponse'
        '400':
          $ref: '#/components/responses/standard400'
        '401':
          $ref: '#/components/responses/standard401'
        '403':
          $ref: '#/components/responses/standard403'
        '404':
          $ref: '#/components/responses/standard404'
        '405':
          $ref: '#/components/responses/standard405'
        '500':
          $ref: '#/components/responses/standard500'
        '501':
          $ref: '#/components/responses/standard501'
        '503':
          $ref: '#/components/responses/standard503'
  /accounts/{accountId}/transactions:
    parameters:
      - $ref: '#/components/parameters/accountIdParam'
      - $ref: '#/components/parameters/dateParam'
      - $ref: '#/components/parameters/dateTypeParam'
      - $ref: '#/components/parameters/endOfDayParam'
      - $ref: '#/components/parameters/cursor'
      - $ref: '#/components/parameters/limit'
      - $ref: '#/components/parameters/correlation_in_header'
      - $ref: '#/components/parameters/authorization_in_header'
      - $ref: '#/components/parameters/clientid_in_header'
      - $ref: '#/components/parameters/agent_in_header'
      - $ref: '#/components/parameters/optional_targetid_in_header'
      - $ref: '#/components/parameters/optional_psu_ip_in_header'
      - $ref: '#/components/parameters/optional_psu_user_agent_in_header'
    get:
      summary: Returns the transactions a specific account.
      description: >-
        Returns the transactions for all positions in a specific account. Paging
        is done based on the transaction object, i.e. if limit is set to 1, then
        1 transaction will be returned per page.
      operationId: getTransactionsByAccountId
      tags:
        - transactions
      responses:
        '200':
          description: >-
            Returns a transactions list for all positions and cash accounts in a
            specific protfolio.
          headers:
            X-Correlation-ID:
              $ref: '#/components/headers/X-Correlation-ID'
            nextCursor:
              $ref: '#/components/headers/nextCursor'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/transactionAndStatementResponse'
        '400':
          $ref: '#/components/responses/standard400'
        '401':
          $ref: '#/components/responses/standard401'
        '403':
          $ref: '#/components/responses/standard403'
        '404':
          $ref: '#/components/responses/standard404'
        '405':
          $ref: '#/components/responses/standard405'
        '500':
          $ref: '#/components/responses/standard500'
        '501':
          $ref: '#/components/responses/standard501'
        '503':
          $ref: '#/components/responses/standard503'
  /positions/{positionId}/transactions:
    parameters:
      - $ref: '#/components/parameters/positionIdParam'
      - $ref: '#/components/parameters/dateParam'
      - $ref: '#/components/parameters/dateTypeParam'
      - $ref: '#/components/parameters/endOfDayParam'
      - $ref: '#/components/parameters/cursor'
      - $ref: '#/components/parameters/limit'
      - $ref: '#/components/parameters/correlation_in_header'
      - $ref: '#/components/parameters/authorization_in_header'
      - $ref: '#/components/parameters/clientid_in_header'
      - $ref: '#/components/parameters/agent_in_header'
      - $ref: '#/components/parameters/optional_targetid_in_header'
      - $ref: '#/components/parameters/optional_psu_ip_in_header'
      - $ref: '#/components/parameters/optional_psu_user_agent_in_header'
    get:
      summary: Returns the transactions for a specific position.
      description: >-
        Returns transactions for a specific position. Paging is done based on
        the transaction object, i.e. if limit is set to 1, then 1 transaction
        will be returned per page.
      operationId: getTransactionsByPositionId
      tags:
        - transactions
      responses:
        '200':
          description: Transaction list
          headers:
            X-Correlation-ID:
              $ref: '#/components/headers/X-Correlation-ID'
            nextCursor:
              $ref: '#/components/headers/nextCursor'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/transactionAndStatementResponse'
        '400':
          $ref: '#/components/responses/standard400'
        '401':
          $ref: '#/components/responses/standard401'
        '403':
          $ref: '#/components/responses/standard403'
        '404':
          $ref: '#/components/responses/standard404'
        '405':
          $ref: '#/components/responses/standard405'
        '500':
          $ref: '#/components/responses/standard500'
        '501':
          $ref: '#/components/responses/standard501'
        '503':
          $ref: '#/components/responses/standard503'
  /healthcheck:
    get:
      tags:
        - diagnostics
      summary: >-
        Returns all specified request headers and additional diagnostic
        information
      operationId: healthCheckGet
      parameters:
        - $ref: '#/components/parameters/optional_correlation_in_header'
        - $ref: '#/components/parameters/optional_authorization_in_header'
        - $ref: '#/components/parameters/optional_agent_in_header'
        - $ref: '#/components/parameters/optional_targetid_in_header'
        - $ref: '#/components/parameters/clientid_in_header'
        - $ref: '#/components/parameters/optional_psu_ip_in_header'
        - $ref: '#/components/parameters/optional_psu_user_agent_in_header'
      responses:
        '200':
          description: Health Check Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/healthCheckResponse'
    post:
      tags:
        - diagnostics
      summary: >-
        Returns all specified request headers, the request body and additional
        diagnostic information
      operationId: healthCheckPost
      parameters:
        - $ref: '#/components/parameters/optional_correlation_in_header'
        - $ref: '#/components/parameters/optional_authorization_in_header'
        - $ref: '#/components/parameters/optional_agent_in_header'
        - $ref: '#/components/parameters/optional_targetid_in_header'
        - $ref: '#/components/parameters/clientid_in_header'
        - $ref: '#/components/parameters/optional_psu_ip_in_header'
        - $ref: '#/components/parameters/optional_psu_user_agent_in_header'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: string
      responses:
        '200':
          description: Health Check Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/healthCheckResponse'
components:
  parameters:
    limit:
      name: limit
      in: query
      description: Maximum number of items to return.
      required: false
      schema:
        type: integer
        format: int32
        minimum: 1
    cursor:
      name: cursor
      in: query
      description: An opaque string value used for pagination
      required: false
      schema:
        type: string
    customerIdParam:
      name: customerId
      in: path
      required: true
      schema:
        type: string
      description: The customer's id
    accountIdParam:
      name: accountId
      in: path
      required: true
      schema:
        type: string
      description: The customer's account identification
    dateParam:
      name: date
      in: query
      required: true
      schema:
        type: string
        format: date
        example: '2019-12-31'
      description: Full-date according to ISO 8601 i.e. YYYY-MM-DD format.
    dateTypeParam:
      name: dateType
      in: query
      required: true
      schema:
        type: string
        enum:
          - transactionDate
          - bookingDate
          - valueDate
      description: Indicates which type of date is decisive for the data shown.
    positionIdParam:
      name: positionId
      in: path
      required: true
      schema:
        type: string
      description: The position's id
    endOfDayParam:
      name: eodIndicator
      in: query
      required: true
      description: >-
        Indicates whether the position data is end-of-day (eod) data for the
        positions. If the parameter is set to false, the most recent data is
        shown, incl intraday changes on the position if the date is set to
        today.
      schema:
        type: boolean
        example: true
        default: true
    authorization_in_header:
      name: Authorization
      in: header
      description: Bearer followed by a base64 encoded OAuth access token
      required: true
      schema:
        type: string
    optional_authorization_in_header:
      name: Authorization
      in: header
      description: Bearer followed by a base64 encoded OAuth access token
      required: false
      schema:
        type: string
    correlation_in_header:
      name: X-Correlation-ID
      in: header
      description: >-
        Unique ID (defined by the caller) which will be reflected back in the
        response.
      required: true
      schema:
        type: string
        maxLength: 64
    agent_in_header:
      name: User-Agent
      in: header
      description: Name and version of the of the Client software
      required: true
      schema:
        type: string
    optional_targetid_in_header:
      name: X-CorAPI-Target-ID
      in: header
      description: 'ID of the target, e.g., a financial institution. (SCOPE: FI - optional)'
      required: false
      schema:
        type: string
    optional_correlation_in_header:
      name: X-Correlation-ID
      in: header
      description: >-
        Unique ID (defined by the caller) which will be reflected back in the
        response.
      required: false
      schema:
        type: string
        maxLength: 64
    optional_agent_in_header:
      name: User-Agent
      in: header
      description: Name and version of the of the client software
      required: false
      schema:
        type: string
    optional_psu_ip_in_header:
      name: X-PSU-IP-Address
      in: header
      description: 'IP address of the user initiating the operation (SCOPE: FI - optional)'
      required: false
      schema:
        type: string
    optional_psu_user_agent_in_header:
      name: X-PSU-User-Agent
      in: header
      description: 'User of the client software (SCOPE: FI - optional)'
      required: false
      schema:
        type: string
    clientid_in_header:
      name: X-CorAPI-Client-ID
      in: header
      description: 'ID of the client forwarded to the provider. (SCOPE: FI)'
      required: true
      schema:
        type: string
  headers:
    Content-Language:
      description: always en
      schema:
        type: string
    Content-Type:
      description: application/problem+json; charset=utf-8 according to RFC7807
      schema:
        type: string
    WWW-Authenticate:
      description: i.e. "Bearer error='invalid_token'" according to RFC6750 section-3
      schema:
        type: string
    X-Correlation-ID:
      description: >-
        Client defined ID from request to correlate HTTP requests between a
        client and a server
      schema:
        type: string
        maxLength: 64
        example: f058ebd6-02f7-4d3f-942e-904344e8cde5
    X-CorAPI-Source:
      description: >
        Indicates whether the response was created by the bLink platform or by
        the provider.
      schema:
        type: string
        enum:
          - PLATFORM
          - PROVIDER
    nextCursor:
      description: An opaque string value, or an empty string if there are no more results.
      required: false
      schema:
        type: string
  schemas:
    customerOverview:
      type: object
      description: Overview of the customer with the respective accounts
      required:
        - customerIdentification
      properties:
        customerIdentification:
          type: string
          minLength: 1
          maxLength: 35
          example: 123123456
          description: >-
            Unique and unambiguous identification used by the bank for the
            customer.
        customerReferenceCurrency:
          $ref: '#/components/schemas/currency'
        accountOverview:
          type: array
          items:
            $ref: '#/components/schemas/accountInformation'
    currency:
      description: ISO 4217 code
      type: string
      pattern: '[A-Z]{3}'
      example: CHF
    date:
      type: string
      format: date
      description: Date according to ISO 8601 i.e. YYYY-MM-DD format
      example: '2018-04-13'
    accountInformation:
      type: object
      required:
        - accountIdentification
        - accountIdentificationType
        - accountType
        - accountReferenceCurrency
      properties:
        accountIdentification:
          type: string
          maxLength: 35
          example: 876543219
          description: Unique and unambiguous identification for the account
        accountIdentificationType:
          type: string
          description: Indicates the type of the account identification. IBAN is prefered.
          example: other
          enum:
            - iban
            - other
        accountType:
          type: string
          description: >-
            Indicatates the type of the account. If the account type is
            cashAccount, no information on the financial instrument is provided
            in the respective position in the account.
          enum:
            - cashAccount
            - safekeepingAccount
            - other
        accountReferenceCurrency:
          $ref: '#/components/schemas/currency'
        accountName:
          type: string
          maxLength: 70
          description: >-
            Name of the account. It provides an additional means of
            identification, and is designated by the account servicer in
            agreement with the account owner.
          example: Household account
        accountDesignation:
          type: string
          maxLength: 70
          description: >-
            Supplementary information on the account. Designated by the account
            servicer.
          example: Current Account CHF
        portfolioInformation:
          $ref: '#/components/schemas/portfolioInformation'
    portfolioInformation:
      type: object
      properties:
        portfolioIdentification:
          type: string
          minLength: 1
          maxLength: 35
          example: 876543219
          description: >-
            Unique and unambiguous identification for the portfolio between the
            portfolio owner and the portfolio servicer
        portfolioReferenceCurrency:
          $ref: '#/components/schemas/currency'
    customerAccounts:
      type: object
      required:
        - customerIdentification
      properties:
        customerIdentification:
          type: string
          minLength: 1
          maxLength: 35
          example: 123123456
          description: >-
            Unique and unambiguous identification used by the bank for the
            customer.
        customerReferenceCurrency:
          $ref: '#/components/schemas/currency'
        accountList:
          type: array
          items:
            $ref: '#/components/schemas/account'
    customerAndStatementResponse:
      type: object
      description: Wrapper object for customerAccounts and a transaction
      properties:
        statement:
          $ref: '#/components/schemas/statement'
        customer:
          $ref: '#/components/schemas/customerAccounts'
    statement:
      type: object
      required:
        - statementDateTime
        - date
        - endOfDayIndicator
      properties:
        statementDateTime:
          type: string
          format: date-time
          example: '2018-04-13T11:11:11Z'
          description: >-
            Date and time of the statement creation (UTC Timestamp). In
            accordance with ISO 8601.
        date:
          type: object
          required:
            - date
            - dateType
          properties:
            date:
              type: string
              format: date
              example: '2018-04-13'
              description: Full-date according to ISO 8601 i.e. YYYY-MM-DD format.
            dateType:
              type: string
              example: transactionDate
              description: Specifies the type of date.
              enum:
                - transactionDate
                - bookingDate
                - valueDate
        endOfDayIndicator:
          type: boolean
          description: >-
            Indicates whether the data displayed is end-of-day data. If true,
            the data is end-of-day data. If false and date is today, current
            (intraday) data will be displayed.
          example: true
    account:
      type: object
      required:
        - accountInformation
        - positionList
      properties:
        accountInformation:
          $ref: '#/components/schemas/accountInformation'
        externalReference:
          type: string
          maxLength: 35
          example: 987-654-321
          description: Account reference used by a bank external party, e.g. PMS
        positionList:
          type: array
          description: A list of positions
          items:
            $ref: '#/components/schemas/position'
    position:
      type: object
      required:
        - identification
        - currency
        - amountOrUnits
        - instrumentIdentification
      properties:
        identification:
          type: string
          maxLength: 35
          example: 876543219
          description: Identification for the position given by the bank
        externalReference:
          type: string
          maxLength: 35
          example: 987-654-321
          description: >-
            Reference used by the external party, e.g. Portfolio Management
            Systems
        currency:
          $ref: '#/components/schemas/currency'
        amountOrUnits:
          type: object
          properties:
            amount:
              type: string
              pattern: '[0-9]{1,12}([.][0-9]{1,9})?'
              maxLength: 22
              example: '12000'
              description: Absolute amount of the position
            type:
              type: string
              description: Specifies the type of the amount
              example: nominal
              enum:
                - unitsNumber
                - nominal
            creditDebitIndicator:
              type: string
              enum:
                - credit
                - debit
              example: debit
              description: Specifies if a position has a positive or negative value
        positionName:
          type: string
          maxLength: 70
          example: Stark Industries Inc.
          description: Name of the position.
        prices:
          type: array
          description: >-
            List of prices regarding the position incl. valuation in account
            currency
          items:
            type: object
            properties:
              amount:
                type: string
                pattern: '[0-9]{1,12}([.][0-9]{1,9})?'
                maxLength: 22
                example: '100.36'
                description: Price indication
              amountType:
                type: string
                description: >-
                  Indicates whether the price amount is depicted as unit price
                  or percentage.
                example: percentage
                enum:
                  - perUnit
                  - percentage
              creditDebitIndicator:
                type: string
                enum:
                  - credit
                  - debit
                example: debit
                description: >-
                  Specifies if the amount is a debit (negative) or credit
                  (positive) amount.
              priceType:
                type: string
                description: Indicates the type of the price.
                example: costPrice
                enum:
                  - dealPrice
                  - marketPrice
                  - costPrice
              currency:
                $ref: '#/components/schemas/currency'
              date:
                type: string
                format: date
                description: >-
                  Date of the end of day price. Date according to ISO 8601 i.e.
                  YYYY-MM-DD format
              sourceOfPrice:
                type: string
                maxLength: 70
                description: Indicates the source of the (market)price
                example: SIX Swiss Exchange
              foreignExchangeRates:
                type: array
                items:
                  $ref: '#/components/schemas/foreignExchangeRate'
              valuation:
                type: object
                description: >-
                  Valuation of the position in account currency. Accrued
                  interests are not included in the valuation.
                properties:
                  amount:
                    type: string
                    pattern: '[0-9]{1,12}([.][0-9]{1,9})?'
                    maxLength: 22
                    description: Absolute amount of the valuation
                    example: '13104.5'
                  currency:
                    $ref: '#/components/schemas/currency'
                  creditDebitIndicator:
                    type: string
                    enum:
                      - credit
                      - debit
                    example: credit
                    description: >-
                      Specifies if the amount is a debit (negative) or credit
                      (positive) amount.
        safekeepingPlace:
          type: string
          pattern: '[A-Z]{6,6}[A-Z2-9][A-NP-Z0-9]([A-Z0-9]{3,3}){0,1}'
          example: INSECHZZXXX
          description: >-
            BIC of the place where the securities are safe-kept, physically or
            notionally
        additionalCustodianInformation:
          type: string
          pattern: '[A-Z]{6,6}[A-Z2-9][A-NP-Z0-9]([A-Z0-9]{3,3}){0,1}'
          example: INSECHZZXXX
          description: >-
            Used for special use cases where safekeepingPlace is not sufficient.
            BIC of the place where the securities are safe-kept, physically or
            notionally
        accruedInterest:
          type: object
          properties:
            amount:
              type: string
              pattern: '[0-9]{1,12}([.][0-9]{1,9})?'
              maxLength: 22
              example: '10.25'
              description: >-
                Absolute interest amount that has accrued in between coupon
                payment periods
            currency:
              $ref: '#/components/schemas/currency'
            creditDebitIndicator:
              type: string
              enum:
                - credit
                - debit
              example: debit
              description: >-
                Specifies if the accrued interest amount has a positive or
                negative value
            numberOfDaysAccrued:
              type: integer
              example: 34
              description: Number of days used for calculating the accrued interest amount.
        positionAdditionalDetails:
          type: string
          maxLength: 70
          description: Provides additional information on the position.
          example: Belongs to contract 129959959
        financialInstrument:
          $ref: '#/components/schemas/financialInstrument'
    foreignExchangeRate:
      type: object
      properties:
        sourceCurrency:
          description: Currency of the amount to be converted in a currency conversion.
          type: string
          pattern: '[A-Z]{3}'
          example: CHF
        rate:
          type: string
          pattern: '[0-9]{1,12}([.][0-9]{1,9})?'
          maxLength: 22
          example: '1.0963'
          description: >-
            Indicates the rate of a fx transaction for one source currency unit
            to the target currency. E.g. 1GBP=xxxEUR, where the source currency
            is GBP and the target currency is EUR.
        targetCurrency:
          description: >-
            Currency into which an amount is to be converted in a currency
            conversion.
          type: string
          pattern: '[A-Z]{3}'
          example: CHF
        fxType:
          type: string
          description: >-
            Defines the type of the indicated fx rate, whether it’s a real
            (traded) price or a calculatory price.
          example: calculatory
          enum:
            - real
            - calculatory
    financialInstrument:
      type: object
      required:
        - financialInstrumentIdentification
        - inactiveIndicator
      properties:
        financialInstrumentIdentification:
          type: object
          required:
            - identification
            - type
          properties:
            identification:
              type: string
              maxLength: 35
              example: CH0012005267
              description: Instrument identification
            type:
              type: string
              example: isin
              description: Type of the instrument identification
              enum:
                - isin
                - sedol
                - cusip
                - ric
                - tickerSymbol
                - bloomberg
                - cta
                - quick
                - wertpapier
                - dutch
                - valoren
                - sicovam
                - belgian
                - common
                - otherProprietaryIdentification
        financialInstrumentName:
          type: string
          maxLength: 70
          example: Novartis AG
          description: Name of the financial instrument in free format text.
        interests:
          type: object
          properties:
            rate:
              type: string
              pattern: '[0-9]{1,12}([.][0-9]{1,9})?'
              maxLength: 22
              example: '0.00125'
              description: Interest rate of the instrument
            currency:
              $ref: '#/components/schemas/currency'
            dayCountBasis:
              type: string
              example: u30_360
              description: Interest method of the instrument
              enum:
                - act_360
                - act_365
                - act_actIcma
                - act_actIsda
                - act_actAfb
                - u30_360
                - u30E_360Icma
                - u30E_360Isda
                - u30E_360
                - u30U_360
            paymentDate:
              type: string
              format: date
              example: '2020-04-19'
              description: >-
                Date of the next interest payment. Full-date according to ISO
                8601 i.e. YYYY-MM-DD format.
            paymentFrequency:
              type: string
              description: Specifies the frequency of an interest payment.
              example: quarterly
              enum:
                - annual
                - monthly
                - quarterly
                - semiAnnual
                - weekly
                - atMaturity
                - other
        dates:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
                description: Indicates the type of date
                example: issueDate
                enum:
                  - issueDate
                  - maturityDate
                  - nextCallableDate
                  - excerciseDate
                  - expiryDate
                  - couponDate
                  - floatingRateFixingDate
                  - conversionDate
                  - putableDate
                  - datedDate
                  - firstPaymentDate
                  - nextFactorDate
              date:
                type: string
                format: date
                description: Full-date according to ISO 8601 i.e. YYYY-MM-DD format.
                example: '2019-12-31'
        optionDetails:
          type: object
          properties:
            optionType:
              type: string
              example: call
              enum:
                - call
                - put
              description: >-
                Specifies whether it is a Call option (right to purchase a
                specific underlying asset) or a Put option (right to sell a
                specific underlying asset).
            optionStyle:
              type: string
              example: amer
              enum:
                - amer
                - euro
                - berm
              description: >-
                Specifies how an option can be exercised (American, European,
                Bermudan).
        contractSize:
          type: string
          pattern: '[0-9]{1,12}([.][0-9]{1,9})?'
          maxLength: 22
          example: '100'
          description: Contract size of the instrument
        minimumDenomination:
          type: string
          pattern: '[0-9]{1,12}([.][0-9]{1,9})?'
          maxLength: 22
          example: '100000'
          description: Indicates the minimum denomination of a security.
        minimumIncrement:
          type: string
          pattern: '[0-9]{1,12}([.][0-9]{1,9})?'
          maxLength: 22
          example: '10000'
          description: Indicates the minimum tradable increments of a security.
        financialInstrumentPrices:
          type: array
          description: >-
            Provides information on different prices that are realted to the
            functionality of the financial instrument.
          items:
            type: object
            properties:
              amount:
                type: string
                pattern: '[0-9]{1,12}([.][0-9]{1,9})?'
                maxLength: 22
                example: '100.9'
                description: Declares the amount of the indicated price
              creditDebitIndicator:
                type: string
                enum:
                  - credit
                  - debit
                example: debit
                description: Specifies if amount has a positive or negative value
              currency:
                $ref: '#/components/schemas/currency'
              type:
                type: string
                example: strikePrice
                description: Indicates the type of the price
                enum:
                  - strikePrice
                  - capPrice
                  - floorPrice
                  - conversionPrice
                  - excercisePrice
                  - subscriptionPrice
        inactiveIndicator:
          type: boolean
          description: Indicates whether the instrument is inactive
          default: false
        underlyingList:
          type: array
          description: List of underlying instruments
          items:
            type: object
            properties:
              underlyingFinancialInstrument:
                type: object
                properties:
                  identification:
                    type: string
                    maxLength: 35
                    description: Instrument identification
                    example: CH0012005267
                  type:
                    type: string
                    description: Type of the instrument identification
                    example: isin
                    enum:
                      - isin
                      - sedol
                      - cusip
                      - ric
                      - tickerSymbol
                      - bloomberg
                      - cta
                      - quick
                      - wertpapier
                      - dutch
                      - valoren
                      - sicovam
                      - belgian
                      - common
                      - otherProprietaryIdentification
        financialInstrumentAttributeAdditionalDetails:
          type: string
          maxLength: 70
          description: >-
            Provides additional information about the financial instrument in
            narrative form.
          example: Group contract number 129959961
    transactionAndStatementResponse:
      type: object
      description: Wrapper object for a statement and transaction
      properties:
        statement:
          $ref: '#/components/schemas/statement'
        transactions:
          type: array
          items:
            $ref: '#/components/schemas/transaction'
    transaction:
      type: object
      required:
        - customerIdentification
        - transactionIdentification
        - reversalIndicator
        - dateList
        - transactionType
        - transactionSubtype
      properties:
        customerIdentification:
          type: string
          maxLength: 35
          description: Customer ID used by the bank
          example: 987654321
        transactionIdentification:
          type: string
          maxLength: 35
          example: 987654321
          description: Transaction ID given by the bank
        placeOfTrade:
          type: object
          description: Market in which a trade transaction is to be or has been executed.
          properties:
            marketIdentificationCode:
              type: string
              maxLength: 4
              description: >-
                Market Identifier Code. Identification of a financial market, as
                stipulated in the norm ISOMarket Identifier Code. Identification
                of a financial market, as stipulated in the norm ISO 10383
                "Codes for exchanges and market identifications".
              example: XSWX
            marketDescription:
              type: string
              maxLength: 35
              description: >-
                Description of the market when no Market Identification Code is
                available.
              example: OTC
        reversalIndicator:
          description: >-
            Indicates whether it is the reversal of a previously reported
            movement.
          type: boolean
          default: false
        reversedTransactionIdentification:
          type: string
          maxLength: 35
          description: States the identification of the transaction that was reversed
          example: 2134123415
        dateList:
          type: array
          items:
            type: object
            required:
              - date
              - dateType
            properties:
              date:
                $ref: '#/components/schemas/date'
              dateType:
                type: string
                description: Type of the date
                enum:
                  - effectiveSettlementDate
                  - settlementDate
                  - valueDate
                  - performanceDate
                  - bookingDate
                  - transactionDate
                example: settlementDate
        transactionType:
          type: string
          description: Type of the transaction
          example: securitiesExchange
          enum:
            - securitiesExchange
            - cash
            - fees
            - credit
            - fx
            - taxes
            - corporateActions
            - fiduciary
            - moneyMarket
            - securitiesTransfer
            - physical
            - otcForwardRateAgreement
            - otcOption
            - otcCreditDefaultSwap
            - otcTotalReturnSwap
            - otcIRSCapsFloorsCollars
            - otcInterestRateSwap
            - otcCrossCurrencySwap
            - otcSwaption
            - others
        transactionSubtype:
          type: string
          maxLength: 35
          description: Gives detailed information about the category of a transaction.
          example: Buy
        underlyingFinancialInstrument:
          type: object
          description: Security concerned by the corporate action.
          properties:
            identification:
              type: string
              maxLength: 35
              example: US8851601018
              description: Identification of the instrument
            type:
              type: string
              example: isin
              description: Type of the instrument ID
              enum:
                - isin
                - sedol
                - cusip
                - ric
                - tickerSymbol
                - bloomberg
                - cta
                - quick
                - wertpapier
                - dutch
                - valoren
                - sicovam
                - belgian
                - common
                - otherProprietaryIdentification
            name:
              type: string
              maxLength: 70
              description: Name of the financial instrument in free format text.
              example: N-Akt Thor Industries Inc USD 0.1 nom (977822)
        movementList:
          type: array
          description: >-
            List of movements belonging to a transaction from a banks
            perspective
          items:
            $ref: '#/components/schemas/movement'
        postingAmounts:
          type: array
          description: >-
            List of total amounts of money that is to be/was posted to
            respective accounts in the account currency.
          items:
            $ref: '#/components/schemas/postingAmount'
        foreignExchangeRates:
          type: array
          items:
            $ref: '#/components/schemas/foreignExchangeRate'
        settlementCurrency:
          $ref: '#/components/schemas/currency'
        prices:
          type: array
          items:
            type: object
            properties:
              amount:
                type: string
                pattern: '[0-9]{1,12}([.][0-9]{1,9})?'
                maxLength: 22
                example: '100.36'
                description: Price indication
              amountType:
                type: string
                description: Specifies the type of price
                example: percentage
                enum:
                  - perUnit
                  - percentage
              priceType:
                type: string
                description: Describes the type of price stated
                example: dealPrice
                enum:
                  - dealPrice
                  - costPrice
              currency:
                $ref: '#/components/schemas/currency'
        transactionAdditionalDetails:
          type: string
          maxLength: 70
          description: >-
            Provides additional details on the transaction which can not be
            included within the structured fields of the message.
          example: Replaces transaction nr. 12234567489
    movement:
      type: object
      description: >-
        Describes a single movement/booking/flow within a transaction. Every
        transaction contains in the minimum one movement.
      required:
        - amount
        - amountType
        - currency
        - movementType
      properties:
        amount:
          type: string
          pattern: '[0-9]{1,12}([.][0-9]{1,9})?'
          maxLength: 22
          example: '100000'
          description: Positive amount of the movement
        amountType:
          type: string
          description: Specifies the type of amount
          example: nominal
          enum:
            - unitsNumber
            - nominal
        creditDebitIndicator:
          type: string
          example: debit
          description: >-
            Specifies if the amount is a debit (negative) or credit (positive)
            amount.
          enum:
            - credit
            - debit
        currency:
          $ref: '#/components/schemas/currency'
        movementType:
          type: string
          description: >-
            Describes which kind of movement is reported from a banks
            perspective.
          example: security
          enum:
            - security
            - cash
            - revenue
            - stampDuty
            - withholdingTax
            - capitalGainTax
            - financialTransactionTax
            - otherTaxes
            - transactionFee
            - brokerageFee
            - managementFee
            - courtage
            - custodyFee
            - exchangeFee
            - thirdPartyFee
            - otherFee
            - others
        financialInstrument:
          type: object
          required:
            - identification
            - type
          properties:
            identification:
              type: string
              maxLength: 35
              example: US8851601018
              description: Identification of the instrument
            type:
              type: string
              example: isin
              description: Type of the instrument ID
              enum:
                - isin
                - sedol
                - cusip
                - ric
                - tickerSymbol
                - bloomberg
                - cta
                - quick
                - wertpapier
                - dutch
                - valoren
                - sicovam
                - belgian
                - common
                - otherProprietaryIdentification
            name:
              type: string
              maxLength: 70
              description: Name of the financial instrument in free format text.
              example: N-Akt Thor Industries Inc USD 0.1 nom (977822)
        positionIdentification:
          type: string
          maxLength: 35
          description: Identification for the position given by the bank.
          example: 1234566-12-1
        accountDetails:
          type: object
          description: Indicates the affected account of this movement
          properties:
            accountIdentification:
              type: string
              maxLength: 35
              example: 876543219
              description: Unique and unambiguous identification for the account
            accountIdentificationType:
              type: string
              description: >-
                Indicates the type of the account identification. IBAN is
                prefered.
              example: other
              enum:
                - iban
                - other
    postingAmount:
      type: object
      description: >-
        Total amount of money that is to be/was posted to the account in the
        account currency.
      properties:
        amount:
          type: string
          pattern: '[0-9]{1,12}([.][0-9]{1,9})?'
          maxLength: 22
          description: Absolute amount of the transaction
          example: '13023'
        currency:
          $ref: '#/components/schemas/currency'
        creditDebitIndicator:
          type: string
          example: debit
          description: >-
            Specifies if the amount is a debit (negative) or credit (positive)
            amount.
          enum:
            - credit
            - debit
        accountInformation:
          $ref: '#/components/schemas/accountInformation'
    healthCheckResponse:
      title: Health Check Response
      type: object
      properties:
        requestDateTime:
          title: Request Time
          type: string
          format: date-time
          example: '2018-04-13T11:11:11Z'
        receivedHeaders:
          title: Received Headers
          type: array
          items:
            type: object
            properties:
              headerName:
                type: string
                example: X-Correlation-ID
              headerValue:
                type: string
                description: As received
        receivedPayload:
          title: Received Payload
          type: string
          example: ... as received ...
    commonErrorResponse:
      title: Common Error Response
      type: object
      properties:
        type:
          $ref: '#/components/schemas/commonErrorType'
        title:
          type: string
          example: This is the general problem description
        detail:
          type: string
          example: >-
            Detailed problem description with respect to the current request,
            e.g., invalid account number format
        instance:
          type: string
          example: path/to/corresponding/resource
    commonErrorType:
      title: Common Error Type
      type: string
      description: >-
        Error Types for commonErrorResponse. See Appendix for detailed
        information.
      example: /problems/TECHNICAL_ERROR
      enum:
        - /problems/INVALID_PAYLOAD
        - /problems/MALFORMED_PAYLOAD
        - /problems/INVALID_TOKEN
        - /problems/EXPIRED_TOKEN
        - /problems/INSUFFICIENT_PRIVILEGES
        - /problems/NO_ACCESS_TO_RESOURCE
        - /problems/RESOURCE_DOES_NOT_EXIST
        - /problems/RESOURCE_NOT_READY
        - /problems/RESOURCE_TOO_LARGE
        - /problems/WRONG_METHOD
        - /problems/OPERATION_NOT_ALLOWED
        - /problems/TECHNICAL_ERROR
        - /problems/NOT_IMPLEMENTED
  responses:
    standard400:
      headers:
        Content-Type:
          $ref: '#/components/headers/Content-Type'
        Content-Language:
          $ref: '#/components/headers/Content-Language'
        WWW-Authenticate:
          $ref: '#/components/headers/WWW-Authenticate'
        X-Correlation-ID:
          $ref: '#/components/headers/X-Correlation-ID'
      description: Bad Request - The format of the request was invalid.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/commonErrorResponse'
    standard401:
      headers:
        Content-Type:
          $ref: '#/components/headers/Content-Type'
        Content-Language:
          $ref: '#/components/headers/Content-Language'
        WWW-Authenticate:
          $ref: '#/components/headers/WWW-Authenticate'
        X-Correlation-ID:
          $ref: '#/components/headers/X-Correlation-ID'
      description: >-
        Unauthorized - Either no token or an invalid (e.g., token expired) token
        was received.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/commonErrorResponse'
    standard403:
      headers:
        Content-Type:
          $ref: '#/components/headers/Content-Type'
        Content-Language:
          $ref: '#/components/headers/Content-Language'
        WWW-Authenticate:
          $ref: '#/components/headers/WWW-Authenticate'
        X-Correlation-ID:
          $ref: '#/components/headers/X-Correlation-ID'
      description: >-
        Forbidden - A valid OAuth Token was received, but access was denied.
        (Depending on the security requirements, providers can return 404
        instead)
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/commonErrorResponse'
    standard404:
      headers:
        Content-Type:
          $ref: '#/components/headers/Content-Type'
        Content-Language:
          $ref: '#/components/headers/Content-Language'
        X-Correlation-ID:
          $ref: '#/components/headers/X-Correlation-ID'
      description: >-
        Not Found - Either the endpoint does not exist or a requested resource
        is not yet available (e.g., account statements)
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/commonErrorResponse'
    standard405:
      headers:
        Content-Type:
          $ref: '#/components/headers/Content-Type'
        Content-Language:
          $ref: '#/components/headers/Content-Language'
        X-Correlation-ID:
          $ref: '#/components/headers/X-Correlation-ID'
      description: Method Not Allowed
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/commonErrorResponse'
    standard500:
      headers:
        Content-Type:
          $ref: '#/components/headers/Content-Type'
        Content-Language:
          $ref: '#/components/headers/Content-Language'
        X-Correlation-ID:
          $ref: '#/components/headers/X-Correlation-ID'
      description: Internal Server Error
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/commonErrorResponse'
    standard501:
      headers:
        Content-Type:
          $ref: '#/components/headers/Content-Type'
        Content-Language:
          $ref: '#/components/headers/Content-Language'
        X-Correlation-ID:
          $ref: '#/components/headers/X-Correlation-ID'
      description: Not Implemented
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/commonErrorResponse'
    standard503:
      headers:
        Content-Type:
          $ref: '#/components/headers/Content-Type'
        Content-Language:
          $ref: '#/components/headers/Content-Language'
        X-Correlation-ID:
          $ref: '#/components/headers/X-Correlation-ID'
      description: Service Unavailable
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/commonErrorResponse'
