swagger: '2.0'
info:
  version: Wealthica API 1.0 (20241121-1.2635)
  title: Wealthica API
  description: >
    A secure and simple way to access financial data and enable powerful
    financial apps.


    [Learn more about Wealthica API](https://wealthica.com/developers)


    The [Wealthica](https://wealthica.com) website is using this same API. One
    way to quickly get going with Wealthica API is looking at the calls made by
    our dashboard by inspecting the network calls (using Chrome Inspector for
    example).


    ### API Authentication


    Check `/auth/token` endpoint for how to get an API token.


    ### Read-only access sharing


    Users can give read-only access of their data to specific Wealthica users
    via the Sharings API. Wealthica uses the term __sharer__ for users who share
    read-only access of their data to other users, and __sharee__ for users who
    are given read-only access of other users.


    For sharees to request data of a sharer, aside from the API Authorization
    header, sharees will need to pass the sharer's user ID in a request header
    in the following format: `X-Wealthica-Effective-User: [sharer user id]`.
    When the header is present, API requests will be carried out on behalf of
    the sharer, instead of the user identified by the token.


    Currently `X-Wealthica-Effective-User` header is only supported in GET
    requests. The header is ignored in other types of request and special
    endpoints such as `/v1/login`.
  termsOfService: 'https://wealthica.com/terms/'
  contact:
    name: dev@wealthica.com
host: api.wealthica.com
schemes:
  - https
consumes:
  - application/json
produces:
  - application/json
paths:
  /auth/token:
    post:
      summary: Create authentication token
      description: >
        Returns an authentication token. The token is to be included in API
        request header for authentication purpose.
      tags:
        - Auth
      operationId: token
      parameters:
        - type: string
          name: loginName
          in: header
          required: true
          description: >-
            The user's unique identification from your system (could be the
            username, id, or email).
        - name: apiClientAndSecret
          in: body
          description: API client and secret
          required: true
          schema:
            type: object
            required:
              - clientId
              - secret
            properties:
              clientId:
                type: string
                description: API Client ID
              secret:
                type: string
                description: API Secret
      responses:
        '200':
          description: Success
          schema:
            type: object
            properties:
              token:
                type: string
                description: Token to be sent in header for request to Wealthica API
        '400':
          description: Missing required params
        '403':
          description: Team is deactivated
  /institutions:
    get:
      summary: Get user institutions
      description: >
        Returns the list of institutions (optionally at some specific date)
        belonging to the user that has authorized with the application.
      tags:
        - Institution
      operationId: getInstitutions
      parameters:
        - $ref: '#/parameters/date'
        - $ref: '#/parameters/deleted'
      responses:
        '200':
          description: Success
          schema:
            type: array
            items:
              $ref: '#/definitions/Institution'
    post:
      summary: Add user institution
      description: >
        Add a new user institution to the authorized user account. Each
        institution requires a different set of credentials. See the table below
        for the list of institutions Wealthica currently supports, and the
        corresponding attributes that are required for the credentials object.


        Note: Adding an institution will toggle an asynchronous first sync task.
        If the institution returns a login failed on the first sync, the
        institution will automatically be removed from the user's institutions
        list.
      tags:
        - Institution
      operationId: addInstitution
      parameters:
        - name: institution
          in: body
          description: The institution object that needs to be added.
          required: true
          schema:
            $ref: '#/definitions/NewInstitution'
      responses:
        '202':
          description: >
            The institution was succesfully added. An asynchronous first sync
            task has been scheduled. You can check for sync progress by doing
            repeated call to /insitutions/:id, or better, by calling the polling
            API at /institutions/:id/poll for changes.
          schema:
            $ref: '#/definitions/Institution'
        '400':
          description: Invalid parameters.
  '/institutions/{id}':
    get:
      summary: Get user institution by ID
      description: >
        Returns an institution that belongs to the authorized user, provided a
        valid ID.
      tags:
        - Institution
      operationId: getInstitutionById
      parameters:
        - $ref: '#/parameters/id'
      responses:
        '200':
          description: Success
          schema:
            $ref: '#/definitions/Institution'
        '400':
          description: Invalid ID supplied
        '404':
          description: Institution not found
    put:
      summary: Update an existing user institution
      description: >
        Update an existing user institution. If credentials are provided, a
        synchronization will be triggered.
      tags:
        - Institution
      operationId: updateInstitution
      parameters:
        - $ref: '#/parameters/id'
        - name: institution
          in: body
          description: The institution object for update.
          required: true
          schema:
            $ref: '#/definitions/UpdateInstitution'
      responses:
        '200':
          description: Successfully updated
          schema:
            $ref: '#/definitions/Institution'
        '202':
          description: >
            Successfully updated & scheduled for synchronization. Check for sync
            progress by calling the polling API at /institutions/:id/poll for
            changes.
          schema:
            $ref: '#/definitions/Institution'
        '400':
          description: Invalid ID supplied
        '404':
          description: Institution not found
        '409':
          description: >-
            The update would cause a sync to be scheduled but a sync is already
            in progress for this institution.
    delete:
      summary: Delete an existing user institution
      tags:
        - Institution
      operationId: deleteInstitution
      parameters:
        - $ref: '#/parameters/id'
      responses:
        '204':
          description: Success
  '/institutions/{id}/poll':
    get:
      summary: Poll institution for an update
      description: >
        Blocks (for max 30 seconds) listening for change to an institution, and
        returns the updated version if any.
      tags:
        - Institution
      operationId: pollInstitutionById
      parameters:
        - $ref: '#/parameters/id'
        - name: v
          in: query
          type: number
          description: >
            Base version number of the institution, which is usually the newest
            version number that the API client knows.


            If provided it will be used to compare with the latest version
            number on the server to determine if the institution has been
            updated (its investments are retrieved, positions are updated, or
            sync is finished).


            Defaults to the version number at the start of the poll.
      responses:
        '200':
          description: Success
          schema:
            $ref: '#/definitions/Institution'
        '304':
          description: The institution did not change during the poll.
        '400':
          description: Invalid ID supplied
        '404':
          description: Institution not found
        '503':
          description: >-
            The poll timed out and no v was specified, or an internal error
            occurred.
  '/institutions/{id}/sync':
    post:
      summary: Sync institution
      description: |
        Trigger synchronization for the institution.
      tags:
        - Institution
      operationId: syncInstitutionById
      parameters:
        - $ref: '#/parameters/id'
        - name: task
          in: body
          schema:
            properties:
              interactive:
                type: boolean
                description: |
                  Run sync task in interactive mode.
              force:
                type: boolean
                description: |
                  Run sync task with ignore-lock argument.
      responses:
        '202':
          description: >
            Success. The institution has been changed to `syncing` status and
            returned instantly while the synchronization is being processed.
          schema:
            $ref: '#/definitions/Institution'
        '400':
          description: >-
            Institution is either deleted or in error state (except
            SecurityQuestionError)
        '404':
          description: Institution not found
        '409':
          description: A sync is already in progress for this institution
  /assets:
    get:
      summary: Get assets
      description: >
        Returns the list of assets (optionally at some specific date) belonging
        to the user that has authorized with the application.
      tags:
        - Asset
      operationId: getAssets
      parameters:
        - $ref: '#/parameters/date'
        - $ref: '#/parameters/deleted'
      responses:
        '200':
          description: Success
          schema:
            type: array
            items:
              $ref: '#/definitions/Asset'
    post:
      summary: Add asset
      description: Add a new asset to the authorized user account.
      tags:
        - Asset
      operationId: addAsset
      parameters:
        - name: asset
          in: body
          description: The asset object that needs to be added.
          required: true
          schema:
            $ref: '#/definitions/NewAsset'
      responses:
        '200':
          description: Success
          schema:
            $ref: '#/definitions/Asset'
  '/assets/{id}':
    get:
      summary: Get asset by ID
      description: >
        Returns an asset that belongs to the authorized user, provided a valid
        ID.
      tags:
        - Asset
      operationId: getAssetById
      parameters:
        - $ref: '#/parameters/id'
      responses:
        '200':
          description: Success
          schema:
            $ref: '#/definitions/Asset'
        '400':
          description: Invalid ID supplied
        '404':
          description: Asset not found
    put:
      summary: Update an existing asset
      tags:
        - Asset
      operationId: updateAsset
      parameters:
        - $ref: '#/parameters/id'
        - name: asset
          in: body
          description: The asset object for update.
          required: true
          schema:
            $ref: '#/definitions/UpdateAsset'
      responses:
        '200':
          description: Success
          schema:
            $ref: '#/definitions/Asset'
        '400':
          description: Invalid ID supplied
        '404':
          description: Asset not found
    delete:
      summary: Delete an existing asset
      tags:
        - Asset
      operationId: deleteAsset
      parameters:
        - $ref: '#/parameters/id'
      responses:
        '204':
          description: Success
        '400':
          description: Invalid ID supplied
        '404':
          description: Asset not found
  /asset-notes:
    get:
      summary: Get asset notes for assets or liabilities
      description: Retrieve a list of asset notes filtered by asset or liability.
      tags:
        - AssetNote
      parameters:
        - name: asset
          in: query
          description: ID of the asset
          required: false
          type: string
        - name: liability
          in: query
          description: ID of the liability
          required: false
          type: string
      responses:
        '200':
          description: A list of asset notes
          schema:
            type: array
            items:
              $ref: '#/definitions/AssetNote'
        '400':
          description: One of asset or liability is required
        '403':
          description: Asset or liability not found or does not belong to your user
        '500':
          description: Error fetching asset notes
    post:
      summary: Create a new note for asset or liability
      description: Create a new asset asset note with the provided data.
      tags:
        - AssetNote
      parameters:
        - in: body
          name: note
          description: New asset note object
          required: true
          schema:
            $ref: '#/definitions/NewAssetNote'
      responses:
        '201':
          description: Asset note created successfully
          schema:
            $ref: '#/definitions/AssetNote'
        '400':
          description: Error creating asset note
        '403':
          description: Asset or liability not found or does not belong to your user
  '/asset-notes/{id}':
    get:
      summary: Get asset note for asset or liability
      description: Retrieve asset note by its ID.
      tags:
        - AssetNote
      parameters:
        - name: id
          in: path
          required: true
          type: string
          description: Asset Note ID
      responses:
        '200':
          description: A single note
          schema:
            $ref: '#/definitions/AssetNote'
        '404':
          description: Asset note not found or does not belong to your user
        '500':
          description: Error fetching asset note
    put:
      summary: Update asset note for asset or liability
      description: Update an existing asset note by its ID.
      tags:
        - AssetNote
      parameters:
        - name: id
          in: path
          required: true
          type: string
          description: Asset note ID
        - in: body
          name: note
          description: Updated asset note object
          required: true
          schema:
            $ref: '#/definitions/UpdateAssetNote'
      responses:
        '200':
          description: Asset note updated successfully
          schema:
            $ref: '#/definitions/AssetNote'
        '400':
          description: Error updating asset note
        '404':
          description: Asset note not found or does not belong to your user
    delete:
      summary: Delete asset note
      description: Delete asset note by its ID.
      tags:
        - AssetNote
      parameters:
        - name: id
          in: path
          required: true
          type: string
          description: Asset note ID
      responses:
        '200':
          description: Asset note deleted successfully
        '404':
          description: Asset note not found or does not belong to your user
        '500':
          description: Error deleting asset note
  /asset-notes/tags:
    get:
      summary: Get all tags for the user's asset notes
      description: Retrieve a list of all unique tags used in the user's asset notes.
      tags:
        - AssetNote
      responses:
        '200':
          description: A list of tags
          schema:
            type: array
            items:
              type: string
        '500':
          description: Error fetching tags
  /liabilities:
    get:
      summary: Get liabilities
      description: >
        Returns the list of liabilities (optionally at some specific date)
        belonging to the user that has authorized with the application.
      tags:
        - Liability
      operationId: getLiabilities
      parameters:
        - $ref: '#/parameters/date'
        - $ref: '#/parameters/deleted'
      responses:
        '200':
          description: Success
          schema:
            type: array
            items:
              $ref: '#/definitions/Liability'
    post:
      summary: Add liability
      description: Add a new liability to the authorized user account.
      tags:
        - Liability
      operationId: addLiability
      parameters:
        - name: liability
          in: body
          description: The liability object that needs to be added.
          required: true
          schema:
            $ref: '#/definitions/NewLiability'
      responses:
        '200':
          description: Success
          schema:
            $ref: '#/definitions/Liability'
  '/liabilities/{id}':
    get:
      summary: Get liability by ID
      description: >
        Returns a liability that belongs to the authorized user, provided a
        valid ID.
      tags:
        - Liability
      operationId: getLiabilityById
      parameters:
        - $ref: '#/parameters/id'
      responses:
        '200':
          description: Success
          schema:
            $ref: '#/definitions/Liability'
        '400':
          description: Invalid ID supplied
        '404':
          description: Liability not found
    put:
      summary: Update an existing liability
      tags:
        - Liability
      operationId: updateLiability
      parameters:
        - $ref: '#/parameters/id'
        - name: liability
          in: body
          description: The liability object for update.
          required: true
          schema:
            $ref: '#/definitions/UpdateLiability'
      responses:
        '200':
          description: Success
          schema:
            $ref: '#/definitions/Liability'
        '400':
          description: Invalid ID supplied
        '404':
          description: Liability not found
    delete:
      summary: Delete an existing liability
      tags:
        - Liability
      operationId: deleteLiability
      parameters:
        - $ref: '#/parameters/id'
      responses:
        '204':
          description: Success
        '400':
          description: Invalid ID supplied
        '404':
          description: Liability not found
  /categories:
    get:
      summary: Get categories
      description: |
        Returns the list of user asset, position and transaction categories.
      tags:
        - Category
      operationId: getCategories
      responses:
        '200':
          description: Success
          schema:
            $ref: '#/definitions/Category'
  /currencies:
    get:
      summary: Get currencies
      description: |
        Returns the list of currencies that Wealthica supports.
      tags:
        - Currency
      operationId: getCurrencies
      responses:
        '200':
          description: Success
          schema:
            type: array
            items:
              $ref: '#/definitions/Currency'
  '/currencies/{id}/history':
    get:
      summary: Get currency history
      description: >
        Returns a currency's exchange rate history against another base
        currency.


        If no base currency is provided, redirects to the same endpoint with the
        `base` parameter set to the authenticated user's preferred currency. For
        unauthenticated user, `base` will be set to 'cad'.
      tags:
        - Currency
      operationId: getCurrencyHistory
      parameters:
        - $ref: '#/parameters/id'
        - $ref: '#/parameters/from'
        - $ref: '#/parameters/to'
        - name: base
          in: query
          type: string
          enum:
            - aud
            - bbd
            - brl
            - btc
            - cad
            - chf
            - cny
            - dkk
            - eth
            - eur
            - gbp
            - hkd
            - huf
            - ils
            - inr
            - jpy
            - krw
            - mxn
            - nok
            - nzd
            - ron
            - pln
            - aed
            - sek
            - sgd
            - thb
            - twd
            - usd
            - vnd
            - zar
          description: Base currency id to retrieve exchange rate history against.
      responses:
        '200':
          description: Success
          schema:
            $ref: '#/definitions/TimeSerie'
        '400':
          description: Invalid ID supplied
        '404':
          description: Currency not found
  /documents:
    get:
      summary: Get documents
      description: >
        Returns the list of documents belonging to the user that has authorized
        with the application.
      tags:
        - Document
      operationId: getDocuments
      responses:
        '200':
          description: Success
          schema:
            type: array
            items:
              $ref: '#/definitions/Document'
    post:
      summary: Add document
      description: Add a new document to the authorized user account.
      tags:
        - Document
      operationId: addDocument
      parameters:
        - name: document
          in: body
          description: The document object that needs to be added.
          required: true
          schema:
            $ref: '#/definitions/NewDocument'
      responses:
        '200':
          description: Success
          schema:
            $ref: '#/definitions/Document'
  '/documents/{id}':
    get:
      summary: Get document by ID
      description: >
        Returns a document that belongs to the authorized user, provided a valid
        ID. The returned data also includes the document's download URL.
      tags:
        - Document
      operationId: getDocumentById
      parameters:
        - $ref: '#/parameters/id'
      responses:
        '200':
          description: Success
          schema:
            $ref: '#/definitions/Document'
        '400':
          description: Invalid ID supplied
        '404':
          description: Document not found
    put:
      summary: Update an existing document
      tags:
        - Document
      operationId: updateDocument
      parameters:
        - $ref: '#/parameters/id'
        - name: document
          in: body
          description: The document object for update.
          required: true
          schema:
            $ref: '#/definitions/UpdateDocument'
      responses:
        '200':
          description: Success
          schema:
            $ref: '#/definitions/Document'
        '400':
          description: Invalid ID supplied
        '404':
          description: Document not found
    delete:
      summary: Delete an existing document
      tags:
        - Document
      operationId: deleteDocument
      parameters:
        - $ref: '#/parameters/id'
      responses:
        '204':
          description: Success
        '400':
          description: Invalid ID supplied
        '404':
          description: Document not found
  /enums/transaction-types:
    get:
      summary: Get transaction types
      description: >
        Returns the list of transaction types that Wealthica supports. This list
        is subject to change as we might add more transaction types.
      tags:
        - Enums
      operationId: getTransactionTypes
      responses:
        '200':
          description: Success
          schema:
            type: array
            items:
              type: string
  /history:
    get:
      summary: Get history entries
      description: >
        Returns the daily history entries for investments, assets and
        liabilities in a specific period of time for the authenticated user.
      tags:
        - History
      operationId: getHistoryEntries
      parameters:
        - $ref: '#/parameters/from'
        - $ref: '#/parameters/to'
        - $ref: '#/parameters/groupIds'
        - $ref: '#/parameters/institutionIds'
        - $ref: '#/parameters/investmentIds'
        - $ref: '#/parameters/includeAssets'
        - $ref: '#/parameters/includeLiabilities'
        - $ref: '#/parameters/banking'
      responses:
        '200':
          description: Success
          schema:
            type: array
            items:
              $ref: '#/definitions/HistoryEntry'
    post:
      summary: Add history entry
      description: |
        Add a new history entry to the authenticated user account.
      tags:
        - History
      operationId: addHistoryEntry
      parameters:
        - name: historyEntry
          in: body
          description: The history entry object that needs to be added.
          required: true
          schema:
            $ref: '#/definitions/NewHistoryEntry'
      responses:
        '200':
          description: Success
          schema:
            $ref: '#/definitions/HistoryEntry'
        '400':
          description: Validation failed
          schema:
            $ref: '#/definitions/ErrorResponse'
        '409':
          description: >-
            A history entry with matching date and investment/asset/liability
            already exists.
          schema:
            $ref: '#/definitions/ErrorResponse'
  '/history/{id}':
    get:
      summary: Get history entry by ID
      description: >
        Returns a history entry that belongs to the authorized user, provided a
        valid ID.
      tags:
        - History
      operationId: getHistoryEntryById
      parameters:
        - $ref: '#/parameters/id'
      responses:
        '200':
          description: Success
          schema:
            $ref: '#/definitions/HistoryEntry'
        '400':
          description: Invalid ID supplied
        '404':
          description: History entry not found
    put:
      summary: Update an existing history entry value
      tags:
        - History
      operationId: updateHistoryEntry
      parameters:
        - $ref: '#/parameters/id'
        - name: historyEntry
          in: body
          description: The history entry object for update.
          required: true
          schema:
            $ref: '#/definitions/UpdateHistoryEntry'
      responses:
        '200':
          description: Success
          schema:
            $ref: '#/definitions/HistoryEntry'
        '400':
          description: Invalid ID supplied or validation failed
        '404':
          description: History entry not found
    delete:
      summary: Delete an existing history entry
      tags:
        - History
      operationId: deleteHistoryEntry
      parameters:
        - $ref: '#/parameters/id'
      responses:
        '204':
          description: Success
        '400':
          description: Invalid ID supplied
        '404':
          description: History entry not found
  /portfolio:
    get:
      deprecated: true
      summary: (Experimental) Get user portfolio
      description: >
        Returns the portfolio snapshot of the authenticated user for a specific
        time period.


        This is an experimental API that is still being developed and should not
        be used in production.
      tags:
        - Portfolio
      operationId: getPortfolio
      parameters:
        - $ref: '#/parameters/from'
        - $ref: '#/parameters/to'
        - $ref: '#/parameters/groupIds'
        - $ref: '#/parameters/institutionIds'
        - $ref: '#/parameters/includeAssets'
        - $ref: '#/parameters/includeLiabilities'
        - $ref: '#/parameters/banking'
      responses:
        '200':
          description: Success
          schema:
            $ref: '#/definitions/Portfolio'
        '400':
          description: Invalid `from` date or `to` date
  /positions:
    get:
      summary: Get positions
      description: >
        Returns an aggregated list of currently owned positions for the
        authenticated user.
      tags:
        - Position
      operationId: getPositions
      parameters:
        - $ref: '#/parameters/groupIds'
        - $ref: '#/parameters/institutionIds'
        - $ref: '#/parameters/investmentIds'
        - $ref: '#/parameters/includeAssets'
        - $ref: '#/parameters/includeLiabilities'
        - $ref: '#/parameters/banking'
      responses:
        '200':
          description: Success
          schema:
            type: array
            items:
              $ref: '#/definitions/Position'
  '/positions/{id}':
    put:
      summary: Update an existing position
      tags:
        - Position
      operationId: updatePosition
      parameters:
        - $ref: '#/parameters/id'
        - name: position
          in: body
          description: The position object for update.
          required: true
          schema:
            $ref: '#/definitions/UpdatePosition'
      responses:
        '200':
          description: Success
          schema:
            $ref: '#/definitions/Position'
        '400':
          description: Invalid ID supplied or validation failed
        '404':
          description: Position not found
  /performance:
    get:
      deprecated: true
      summary: Get user performance
      description: >
        [Work in progress] Returns the performance snapshot of the authenticated
        user for a specific time period.

        This API is not finalized and is expected to change in the future.
      tags:
        - Performance
      operationId: getPerformance
      parameters:
        - $ref: '#/parameters/from'
        - $ref: '#/parameters/to'
        - $ref: '#/parameters/groupIds'
        - $ref: '#/parameters/institutionIds'
        - $ref: '#/parameters/includeAssets'
        - $ref: '#/parameters/includeLiabilities'
        - $ref: '#/parameters/banking'
      responses:
        '200':
          description: Success
          schema:
            $ref: '#/definitions/Performance'
        '400':
          description: Invalid from date or to date
  /sharings:
    get:
      summary: Get sharings
      description: |
        Returns the list of sharings.
      tags:
        - Sharing
      operationId: getSharings
      responses:
        '200':
          description: Success
          schema:
            type: array
            items:
              $ref: '#/definitions/Sharing'
    post:
      summary: Add sharing
      description: Add a new sharing object. Only sharer can do this.
      tags:
        - Sharing
      operationId: addSharing
      parameters:
        - name: sharing
          in: body
          required: true
          description: The sharing object to be added. Only sharee ID is required/accepted
          schema:
            type: object
            properties:
              sharee:
                description: The sharee user ID
                type: string
                pattern: '^[a-f0-9]{24}$'
                example: 5742b1f7535cf2baba8fff91
      responses:
        '200':
          description: Success
          schema:
            $ref: '#/definitions/Sharing'
        '400':
          description: Sharee invalid or not found
        '404':
          description: Sharing not found
        '409':
          description: Sharing already exists
  '/sharings/{id}':
    delete:
      summary: Delete an existing sharing
      tags:
        - Sharing
      operationId: deleteSharing
      parameters:
        - $ref: '#/parameters/id'
      responses:
        '204':
          description: Success
        '400':
          description: Invalid ID supplied
        '403':
          description: Not a sharer/sharee
        '404':
          description: Sharing not found
  /providers:
    get:
      summary: Get providers
      description: >
        Returns list all supported providers (endpoint is not finalized and will
        be updated soon).
      tags:
        - Provider
      operationId: getProviders
      parameters:
        - name: unpublished
          in: query
          type: boolean
          description: |
            not passed - all providers are displayed;
            true - only unpublished providers are displayed;
            false - unpublished providers are hidden.
        - name: group
          in: query
          type: string
          enum:
            - core
            - vezgo
            - yodlee
          description: |
            Allows to filter by providers class.
        - name: class
          in: query
          type: string
          enum:
            - api
            - oauth
            - scraper
          description: |
            Allows to filter by providers class.
        - name: format
          in: query
          type: string
          enum:
            - array
            - object
          description: >
            Select which format to return.

            NOTE due to legacy reasons, this defaults to "object" when no
            parameter is provided (`GET /providers`).

            However the default is planned to be changed to "array". New API
            clients are advised to always explicitly pass `format=array`.
      responses:
        '200':
          description: Success
          schema:
            type: array
            items:
              $ref: '#/definitions/Provider'
  /transactions:
    get:
      summary: Get transactions
      description: >
        Returns the list of transactions in a specific period of time that
        belongs to the user that has authorized with the application.
      tags:
        - Transaction
      operationId: getTransactions
      parameters:
        - $ref: '#/parameters/from'
        - $ref: '#/parameters/to'
        - $ref: '#/parameters/groupIds'
        - $ref: '#/parameters/institutionIds'
        - $ref: '#/parameters/investmentIds'
        - $ref: '#/parameters/includeAssets'
        - $ref: '#/parameters/includeLiabilities'
        - $ref: '#/parameters/banking'
        - $ref: '#/parameters/transactionTypes'
        - $ref: '#/parameters/deleted'
        - $ref: '#/parameters/invalid'
        - $ref: '#/parameters/new'
        - $ref: '#/parameters/peek'
        - $ref: '#/parameters/missing'
        - name: last
          in: query
          type: string
          required: false
          pattern: '^[a-f0-9]{24}$'
          description: >
            The ID for a last-known transaction. When this is passed in, only
            transactions newer than (added to Wealthica after) this one will be
            returned. If an empty value is passed in, the first transactions
            ever added to Wealthica will be returned.


            Will trigger pagination mode, which returns transactions ordered
            ascendingly by the date on which they're added to Wealthica, instead
            of by the trade date.
        - name: limit
          in: query
          type: integer
          required: false
          minimum: 1
          maximum: 1000
          description: >
            The number of transactions to return.


            Will trigger pagination mode. In pagination mode, by default a
            maximum of 100 transactions are returned if limit is not provided.
        - name: sort
          in: query
          type: string
          required: false
          enum:
            - asc
            - desc
          description: >
            Sort transactions direction. ASC is default direction. Sorted by
            "date" by default and by "_id" in pagination mode if "limit" or
            "last" param passed.
        - name: security
          in: query
          type: boolean
          required: false
          description: >
            If true, return transactions that have either security or symbol
            set. Transactions with symbol but no security are also returned
            since they are deemed to have a security assigned even though the
            security is unknown.


            If false, return transactions that have neither security or symbol
            set.
        - name: skip_date_filter
          in: query
          type: boolean
          required: false
          description: >
            If true, skip date filter params "from" and "to" if it's set,
            otherwise, do not use default date filtering. Besides pagination
            mode forcibly enabled.
        - name: skip_reset_new_transactions
          in: query
          type: boolean
          required: false
          description: |
            If true, do not reset "new" flag for transactions.
        - name: sort_field
          in: query
          type: string
          required: false
          enum:
            - date
          description: |
            Allows to sort by date in pagination mode.
      responses:
        '200':
          description: Success
          schema:
            type: array
            items:
              $ref: '#/definitions/Transaction'
    post:
      summary: Add transaction
      description: |
        Add a new transaction to the authorized user account.
      tags:
        - Transaction
      operationId: addTransaction
      parameters:
        - name: transaction
          in: body
          description: The transaction object that needs to be added.
          required: true
          schema:
            $ref: '#/definitions/NewTransaction'
      responses:
        '200':
          description: Success
          schema:
            $ref: '#/definitions/Transaction'
        '400':
          description: Validation failed
          schema:
            $ref: '#/definitions/ErrorResponse'
  '/transactions/{id}':
    get:
      summary: Get transaction by ID
      description: >
        Returns a transaction that belongs to the authorized user, provided a
        valid ID.
      tags:
        - Transaction
      operationId: getTransactionById
      parameters:
        - $ref: '#/parameters/id'
      responses:
        '200':
          description: Success
          schema:
            $ref: '#/definitions/Transaction'
        '400':
          description: Invalid ID supplied
        '404':
          description: Transaction not found
    put:
      summary: Update an existing transaction
      tags:
        - Transaction
      operationId: updateTransaction
      parameters:
        - $ref: '#/parameters/id'
        - name: transaction
          in: body
          description: The transaction object for update.
          required: true
          schema:
            $ref: '#/definitions/UpdateTransaction'
      responses:
        '200':
          description: Success
          schema:
            $ref: '#/definitions/Transaction'
        '400':
          description: Invalid ID supplied or validation failed
        '404':
          description: Transaction not found
  /preferences:
    put:
      summary: Update user preferences
      description: |
        This endpoint is used to update user preferences.
      tags:
        - Preferences
      operationId: updatePreferences
      parameters:
        - name: preferences
          in: body
          description: >
            The preferences object for update. Attributes not present in this
            object will not be updated.
          required: true
          schema:
            $ref: '#/definitions/Preferences'
      responses:
        '200':
          description: Success
          schema:
            $ref: '#/definitions/Preferences'
parameters:
  id:
    name: id
    in: path
    type: string
    pattern: '^[a-f0-9]{24}$'
    required: true
    description: ID of the item that needs to be fetched/updated/deleted.
  institutionIds:
    name: institutions
    in: query
    type: array
    collectionFormat: csv
    description: >
      A list of IDs for the institutions to be used to filter the query.

      If provided, institutions that aren't specified will not be included in
      the snapshot.

      Defaults to include all if both `assets` and `liabilities` are not
      provided.

      Defaults to exclude all if either `assets` or `liabilities` is provided.
    items:
      type: string
      pattern: '^[a-f0-9]{24}$'
  groupIds:
    name: groups
    in: query
    type: array
    collectionFormat: csv
    description: >
      A list of IDs for the groups to be used to filter the query.

      If provided, groups that aren't specified will not be included in the
      snapshot.

      The ID that represents 'no group' is '000000000000000000000000' (24
      zeros). If this ID is provided, the API will return resources that belong
      to no group.
    items:
      type: string
      pattern: '^[a-f0-9]{24}$'
  investmentIds:
    name: investments
    in: query
    type: array
    collectionFormat: csv
    description: >
      A list of IDs for the investment accounts to be used to filter the query.

      If provided, investment accounts that aren't specified will not be
      included in the snapshot.
    items:
      type: string
  includeAssets:
    name: assets
    in: query
    type: boolean
    required: false
    description: >
      Whether or not to include assets in the response.

      Defaults to include assets if both `institutions` and `liabilities` are
      not provided.

      Defaults to exclude assets if either `institutions` or `liabilities` is
      provided.
  includeLiabilities:
    name: liabilities
    in: query
    type: boolean
    required: false
    description: >
      Whether or not to include liabilities in the response.

      Defaults to include liabilities if both `institutions` and `assets` are
      not provided.

      Defaults to exclude liabilities if either `institutions` or `assets` is
      provided.
  banking:
    name: banking
    in: query
    type: boolean
    required: false
    description: |
      Whether or not to return only banking items in the response.
      `true` means to return only banking items.
      `false` (default) means to return all items.
  from:
    name: from
    in: query
    type: string
    format: date
    required: false
    description: >
      The start date of the period to perform the query. This cannot be a date
      after `to` date. Defaults to start of the current year.
  to:
    name: to
    in: query
    type: string
    format: date
    required: false
    description: >
      The end date of the period to perform the query. This cannot be a date
      before `from` date. Defaults to today.
  date:
    name: date
    in: query
    description: The date at which to capture the data.
    required: false
    type: string
    format: date
  transactionTypes:
    name: types
    in: query
    type: array
    collectionFormat: csv
    description: >
      A list of transaction types to be used to filter the query. If provided,
      transactions that aren't specified will not be included in the response.
      This list may be modified in the future as we consider the inclusion of
      more transaction types.
    items:
      type: string
      enum:
        - deposit
        - withdrawal
        - transfer
        - transfer_in
        - transfer_out
        - switch
        - interest
        - dividend
        - distribution
        - roc
        - reinvest
        - drip
        - tax
        - fee
        - sell
        - buy
        - income
        - split
        - mtm
        - loan
        - recall
        - name_change
        - spinoff
        - merger
        - unknown
  deleted:
    name: deleted
    in: query
    type: boolean
    required: false
    description: |
      Whether or not to return deleted items.
      `true` means to return only deleted items.
      `false` means to return all except deleted items.
      Defaults to return both deleted and non-deleted items.
  invalid:
    name: invalid
    in: query
    type: boolean
    required: false
    description: |
      Whether or not to return invalid/unknown/incomplete items.
      `true` means to return only invalid/unknown/incomplete items.
      `false` means to return all except invalid/unknown/incomplete items.
      Defaults to return both invalid/unknown/incomplete and valid items.
  peek:
    name: peek
    in: query
    type: boolean
    required: false
    description: |
      Whether or not to reset the `new` flag for items.
      `true` means to leave `new` flags untouched.
      `false` means to clear the `new` flag (mark as viewed) for returned items.
      Defaults to false.
  new:
    name: new
    in: query
    type: boolean
    required: false
    description: |
      Whether or not to return new items.
      `true` means to return only new items.
      `false` means to return all except new items.
      Defaults to return both new and non-new items.
  missing:
    name: missing
    in: query
    type: boolean
    required: false
    description: |
      Whether or not to include missing items.
      `true` means to incluse missing items.
      `false` means to exclude missing items.
      Defaults to false.
definitions:
  Asset:
    type: object
    required:
      - _id
      - name
      - type
      - currency
      - value
      - book_value
      - market_value
      - gain_amount
      - gain_currency_amount
      - gain_percent
      - creation_date
    properties:
      _id:
        type: string
        pattern: '^[a-f0-9]{24}$'
        example: 5742b1f7535cf2baba8fff91
        description: ID of the item within the Wealthica system.
      name:
        type: string
        example: Home
        description: Name of the asset.
      class:
        type: string
        enum:
          - equity
          - fixed_income
          - cash_equivalent
          - tangible_asset
          - private_equity
          - preferred_shares
          - crypto
          - other
        description: The asset class.
      classes:
        type: array
        description: The asset classes.
        items:
          type: object
          properties:
            class:
              type: string
              enum:
                - equity
                - fixed_income
                - cash_equivalent
                - tangible_asset
                - private_equity
                - preferred_shares
                - crypto
                - other
              description: The asset class.
            weight:
              type: number
              minimum: 0
              maximum: 1
      category:
        type: string
        description: The asset category.
      categories:
        type: array
        description: The asset categories.
        items:
          type: object
          properties:
            category:
              type: string
              description: The asset category.
            weight:
              type: number
              minimum: 0
              maximum: 1
      type:
        type: string
        description: Type of the asset.
        enum:
          - primary_residence
          - secondary_residence
          - income_property
          - investment_property
          - land
          - other_real_estate
          - private_equity
          - private_fund
          - vc_fund
          - private_loan
          - insurance
          - other_investment
          - other_asset
      currency:
        type: string
        enum:
          - aud
          - bbd
          - brl
          - btc
          - cad
          - chf
          - cny
          - dkk
          - eth
          - eur
          - gbp
          - hkd
          - huf
          - ils
          - inr
          - jpy
          - krw
          - mxn
          - nok
          - nzd
          - ron
          - pln
          - aed
          - sek
          - sgd
          - thb
          - twd
          - usd
          - vnd
          - zar
        description: The asset currency.
      groups:
        type: array
        items:
          type: string
          pattern: '^[a-f0-9]{24}$'
        example:
          - 5742b1f7535cf2baba8fff91
        description: List of group IDs the item belongs to.
      group:
        type: string
        pattern: '^[a-f0-9]{24}$'
        example: 5742b1f7535cf2baba8fff91
        description: '[Deprecated] ID of the group the item belongs to. Use groups instead.'
      banking:
        type: boolean
        description: |
          Whether or not the item is included in Banking view.
      image:
        type: string
        format: data URI
        maxLength: 102400
        description: >
          The item's image, in base64-encoded data URI. In an UPDATE request,
          sending a `null` value for `image` will remove the image.
      value:
        type: number
        description: 'The market value, converted to user preferred currency.'
      book_value:
        type: number
        minimum: 0
        description: 'The book value of the asset, in asset currency.'
      market_value:
        type: number
        minimum: 0
        description: 'The market value of the asset, in asset currency.'
      gain_amount:
        type: number
        description: >
          Gain value of the asset as of the specified date, converted to user
          preferred currency.
      gain_currency_amount:
        type: number
        description: |
          Gain value of the asset as of the specified date, in asset currency.
      gain_percent:
        type: number
        description: The asset's ROI.
      creation_date:
        type: string
        format: date-time
      deleted:
        type: boolean
        description: >
          Whether or not the item is marked as deleted. Deleted items are not
          taken into account in calculations.
  NewAsset:
    type: object
    required:
      - name
      - type
      - book_value
      - currency
    properties:
      name:
        type: string
        example: Home
        description: Name of the asset.
      category:
        type: string
        description: The asset category.
      type:
        type: string
        description: Type of the asset.
        enum:
          - primary_residence
          - secondary_residence
          - income_property
          - investment_property
          - land
          - other_real_estate
          - private_equity
          - private_fund
          - vc_fund
          - private_loan
          - insurance
          - other_investment
          - other_asset
      currency:
        type: string
        enum:
          - aud
          - bbd
          - brl
          - btc
          - cad
          - chf
          - cny
          - dkk
          - eth
          - eur
          - gbp
          - hkd
          - huf
          - ils
          - inr
          - jpy
          - krw
          - mxn
          - nok
          - nzd
          - ron
          - pln
          - aed
          - sek
          - sgd
          - thb
          - twd
          - usd
          - vnd
          - zar
        description: The asset currency.
      book_value:
        type: number
        minimum: 0
        description: 'The book value of the asset, in asset currency.'
      market_value:
        type: number
        minimum: 0
        description: 'The market value of the asset, in asset currency.'
  UpdateAsset:
    type: object
    properties:
      name:
        type: string
        example: Home
        description: Name of the asset.
      class:
        type: string
        enum:
          - equity
          - fixed_income
          - cash_equivalent
          - tangible_asset
          - private_equity
          - preferred_shares
          - crypto
          - other
        description: The asset class.
      classes:
        type: array
        description: The asset classes.
        items:
          type: object
          properties:
            class:
              type: string
              enum:
                - equity
                - fixed_income
                - cash_equivalent
                - tangible_asset
                - private_equity
                - preferred_shares
                - crypto
                - other
              description: The asset class.
            weight:
              type: number
              minimum: 0
              maximum: 1
      category:
        type: string
        description: The asset category.
      categories:
        type: array
        description: The asset categories.
        items:
          type: object
          properties:
            category:
              type: string
              description: The asset category.
            weight:
              type: number
              minimum: 0
              maximum: 1
      type:
        type: string
        description: Type of the asset.
        enum:
          - primary_residence
          - secondary_residence
          - income_property
          - investment_property
          - land
          - other_real_estate
          - private_equity
          - private_fund
          - vc_fund
          - private_loan
          - insurance
          - other_investment
          - other_asset
      groups:
        type: array
        items:
          type: string
          pattern: '^[a-f0-9]{24}$'
        example:
          - 5742b1f7535cf2baba8fff91
        description: >
          List of group IDs or name of the groups the item belongs to.

          If the list contains a new group name, the group will be automatically
          created and the ID correctly assigned to the item.

          Sending a `null` value will disassociate the item from any groups.
      group:
        type: string
        example: 5742b1f7535cf2baba8fff91
        description: >
          [Deprecated] ID or name of the group the item belongs to.

          If this is a new group name, the group will be automatically created
          and the ID correctly assigned to the item.

          Sending a `null` value will remove the association with the current
          group.

          Use groups instead.
      image:
        type: string
        format: data URI
        maxLength: 102400
        description: >
          The item's image, in base64-encoded data URI. In an UPDATE request,
          sending a `null` value for `image` will remove the image.
      book_value:
        type: number
        minimum: 0
        description: 'The book value of the asset, in asset currency.'
      market_value:
        type: number
        minimum: 0
        description: 'The market value of the asset, in asset currency.'
      deleted:
        type: boolean
        description: >
          Whether or not the item is marked as deleted. Deleted items are not
          taken into account in calculations.
  AssetNote:
    type: object
    properties:
      _id:
        type: string
        description: Unique identifier for the asset note
      user:
        type: string
        description: ID of the user who owns the asset note
      asset:
        type: string
        description: ID of the asset associated with the note
      liability:
        type: string
        description: ID of the liability associated with the asset note
      title:
        type: string
        description: Title of the asset note
      date:
        type: string
        format: date-time
        description: Date of the asset note
      content:
        type: string
        description: Content of the asset note
      tags:
        type: array
        items:
          type: string
        description: Tags associated with the asset note
  NewAssetNote:
    type: object
    required:
      - title
      - date
      - content
    properties:
      user:
        type: string
        description: ID of the user who owns the asset note
      asset:
        type: string
        description: ID of the asset associated with the asset note
      liability:
        type: string
        description: ID of the liability associated with the asset note
      title:
        type: string
        description: Title of the asset note
      date:
        type: string
        format: date-time
        description: Date of the asset note
      content:
        type: string
        description: Content of the asset note
      tags:
        type: array
        items:
          type: string
        description: Tags associated with the asset note
  UpdateAssetNote:
    type: object
    properties:
      title:
        type: string
        description: Title of the asset note
      date:
        type: string
        format: date-time
        description: Date of the asset note
      content:
        type: string
        description: Content of the asset note
      tags:
        type: array
        items:
          type: string
        description: Tags associated with the asset note
  Category:
    type: object
    required:
      - assets
      - positions
      - transactions
    properties:
      assets:
        type: array
        items:
          type: string
        description: List of user asset categories.
      positions:
        type: array
        items:
          type: string
        description: List of user position categories.
      transactions:
        type: array
        items:
          type: string
        description: List of user transaction categories.
  Currency:
    type: object
    required:
      - _id
      - name
      - sign
      - exchange_rate
      - update_date
    properties:
      _id:
        type: string
        enum:
          - aud
          - bbd
          - brl
          - btc
          - cad
          - chf
          - cny
          - dkk
          - eth
          - eur
          - gbp
          - hkd
          - huf
          - ils
          - inr
          - jpy
          - krw
          - mxn
          - nok
          - nzd
          - ron
          - pln
          - aed
          - sek
          - sgd
          - thb
          - twd
          - usd
          - vnd
          - zar
        description: The currency ID.
      name:
        type: string
        example: Canadian Dollar
        description: The currency name.
      sign:
        type: string
        example: $
        description: The currency sign.
      exchange_rate:
        type: number
        description: |
          Latest exchange rate against authenticated user's preferred currency.
      update_date:
        type: string
        format: date-time
        description: The currency's last update date.
      preferred:
        type: boolean
        description: Whether this is the authenticated user's preferred currency.
  InstitutionRequest:
    type: object
    properties:
      name:
        type: string
        description: Name of the institution.
      credentials:
        type: object
        description: >
          Credentials needed for connecting to the financial institutions. The
          credentials object varies according to institution type. See the
          __Institutions__ table for a list of credentials type to be used.
        properties:
          code:
            type: string
            description: >
              The authorization code returned from the institution website's
              oAuth process. This code is then used to get the access token for
              the synchronization of the institution.

              This parameter is only required for institutions that use oAuth
              such as Questrade in a CREATE request.

              If authorization code is provided in an UPDATE request, it will be
              used to trigger a synchronization for the institution.
          token:
            type: string
            description: >
              The token generated in the institution website. `token`, along
              with `query_id`, is used for the institution's synchronization
              process.

              This parameter is only required for institutions that use the Flex
              Web Service such as IB in a CREATE request.

              If `token` and `query_id` are provided in an UPDATE request, they
              will be used to trigger a synchronization for the institution.
          query_id:
            type: string
            description: >
              The Flex Query ID generated when you created the Flex Query in the
              institution website. `query_id`, along with `token`, is used for
              the institution's synchronization process.

              This parameter is only required for institutions that use the Flex
              Web Service such as IB in a CREATE request.

              If `token` and `query_id` are provided in an UPDATE request, they
              will be used to trigger a synchronization for the institution.
          username:
            type: string
            description: >
              The username of the account you have in the institution website.

              This parameter is only required for institutions that use neither
              oAuth nor Flex Web Service in a CREATE request, and is part of the
              credentials that allows us to perform institution synchronization.

              Wealthica securely stores and protects your username and password
              with asymmetric cryptography and strict policies.

              If `username` and `password` are provided in an UPDATE request,
              they will be used to trigger a synchronization for the
              institution.
          password:
            type: string
            description: >
              The password of the account you have in the institution website.

              This parameter is only required for institutions that use neither
              oAuth nor Flex Web Service in a CREATE request, and is part of the
              credentials that allows us to perform institution synchronization.

              Wealthica securely stores and protects your username and password
              with asymmetric cryptography and strict policies.

              If `username` and `password` are provided in an UPDATE request,
              they will be used to trigger a synchronization for the
              institution.
          user_id:
            type: string
            description: >
              The User ID in the institution website. Certain institutions ask
              for `user_id` along with `key` & `secret` for the synchronization
              process.

              If `user_id`, `key` and `secret` are provided in an UPDATE
              request, they will be used to trigger a synchronization for the
              institution.
          key:
            type: string
            description: >
              The key generated in the institution website. `key`, along with
              `secret` and sometimes `user_id`, is used for the synchronization
              process for certain institutions.

              If `user_id`, `key` and `secret` are provided in an UPDATE
              request, they will be used to trigger a synchronization for the
              institution.
          secret:
            type: string
            description: >
              The key generated in the institution website. `secret`, along with
              `key` and sometimes `user_id`, is used for the synchronization
              process for certain institutions.

              If `user_id`, `key` and `secret` are provided in an UPDATE
              request, they will be used to trigger a synchronization for the
              institution.
          employer:
            type: string
            description: |
              The employer name or ID. Used by Computershare Employee Online.
      sync_documents:
        type: boolean
        description: >-
          Whether or not to sync documents from this institution. Defaults to
          true.
      sync_transactions:
        type: boolean
        description: >-
          Whether or not to sync transactions from this institution. Defaults to
          true.
      daily_sync:
        type: boolean
        description: Whether or not to sync this institution daily. Defaults to true.
  NewInstitution:
    type: object
    allOf:
      - $ref: '#/definitions/InstitutionRequest'
      - type: object
        required:
          - type
        properties:
          type:
            type: string
            description: >-
              Type of the institution. Get the list of supported types from the
              /providers endpoint.
  UpdateInstitution:
    type: object
    allOf:
      - $ref: '#/definitions/InstitutionRequest'
      - type: object
        properties:
          portfolio_manager:
            type: string
            description: Name of the portfolio manager from the institution.
          deleted:
            type: boolean
            description: >
              Whether or not the item is marked as deleted. Deleted items are
              not taken into account in calculations.
          investments:
            type: array
            items:
              type: object
              required:
                - _id
              properties:
                _id:
                  type: string
                  example: 'demo:cash:usd'
                  description: >
                    Unique identifier for the investment. It consists of 3
                    colon-separated components: the investment id, type and
                    currency. Specifically:
                    `{investment.id}:{investment.type}:{investment.currency}`.


                    NOTE: `investment._id` is unique within the institution. If
                    the same bank/investment account is connected twice into 2
                    institutions, the 2 institutions will have nearly-identical
                    `institution.investments[]` arrays (investment values might
                    differ slightly depending on the time of sync).
                name:
                  type: string
                  example: Investment Name
                  description: Name of the investment.
                groups:
                  type: array
                  items:
                    type: string
                    pattern: '^[a-f0-9]{24}$'
                  example:
                    - 5742b1f7535cf2baba8fff91
                  description: >
                    List of group IDs or name of the groups the item belongs to.

                    If the list contains a new group name, the group will be
                    automatically created and the ID correctly assigned to the
                    item.

                    Sending a `null` value will disassociate the item from any
                    groups.
                group:
                  type: string
                  example: 5742b1f7535cf2baba8fff91
                  description: >
                    [Deprecated] ID or name of the group the item belongs to.

                    If this is a new group name, the group will be automatically
                    created and the ID correctly assigned to the item.

                    Sending a `null` value will remove the association with the
                    current group.

                    Use groups instead.
                ignored:
                  type: boolean
                  description: >
                    Whether or not to exclude this investment from all
                    calculations.
                category:
                  type: string
                  description: Custom user category (based on investment type by default)
                  enum:
                    - investments
                    - savings_and_checking
                    - assets
                    - debts
            description: Updated data for investments.
          security_answer:
            type: string
            description: >
              Answer to the security question prompted by the institution
              website. If `security_answer` is provided it will be used to
              trigger a synchronization for the institution.
  Institution:
    type: object
    required:
      - _id
      - name
      - type
      - investments
      - sync_status
    properties:
      _id:
        type: string
        pattern: '^[a-f0-9]{24}$'
        example: 5742b1f7535cf2baba8fff91
        description: ID of the item within the Wealthica system.
      user:
        type: string
        pattern: '^[a-f0-9]{24}$'
        example: 5742b1f7535cf2baba8fff91
        description: ID of the item's owner user.
      name:
        type: string
        example: Demo
        description: Name of the institution (changeable).
      type:
        type: string
        description: >-
          Type of the institution. Get the list of supported types from the
          /providers endpoint.
      investments:
        type: array
        items:
          $ref: '#/definitions/Investment'
        description: List of all investment accounts (or investments for short).
      accounts:
        type: array
        items:
          type: string
        description: >-
          [Deprecated] List of all investment account numbers (or IDs) taken
          from the institution. This is different from the investment ID within
          the Wealthica system.
      overall_gain:
        type: number
        description: >-
          [Deprecated] Overall gain value from all investments in the
          institution.
      overall_roi:
        type: number
        description: '[Deprecated] Overall ROI from all investments in the institution.'
      value:
        type: number
        description: |
          Total market value of all investments in the institution, including
          cash values, converted to user's preferred currency.
      market_value:
        type: number
        description: >
          [Deprecated] Total market value of all investments in the institution,
          excluding cash values, at the end of the specified period, converted
          to user's preferred currency. Use /positions instead.
      book_value:
        type: number
        description: >
          [Deprecated] Total book value of all investments in the institution,
          converted to user's preferred currency. Use /positions instead.
      cash:
        type: number
        description: >
          [Deprecated] Total cash value of all investments in the institution,
          converted to user's preferred currency. Use /positions instead.
      sync_status:
        type: string
        enum:
          - ok
          - error
          - syncing
          - retry
      sync_date:
        type: string
        format: date-time
        description: >
          The last time the institution was successfully refreshed. May not be
          set initially when adding the institution until the first sync is
          completed.
      sync_request_date:
        type: string
        format: date-time
        description: >
          The last time when sync was requested for institution. Removed as soon
          as institution starts syncing.
      sync_error:
        $ref: '#/definitions/SyncError'
      sync_status_details:
        $ref: '#/definitions/SyncStatusDetails'
      authorized:
        type: boolean
        description: >-
          Whether the institution has successfully validated the credentials and
          security question (or MFA) and authorized the connection.
      retry_count:
        type: number
        description: |
          The number of sync retries carried out for the institution.
      retry_date:
        type: string
        format: date-time
        description: |
          The time of the last sync retry.
      creation_date:
        type: string
        format: date-time
      deleted:
        type: boolean
        description: >
          Whether or not the item is marked as deleted. Deleted items are not
          taken into account in calculations.
  Investment:
    type: object
    required:
      - _id
      - id
      - type
      - currency
      - cash
      - currency_value
      - value
      - book_value
      - market_value
      - overall_gain
      - overall_currency_gain
      - overall_roi
    properties:
      _id:
        type: string
        example: 'demo:cash:usd'
        description: >
          Unique identifier for the investment. It consists of 3 colon-separated
          components: the investment id, type and currency. Specifically:
          `{investment.id}:{investment.type}:{investment.currency}`.


          NOTE: `investment._id` is unique within the institution. If the same
          bank/investment account is connected twice into 2 institutions, the 2
          institutions will have nearly-identical `institution.investments[]`
          arrays (investment values might differ slightly depending on the time
          of sync).
      id:
        type: string
        example: demo
        description: >
          The original account number or ID taken from the institution website.

          NOTE: This is meant to be the account identifier and not the account
          number, even though it holds the account number most of the time. If
          you want to get the account number specifically, it's recommended to
          use `investment.account_number || investment.id`.
      type:
        type: string
        enum:
          - cash
          - tfsa
          - rrsp
          - resp
          - rdsp
          - margin
          - short
          - long
          - lira
          - lrsp
          - rlsp
          - rrif
          - lif
          - lrif
          - prif
          - rpp
          - ipp
          - dpsp
          - spp
          - ndcp
          - nrsp
          - epsp
          - espp
          - esop
          - vrsp
          - esp
          - rsu
          - rsa
          - psu
          - fhsa
          - gic
          - chequing
          - credit
          - loan
          - loc
          - heloc
          - mortgage
          - ira
          - roth
          - 401k
          - isa
          - sipp
          - unknown
        description: >
          The investment account type.

          An investment may be reported as type "unknown" for some special
          investments accounts offered by the institution, or when the
          institution doesn't provide sufficient information for the type to be
          reliably determined.


          | Type | Description |

          |------|-------------|

          | cash | Cash Account |

          | tfsa | Tax Free Savings Account |

          | rrsp | Registered Retirement Savings Plan |

          | resp | Registered Education Savings Plan |

          | rdsp | Registered Disability Savings Plan |

          | margin | Margin Account |

          | short | Short Margin Account |

          | long | Long Margin Account |

          | lira | Locked-in Retirement Account |

          | lrsp | Locked-in Retirement Savings Plan |

          | rlsp | Restricted Locked-in Savings Plan |

          | rrif | Registered Retirement Income Fund |

          | lif | Life Income Fund |

          | lrif | Locked-in Retirement Income Fund |

          | prif | Prescribed Registered Retirement Income Fund |

          | rpp | Registered Pension Plan |

          | ipp | Individual Pension Plan |

          | dpsp | Deferred Profit-Sharing Plan |

          | spp | Quebec/Manitoba Simplified Pension Plan |

          | ndcp | Notional Defined Contribution Plan |

          | nrsp | Non-Registered Savings Plan |

          | epsp | Employee Profit Sharing Plan |

          | espp | Employee Stock Purchase Plan |

          | esop | Employee Stock Option Plan |

          | vrsp | Voluntary Retirement Savings Plan (Quebec) |

          | esp | Employee Savings Plan |

          | rsu | Restricted Stock Unit |

          | rsa | Restricted Stock Award |

          | psu | Performance Stock Unit |

          | fhsa | First Home Savings Account |

          | gic | Guaranteed Investment Certificate |

          | trust | Trust Account |

          | chequing | Chequing |

          | credit | Credit Account, Credit Card |

          | loan | Loan |

          | loc | Line of Credit |

          | heloc | Home Equity Line of Credit |

          | mortgage | Mortgage |

          | ira | (US) Individual Retirement Account |

          | 401k | (US) 401k Retirement Account |

          | roth | (US) Roth Account (IRA or 401K) |

          | isa | (UK) Individual Savings Accounts |

          | sipp | (UK) Self-Invested Personal Pension |

          | unknown | Unknown Account |
      currency:
        type: string
        enum:
          - aud
          - bbd
          - brl
          - btc
          - cad
          - chf
          - cny
          - dkk
          - eth
          - eur
          - gbp
          - hkd
          - huf
          - ils
          - inr
          - jpy
          - krw
          - mxn
          - nok
          - nzd
          - ron
          - pln
          - aed
          - sek
          - sgd
          - thb
          - twd
          - usd
          - vnd
          - zar
        description: The investment account settlement currency.
      name:
        type: string
        example: Investment Name
        description: Name of the investment.
      groups:
        type: array
        items:
          type: string
          pattern: '^[a-f0-9]{24}$'
        example:
          - 5742b1f7535cf2baba8fff91
        description: List of group IDs the item belongs to.
      group:
        type: string
        pattern: '^[a-f0-9]{24}$'
        example: 5742b1f7535cf2baba8fff91
        description: '[Deprecated] ID of the group the item belongs to. Use groups instead.'
      banking:
        type: boolean
        description: |
          Whether or not the item is included in Banking view.
      cash:
        type: number
        description: The amount of cash in the investment account.
      currency_value:
        type: number
        description: 'The value, in investment account currency.'
      value:
        type: number
        description: 'The value, converted to user preferred currency.'
      book_value:
        type: number
        description: >
          [Deprecated] The book value of the investment, in investment account
          currency.
      market_value:
        type: number
        description: >
          [Deprecated] The market value of the investment, excluding cash value,
          at the end

          of the specified period, in investment account currency.
      overall_gain:
        type: number
        description: >
          [Deprecated] Overall gain value of the investment, at the end of the
          specified period, converted to user preferred currency.
      overall_currency_gain:
        type: number
        description: >
          [Deprecated] Overall gain value of the investment, in investment
          account currency.
      overall_roi:
        type: number
        description: '[Deprecated] Overall ROI of the investment.'
      registered:
        type: boolean
        description: Whether or not this is a registered account.
      ignored:
        type: boolean
        description: >
          Whether or not the investment has been ignored by the user and
          excluded from all calculations.
      inactive:
        type: boolean
        description: >
          Whether or not the investment is inactive.

          An investment is marked as inactive when it's closed or no longer
          being reported by the institution.
      interest_rate:
        type: number
        description: >-
          Interest rate for savings account or debt, when reported by the
          institution.
      positions:
        type: array
        description: |
          [Deprecated] A list of positions for the investment.
          This attribute has been deprecated. Use /positions instead.
        items:
          $ref: '#/definitions/Position'
      category:
        type: string
        description: Custom user category (based on investment type by default)
        enum:
          - investments
          - savings_and_checking
          - assets
          - debts
      account_number:
        type: string
        description: >
          The account number. Not always available (depending on the financial
          institution).
  SyncError:
    type: object
    description: Sync error information
    required:
      - name
      - message
    properties:
      name:
        type: string
        enum:
          - LoginFailedError
          - SecurityQuestionError
          - UserActionRequiredError
          - TemporaryFailureError
          - UnknownConnectorError
          - UnhandledConnectorError
        description: >
          Name of the sync error.


          LoginFailedError: The institution has returned a login failed error.
          The credentials provided are either invalid or our session with the
          institution has expired. No more sync will be attempted until the
          credentials are updated.


          SecurityQuestionError: A security question was returned from the
          institution website, waiting for answer. The question is stored in the
          sync error message, and possible answers (if any) are stored in the
          sync error options. Send a PUT request to /institutions/:id with the
          answer in security_answer to complete the institution authorization.


          UserActionRequiredError: There is a pending action at the financial
          institution (usually new terms of service, reset password prompt or
          some administrative task). User must log in to the financial
          institution, complete the pending action there and retry by making a
          POST to /institutions/:id/sync.


          TemporaryFailureError: A temporary failure has occurred. Our system
          will automatically retry to sync the institution. You can POST to
          /institutions/:id/sync to trigger a retry. An institution staying in
          TemporaryFailureError for an extended period may indicate a problem
          with the institution and our support team will need to investigate.


          UnknownConnectorError/UnhandledConnectorError: Behave the same as
          TemporaryFailureError (temporary & institution is set to retry). These
          errors provide our team with more information to faster pinpoint the
          root cause of the issue.
      message:
        type: string
        description: |
          Sync error message.
      options:
        type: array
        items:
          type: string
        example:
          - Michael
          - Michelle
          - Mitchell
        description: >-
          (Optional, SecurityQuestionError only) List of answer options for the
          security question.
  SyncStatusDetails:
    type: object
    description: >-
      Detailed status of the last sync. May not be set initially when adding the
      institution until the first sync is completed.
    properties:
      investments:
        type: string
        enum:
          - ok
          - error
          - syncing
          - retry
        description: |
          The last sync status on fetching investments (account balances).
      positions:
        type: string
        enum:
          - ok
          - error
          - syncing
          - retry
        description: |
          The last sync status on fetching positions (holdings).
      transactions:
        type: string
        enum:
          - ok
          - error
          - syncing
          - retry
        description: |
          The last sync status on fetching transactions.
      documents:
        type: string
        enum:
          - ok
          - error
          - syncing
          - retry
        description: |
          The last sync status on fetching documents.
      date:
        type: string
        format: date-time
        description: |
          The last time when institution tried to sync.
  Liability:
    type: object
    required:
      - _id
      - name
      - type
      - currency
      - value
      - currency_value
      - creation_date
    properties:
      _id:
        type: string
        pattern: '^[a-f0-9]{24}$'
        example: 5742b1f7535cf2baba8fff91
        description: ID of the item within the Wealthica system.
      name:
        type: string
        example: Mortgage
        description: Name of the liability.
      type:
        type: string
        description: Type of the liability.
        enum:
          - mortgage
          - other_debt
      currency:
        type: string
        enum:
          - aud
          - bbd
          - brl
          - btc
          - cad
          - chf
          - cny
          - dkk
          - eth
          - eur
          - gbp
          - hkd
          - huf
          - ils
          - inr
          - jpy
          - krw
          - mxn
          - nok
          - nzd
          - ron
          - pln
          - aed
          - sek
          - sgd
          - thb
          - twd
          - usd
          - vnd
          - zar
        description: The liability currency.
      groups:
        type: array
        items:
          type: string
          pattern: '^[a-f0-9]{24}$'
        example:
          - 5742b1f7535cf2baba8fff91
        description: List of group IDs the item belongs to.
      group:
        type: string
        pattern: '^[a-f0-9]{24}$'
        example: 5742b1f7535cf2baba8fff91
        description: '[Deprecated] ID of the group the item belongs to. Use groups instead.'
      banking:
        type: boolean
        description: |
          Whether or not the item is included in Banking view.
      image:
        type: string
        format: data URI
        maxLength: 102400
        description: >
          The item's image, in base64-encoded data URI. In an UPDATE request,
          sending a `null` value for `image` will remove the image.
      value:
        type: number
        description: 'The value, converted to user preferred currency.'
      currency_value:
        type: number
        minimum: 0
        description: 'The value of the liability, in liability currency.'
      creation_date:
        type: string
        format: date-time
      deleted:
        type: boolean
        description: >
          Whether or not the item is marked as deleted. Deleted items are not
          taken into account in calculations.
  NewLiability:
    type: object
    required:
      - name
      - type
      - currency
      - currency_value
    properties:
      name:
        type: string
        example: Home
        description: Name of the liability.
      type:
        type: string
        description: Type of the liability.
        enum:
          - mortgage
          - other_debt
      currency:
        type: string
        enum:
          - aud
          - bbd
          - brl
          - btc
          - cad
          - chf
          - cny
          - dkk
          - eth
          - eur
          - gbp
          - hkd
          - huf
          - ils
          - inr
          - jpy
          - krw
          - mxn
          - nok
          - nzd
          - ron
          - pln
          - aed
          - sek
          - sgd
          - thb
          - twd
          - usd
          - vnd
          - zar
        description: The liability currency.
      currency_value:
        type: number
        minimum: 0
        description: 'The value of the liability, in liability currency.'
  UpdateLiability:
    type: object
    properties:
      name:
        type: string
        example: Home
        description: Name of the liability.
      type:
        type: string
        description: Type of the liability.
        enum:
          - mortgage
          - other_debt
      groups:
        type: array
        items:
          type: string
          pattern: '^[a-f0-9]{24}$'
        example:
          - 5742b1f7535cf2baba8fff91
        description: >
          List of group IDs or name of the groups the item belongs to.

          If the list contains a new group name, the group will be automatically
          created and the ID correctly assigned to the item.

          Sending a `null` value will disassociate the item from any groups.
      group:
        type: string
        example: 5742b1f7535cf2baba8fff91
        description: >
          [Deprecated] ID or name of the group the item belongs to.

          If this is a new group name, the group will be automatically created
          and the ID correctly assigned to the item.

          Sending a `null` value will remove the association with the current
          group.

          Use groups instead.
      image:
        type: string
        format: data URI
        maxLength: 102400
        description: >
          The item's image, in base64-encoded data URI. In an UPDATE request,
          sending a `null` value for `image` will remove the image.
      currency_value:
        type: number
        minimum: 0
        description: 'The value of the liability, in liability currency.'
      deleted:
        type: boolean
        description: >
          Whether or not the item is marked as deleted. Deleted items are not
          taken into account in calculations.
  Portfolio:
    type: object
    properties:
      history:
        type: object
        description: >
          A map of history portfolio data over the specified period for each
          specified institution, asset and liability, with keys map to the IDs;
          and a total history data which combines all the specified
          institutions, assets and liabilities.
        properties:
          total:
            $ref: '#/definitions/TimeSerie'
        additionalProperties:
          $ref: '#/definitions/TimeSerie'
      transactions:
        type: object
        description: >
          Total values aggregated from all transactions that belong to the
          specified institutions and assets.
        properties:
          fees:
            type: number
            description: >
              Total of per-transaction fee for the transactions. This number
              should always be positive.
          summary:
            type: object
            description: A summary by type for the transactions.
            properties:
              deposit:
                type: number
                description: Total value of all deposit transactions.
              withdrawal:
                type: number
                description: Total value of all withdrawal transactions.
              transfer:
                type: number
                description: Total value of all transfer transactions.
              transfer_in:
                type: number
                description: Total value of all transfer_in transactions.
              transfer_out:
                type: number
                description: Total value of all transfer_out transactions.
              switch:
                type: number
                description: Total value of all switch transactions.
              interest:
                type: number
                description: Total value of all interest transactions.
              dividend:
                type: number
                description: Total value of all dividend transactions.
              distribution:
                type: number
                description: Total value of all distribution transactions.
              roc:
                type: number
                description: Total value of all roc transactions.
              reinvest:
                type: number
                description: Total value of all reinvest transactions.
              tax:
                type: number
                description: Total value of all tax transactions.
              fee:
                type: number
                description: Total value of all fee transactions.
              sell:
                type: number
                description: Total value of all sell transactions.
              buy:
                type: number
                description: Total value of all buy transactions.
              income:
                type: number
                description: Total value of all income transactions.
              split:
                type: number
                description: Total value of all split transactions.
  Position:
    type: object
    properties:
      _id:
        type: string
        pattern: '^[a-f0-9]{24}$'
        example: 5742b1f7535cf2baba8fff91
        description: ID of the item within the Wealthica system.
      class:
        type: string
        enum:
          - equity
          - fixed_income
          - cash_equivalent
          - tangible_asset
          - private_equity
          - preferred_shares
          - crypto
          - other
        description: The position class.
      classes:
        type: array
        description: The position classes.
        items:
          type: object
          properties:
            class:
              type: string
              enum:
                - equity
                - fixed_income
                - cash_equivalent
                - tangible_asset
                - private_equity
                - preferred_shares
                - crypto
                - other
              description: The position class.
            weight:
              type: number
              minimum: 0
              maximum: 1
      category:
        type: string
        description: The position category.
      categories:
        type: array
        description: The position categories.
        items:
          type: object
          properties:
            category:
              type: string
              description: The position category.
            weight:
              type: number
              minimum: 0
              maximum: 1
      security:
        $ref: '#/definitions/Security'
        description: The position security.
      investments:
        type: array
        items:
          $ref: '#/definitions/PositionInvestment'
        description: A breakdown of all investments this position belongs to.
      quantity:
        type: number
        description: The quantity of the security in the position.
      book_value:
        type: number
        description: |
          The book value of the position, in user's preferred currency.
      market_value:
        type: number
        description: >
          The current market value of the position, in user's preferred
          currency.
      gain_amount:
        type: number
        description: |
          The current gain amount of the position, in user's preferred currency.
      gain_percent:
        type: number
        description: The current gain percent of the position.
  UpdatePosition:
    type: object
    properties:
      class:
        type: string
        enum:
          - equity
          - fixed_income
          - cash_equivalent
          - tangible_asset
          - private_equity
          - preferred_shares
          - crypto
          - other
        description: The position class.
      classes:
        type: array
        description: The position classes.
        items:
          type: object
          properties:
            class:
              type: string
              enum:
                - equity
                - fixed_income
                - cash_equivalent
                - tangible_asset
                - private_equity
                - preferred_shares
                - crypto
                - other
              description: The position class.
            weight:
              type: number
              minimum: 0
              maximum: 1
      category:
        type: string
        description: The position category.
      categories:
        type: string
        description: The position category.
  PositionInvestment:
    type: object
    properties:
      institution:
        type: string
        pattern: '^[a-f0-9]{24}$'
        example: 5742b1f7535cf2baba8fff91
        description: ID of the institution the item belongs to.
      investment:
        type: string
        example: 'demo:cash:usd'
        description: ID of the investment account the item belongs to.
      currency:
        type: string
        enum:
          - aud
          - bbd
          - brl
          - btc
          - cad
          - chf
          - cny
          - dkk
          - eth
          - eur
          - gbp
          - hkd
          - huf
          - ils
          - inr
          - jpy
          - krw
          - mxn
          - nok
          - nzd
          - ron
          - pln
          - aed
          - sek
          - sgd
          - thb
          - twd
          - usd
          - vnd
          - zar
        description: The investment account currency.
      quantity:
        type: number
        description: The quantity of security in the investment.
      book_value:
        type: number
        description: |
          The book value of the investment, in investment account currency.
      market_value:
        type: number
        description: >
          The current market value of the investment, in investment account
          currency.
      value:
        type: number
        description: >
          [Deprecated] The current market value of the investment, in user's
          preferred currency.
      gain_amount:
        type: number
        description: >
          The current gain amount of the investment, in investment account
          currency.
      gain_percent:
        type: number
        description: The current gain percent of the investment.
  Performance:
    type: object
    properties:
      history:
        type: object
        description: >
          A map of history performance data over the specified period for each
          specified institution, asset and liability, with keys map to the IDs;
          and a total history data which combines all the specified
          institutions, assets and liabilities.
        properties:
          total:
            $ref: '#/definitions/TimeSerie'
        additionalProperties:
          $ref: '#/definitions/TimeSerie'
      institutions:
        type: array
        description: |
          A list of performance objects for the specified institutions.
        items:
          $ref: '#/definitions/InstitutionPerformance'
      investments:
        type: array
        description: >
          A list of performance objects for the investments in the specified
          institutions.
        items:
          $ref: '#/definitions/InvestmentPerformance'
      assets:
        type: array
        description: A list of performance objects for assets.
        items:
          $ref: '#/definitions/AssetPerformance'
      positions:
        type: array
        description: A list of performance objects for positions.
        items:
          $ref: '#/definitions/PositionPerformance'
  PerformanceObject:
    type: object
    properties:
      first_date:
        type: string
        format: date-time
        description: >
          The first date in the specified period that the investment/asset has a
          value.
      last_date:
        type: string
        format: date-time
        description: >
          The last date in the specified period that the investment/asset has a
          value.
      first_currency_value:
        type: number
        description: |
          The first value in the specified period, in investment/asset currency.
      last_currency_value:
        type: number
        description: |
          The last value in the specified period, in investment/asset currency.
      roi:
        type: number
        description: '[Deprecated] ROI of the investment/asset over the specified period.'
      gain:
        type: number
        description: |
          Gain value over the specified period, in user's preferred currency.
      currency_gain:
        type: number
        description: |
          Gain value over the specified period, in investment/asset currency.
  InvestmentPerformance:
    type: object
    allOf:
      - $ref: '#/definitions/PerformanceObject'
      - type: object
        properties:
          _id:
            type: string
            example: 'demo:cash:usd'
            description: >
              Unique identifier for the investment. It consists of 3
              colon-separated components: the investment id, type and currency.
              Specifically:
              `{investment.id}:{investment.type}:{investment.currency}`.


              NOTE: `investment._id` is unique within the institution. If the
              same bank/investment account is connected twice into 2
              institutions, the 2 institutions will have nearly-identical
              `institution.investments[]` arrays (investment values might differ
              slightly depending on the time of sync).
          institution:
            type: string
            pattern: '^[a-f0-9]{24}$'
            example: 5742b1f7535cf2baba8fff91
            description: ID of the institution the item belongs to.
          transactions:
            type: array
            description: >
              A list of cash flow impacting transactions that were used for ROI
              calculation.
            items:
              type: object
              properties:
                date:
                  type: string
                  format: date-time
                  description: The date the transaction was recorded.
                currency_amount:
                  type: number
                  description: >
                    The amount of the transaction, in investment account
                    currency.
  AssetPerformance:
    type: object
    allOf:
      - $ref: '#/definitions/PerformanceObject'
      - type: object
        properties:
          _id:
            type: string
            pattern: '^[a-f0-9]{24}$'
            example: 5742b1f7535cf2baba8fff91
            description: ID of the item within the Wealthica system.
  InstitutionPerformance:
    type: object
    properties:
      _id:
        type: string
        pattern: '^[a-f0-9]{24}$'
        example: 5742b1f7535cf2baba8fff91
        description: ID of the item within the Wealthica system.
      roi:
        type: number
        description: '[Deprecated] ROI of the institution over the specified period.'
      gain:
        type: number
        description: >
          Gain value of the institution over the specified period, in user's
          preferred currency.
  Security:
    type: object
    description: Performance data for the security.
    required:
      - _id
      - currency
      - type
      - name
      - aliases
    properties:
      _id:
        type: string
        pattern: '^[a-f0-9]{24}$'
        example: 5742b1f7535cf2baba8fff91
        description: ID of the item within the Wealthica system.
      currency:
        type: string
        enum:
          - aud
          - bbd
          - brl
          - btc
          - cad
          - chf
          - cny
          - dkk
          - eth
          - eur
          - gbp
          - hkd
          - huf
          - ils
          - inr
          - jpy
          - krw
          - mxn
          - nok
          - nzd
          - ron
          - pln
          - aed
          - sek
          - sgd
          - thb
          - twd
          - usd
          - vnd
          - zar
        description: The security trading currency.
      symbol:
        type: string
        pattern: '^[A-Z0-9.]+$'
        description: The ticker symbol for the security.
      type:
        type: string
        enum:
          - equity
          - mutual_fund
          - fixed_income
          - cash_equivalent
          - option
          - crypto
          - other
        description: The security type.
      name:
        type: string
        description: The security name.
      aliases:
        type: array
        items:
          type: string
        description: |
          A list of possible alternate names for the security.
      last_price:
        type: number
        description: |
          The last price of the security recorded in the specified period.
      last_date:
        type: string
        format: date-time
        description: The date when the security's `last_price` was recorded.
      high_price:
        type: number
        description: |
          The highest price of the security recorded in the specified period.
      high_date:
        type: string
        format: date-time
        description: The date when the security's `high_price` was recorded.
      low_price:
        type: number
        description: |
          The lowest price of the security recorded in the specified period.
      low_date:
        type: string
        format: date-time
        description: The date when the security's `low_price` was recorded.
      cusip:
        type: string
        description: The CUSIP code for the security.
  PositionPerformance:
    type: object
    properties:
      _id:
        type: string
        pattern: '^[a-f0-9]{24}$'
        example: 5742b1f7535cf2baba8fff91
        description: ID of the item within the Wealthica system.
      security:
        $ref: '#/definitions/Security'
      period_gain_percent:
        type: number
        description: |
          The gain percent of the security over the specified period.
  Provider:
    type: object
    properties:
      type:
        type: string
        description: Unique provider slug.
      name:
        type: string
        description: Provider full name.
      url:
        type: string
        description: Official provider website.
      unpublished:
        type: boolean
        description: Hide provider from official publishing.
      expand:
        type: boolean
        description: If expanded from another provider functionality.
      class:
        type: string
        description: Class of provider.
        enum:
          - core
          - vezgo
          - yodlee
      features:
        type: object
        description: Supported features list.
        properties:
          account:
            type: integer
            description: If Accounts are supported.
            enum:
              - 0
              - 1
          positions:
            type: integer
            description: If Positions are supported.
            enum:
              - 0
              - 1
          transactions:
            type: integer
            description: If Transactions are supported.
            enum:
              - 0
              - 1
          documents:
            type: integer
            description: If Documents are supported.
            enum:
              - 0
              - 1
          nfts:
            type: integer
            description: If NFTs are supported.
            enum:
              - 0
              - 1
      note:
        type: string
        description: Note related to provider.
      instructions:
        type: object
        description: Connect provider instruction.
        properties:
          en:
            type: string
            description: English instruction.
          fr:
            type: string
            description: French instruction.
      beta:
        type: boolean
        description: If provider in beta release.
      crypto:
        type: boolean
        description: If provider is crypto.
      group:
        type: string
        description: Providers group.
      aliases:
        type: array
        items:
          type: string
        description: List of aliases for provider name.
      oauth:
        type: boolean
        description: If oauth provider
      scopes:
        type: array
        description: List of supported scopes.
      clientId:
        type: string
        deprecated: true
        description: 'Deprecated, use `client_id` instead.'
      client_id:
        type: string
        description: Public client id for oauth authorization.
      authorizeUrl:
        type: string
        deprecated: true
        description: 'Deprecated, use `authorize_url` instead.'
      authorize_url:
        type: string
        description: Oauth authorize URL.
      mfa_not_remembered:
        type: boolean
        description: >-
          MFA can not be remembered what requires to enter MFA for the each new
          sync. Daily sync is disabled for such provider.
      storeAnswer:
        type: boolean
        deprecated: true
        description: 'Deprecated, use `store_answer` instead.'
      store_answer:
        type: boolean
        description: If user's answer will be stored.
      credentials:
        type: string
        description: Required credentials.
        enum:
          - key
          - secret
          - wallet
          - network
          - query_id
          - token
          - username
          - password
          - code
          - client_id
          - employer
          - account_number
          - user_id
      key:
        type: object
        description: Custom properties of credentials keys.
        properties:
          pattern:
            type: string
            description: Custom regex pattern for credential input validation.
          label:
            type: object
            properties:
              en:
                type: string
                description: Custom English label.
              fr:
                type: string
                description: Custom French label.
      secret:
        type: object
        description: Custom properties of credentials keys.
        properties:
          pattern:
            type: string
            description: Custom regex pattern for credential input validation.
          label:
            type: object
            properties:
              en:
                type: string
                description: Custom English label.
              fr:
                type: string
                description: Custom French label.
      wallet:
        type: object
        description: Custom properties of credentials keys.
        properties:
          pattern:
            type: string
            description: Custom regex pattern for credential input validation.
          label:
            type: object
            properties:
              en:
                type: string
                description: Custom English label.
              fr:
                type: string
                description: Custom French label.
      network:
        type: object
        description: Custom properties of credentials keys.
        properties:
          pattern:
            type: string
            description: Custom regex pattern for credential input validation.
          label:
            type: object
            properties:
              en:
                type: string
                description: Custom English label.
              fr:
                type: string
                description: Custom French label.
      query_id:
        type: object
        description: Custom properties of credentials keys.
        properties:
          pattern:
            type: string
            description: Custom regex pattern for credential input validation.
          label:
            type: object
            properties:
              en:
                type: string
                description: Custom English label.
              fr:
                type: string
                description: Custom French label.
      username:
        type: object
        description: Custom properties of credentials keys.
        properties:
          pattern:
            type: string
            description: Custom regex pattern for credential input validation.
          label:
            type: object
            properties:
              en:
                type: string
                description: Custom English label.
              fr:
                type: string
                description: Custom French label.
      token:
        type: object
        description: Custom properties of credentials keys.
        properties:
          pattern:
            type: string
            description: Custom regex pattern for credential input validation.
          label:
            type: object
            properties:
              en:
                type: string
                description: Custom English label.
              fr:
                type: string
                description: Custom French label.
      password:
        type: object
        description: Custom properties of credentials keys.
        properties:
          pattern:
            type: string
            description: Custom regex pattern for credential input validation.
          label:
            type: object
            properties:
              en:
                type: string
                description: Custom English label.
              fr:
                type: string
                description: Custom French label.
      code:
        type: object
        description: Custom properties of credentials keys.
        properties:
          pattern:
            type: string
            description: Custom regex pattern for credential input validation.
          label:
            type: object
            properties:
              en:
                type: string
                description: Custom English label.
              fr:
                type: string
                description: Custom French label.
      employer:
        type: object
        description: Custom properties of credentials keys.
        properties:
          pattern:
            type: string
            description: Custom regex pattern for credential input validation.
          label:
            type: object
            properties:
              en:
                type: string
                description: Custom English label.
              fr:
                type: string
                description: Custom French label.
      account_number:
        type: object
        description: Custom properties of credentials keys.
        properties:
          pattern:
            type: string
            description: Custom regex pattern for credential input validation.
          label:
            type: object
            properties:
              en:
                type: string
                description: Custom English label.
              fr:
                type: string
                description: Custom French label.
      user_id:
        type: object
        description: Custom properties of credentials keys.
        properties:
          pattern:
            type: string
            description: Custom regex pattern for credential input validation.
          label:
            type: object
            properties:
              en:
                type: string
                description: Custom English label.
              fr:
                type: string
                description: Custom French label.
  TransactionRequest:
    type: object
    required:
      - type
      - currency_amount
    properties:
      type:
        type: string
        enum:
          - deposit
          - withdrawal
          - transfer
          - transfer_in
          - transfer_out
          - switch
          - interest
          - dividend
          - distribution
          - roc
          - reinvest
          - drip
          - tax
          - fee
          - sell
          - buy
          - income
          - split
          - mtm
          - loan
          - recall
          - name_change
          - spinoff
          - merger
          - unknown
        description: The transaction type.
      category:
        type: string
        maxLength: 30
      security:
        type: string
        pattern: '^[a-f0-9]{24}$'
        example: 5742b1f7535cf2baba8fff91
        description: >
          ID of the security involved in the transaction. Either `security` or
          `symbol` must be provided for transaction of types dividend,
          distribution, roc, reinvest, sell, buy, transfer_in and transfer_out.
      symbol:
        type: string
        pattern: '^[A-Z0-9.]+$'
        description: >
          The ticker symbol for the security involved in the transaction (if
          any). Either `security` or `symbol` must be provided for transactions
          of types dividend, distribution, roc, reinvest, sell, buy, transfer_in
          and transfer_out.
      quantity:
        type: number
        description: |
          The quantity of security involved in the transaction (if any).
      currency_amount:
        type: number
        description: 'The transaction amount, in transaction currency.'
      amounts:
        type: array
        description: |
          Transaction amount in different currencies.
        items:
          type: object
          properties:
            currency:
              type: string
              enum:
                - aud
                - bbd
                - brl
                - btc
                - cad
                - chf
                - cny
                - dkk
                - eth
                - eur
                - gbp
                - hkd
                - huf
                - ils
                - inr
                - jpy
                - krw
                - mxn
                - nok
                - nzd
                - ron
                - pln
                - aed
                - sek
                - sgd
                - thb
                - twd
                - usd
                - vnd
                - zar
              description: The currency of the amount.
            amount:
              type: number
              description: The transaction amount in the respective currency.
      description:
        type: string
        maxLength: 350
        description: The transaction description.
      note:
        type: string
        maxLength: 400
        description: The transaction note.
      fee:
        type: number
        description: 'The transaction fee, in transaction currency.'
      realized_gain:
        type: number
        description: >
          [Deprecated] The realized gain amount for the sell transaction, in
          user preferred currency.
  NewTransaction:
    type: object
    allOf:
      - $ref: '#/definitions/TransactionRequest'
      - type: object
        required:
          - date
        properties:
          institution:
            type: string
            pattern: '^[a-f0-9]{24}$'
            example: 5742b1f7535cf2baba8fff91
            description: >
              ID of the institution the transaction belongs to. This is not
              required if `asset` is available.
          investment:
            type: string
            example: 'demo:cash:usd'
            description: >
              ID of the investment account the transaction belongs to. This is
              not required if `asset` is available.
          asset:
            type: string
            pattern: '^[a-f0-9]{24}$'
            example: 5742b1f7535cf2baba8fff91
            description: >
              ID of the asset the transaction belongs to. This is not required
              if `institution` and `investment` are available.
          date:
            type: string
            format: date-time
            description: The date the transaction occured (trade date).
          settlement_date:
            type: string
            format: date-time
            description: The settlement date of the transaction.
  UpdateTransaction:
    type: object
    allOf:
      - $ref: '#/definitions/TransactionRequest'
      - type: object
        properties:
          deleted:
            type: boolean
            description: >
              Whether or not the item is marked as deleted. Deleted items are
              not taken into account in calculations.
  Transaction:
    type: object
    description: |
      Not all attributes are available when retrieving the transactions list.
    required:
      - _id
      - user
      - institution
      - currency
      - date
      - type
      - origin_type
      - description
      - currency_amount
      - amount
    properties:
      _id:
        type: string
        pattern: '^[a-f0-9]{24}$'
        example: 5742b1f7535cf2baba8fff91
        description: ID of the item within the Wealthica system.
      user:
        type: string
        pattern: '^[a-f0-9]{24}$'
        example: 5742b1f7535cf2baba8fff91
        description: ID of the item's owner user.
      institution:
        type: string
        pattern: '^[a-f0-9]{24}$'
        example: 5742b1f7535cf2baba8fff91
        description: ID of the institution the item belongs to.
      investment:
        type: string
        example: 'demo:cash:usd'
        description: ID of the investment account the item belongs to.
      asset:
        type: string
        pattern: '^[a-f0-9]{24}$'
        example: 5742b1f7535cf2baba8fff91
        description: ID of the asset the item belongs to.
      currency:
        type: string
        enum:
          - aud
          - bbd
          - brl
          - btc
          - cad
          - chf
          - cny
          - dkk
          - eth
          - eur
          - gbp
          - hkd
          - huf
          - ils
          - inr
          - jpy
          - krw
          - mxn
          - nok
          - nzd
          - ron
          - pln
          - aed
          - sek
          - sgd
          - thb
          - twd
          - usd
          - vnd
          - zar
        description: >
          The transaction currency, inferred from the transaction's investment
          account or asset.

          Not available in GET /transactions API.
      date:
        type: string
        format: date-time
        description: The date the transaction occured (trade date).
      processing_date:
        type: string
        format: date-time
        description: The date the transaction was recorded by the institution.
      settlement_date:
        type: string
        format: date-time
        description: The settlement date of the transaction.
      timestamp:
        type: string
        format: date-time
        description: >-
          The exact timestamp (date + time) when the transaction occured. Mostly
          for cryptocurrency transactions.
      type:
        type: string
        enum:
          - deposit
          - withdrawal
          - transfer
          - transfer_in
          - transfer_out
          - switch
          - interest
          - dividend
          - distribution
          - roc
          - reinvest
          - drip
          - tax
          - fee
          - sell
          - buy
          - income
          - split
          - mtm
          - loan
          - recall
          - name_change
          - spinoff
          - merger
          - unknown
        description: The transaction type.
      origin_type:
        type: string
        description: |
          The original transaction type as reported by the institution.
          For user created transactions, this is identical to `type`.
      origin_id:
        type: string
        description: The original transaction ID as reported by the institution.
      category:
        type: string
        description: The transaction category.
      origin_category:
        type: string
        description: |
          The original transaction category as reported by the institution.
      security:
        $ref: '#/definitions/Security'
      symbol:
        type: string
        pattern: '^[A-Z0-9.]+$'
        description: |
          The ticker symbol for the security involved in the transaction.
      description:
        type: string
        description: >
          The transaction description. For synchronized transactions, this is
          reported by the institution. For user created transactions, this is
          provided by the user.
      note:
        type: string
        description: |
          Some notes for the transaction set by the user.
      currency_amount:
        type: number
        description: 'The transaction amount, in transaction currency.'
      amount:
        type: number
        description: |
          The transaction amount, converted to user's preferred currency.
          Not available in GET /transactions API.
      amounts:
        type: array
        description: |
          Transaction amount in different currencies.
        items:
          type: object
          properties:
            currency:
              type: string
              enum:
                - aud
                - bbd
                - brl
                - btc
                - cad
                - chf
                - cny
                - dkk
                - eth
                - eur
                - gbp
                - hkd
                - huf
                - ils
                - inr
                - jpy
                - krw
                - mxn
                - nok
                - nzd
                - ron
                - pln
                - aed
                - sek
                - sgd
                - thb
                - twd
                - usd
                - vnd
                - zar
              description: The currency of the amount.
            amount:
              type: number
              description: The transaction amount in the respective currency.
      fee:
        type: number
        description: >
          Includes transaction fee (commission), or mutual fund front-end or
          back-end load fees.

          Amount is reported and stored in transaction currency.

          Only for buy or sell transaction.
      quantity:
        type: number
        description: |
          The quantity of securities involved in the transaction.
      realized_gain:
        type: number
        description: >
          [Deprecated] The realized gain amount for the sell transaction, in
          user preferred currency.
      user_created:
        type: boolean
        description: |
          Whether or not the transaction was manually created by the user.
      deleted:
        type: boolean
        description: >
          Whether or not the item is marked as deleted. Deleted items are not
          taken into account in calculations.
      incomplete:
        type: array
        description: A list of the fields being considered invalid or incomplete.
        items:
          type: string
          enum:
            - currency_amount
            - quantity
            - symbol
            - fee
      missing:
        type: boolean
        description: >
          Whether or not the transaction is missing.

          A transaction is marked as missing when it was previously reported by
          the institution but is no longer present or is no longer being
          recognized.
      new:
        type: boolean
        description: Whether or not the transaction has been marked as viewed.
      history:
        type: array
        description: A list of changes made to the transaction.
        items:
          type: object
          properties:
            date:
              type: string
              format: date-time
              description: The time the change was made.
            paths:
              type: array
              description: A list of fields involved in the change.
              items:
                type: string
            values:
              type: object
              description: >
                A map of the changed fields and their values before the change
                was made.
      other_parties:
        type: array
        description: >
          A list of other accounts (sources or recipients) involved in this
          transaction.

          Could be account numbers, or wallet addresses for cryptocurrency
          transactions.
        items:
          type: string
  TimeSerie:
    type: object
    properties:
      from:
        type: string
        format: date-time
        description: The `from` parameter provided to the query.
      to:
        type: string
        format: date-time
        description: The `to` parameter provided to the query.
      high:
        type: object
        description: >
          Highest value capture in the specified period and the corresponding
          date.
        properties:
          date:
            type: string
            format: date-time
          value:
            type: number
      low:
        type: object
        description: >
          Lowest value capture in the specified period and the corresponding
          date.
        properties:
          date:
            type: string
            format: date-time
          value:
            type: number
      first:
        type: object
        description: >
          First value capture in the specified period and the corresponding
          date.
        properties:
          date:
            type: string
            format: date-time
          value:
            type: number
      last:
        type: object
        description: |
          Last value capture in the specified period and the corresponding date.
        properties:
          date:
            type: string
            format: date-time
          value:
            type: number
      difference:
        type: number
        description: The total value gained within the period.
      change:
        type: number
        description: The change percentage for the period.
      data:
        type: array
        description: >
          A list of the values captured for each date in the specified period,
          sorted by date, in which first value belongs to the first date and
          last value belongs to the last date.
        items:
          type: number
  Sharing:
    type: object
    required:
      - _id
      - sharer
      - sharee
    properties:
      _id:
        type: string
        pattern: '^[a-f0-9]{24}$'
        example: 5742b1f7535cf2baba8fff91
        description: The sharing ID
      sharer:
        type: object
        description: The sharer
        properties:
          id:
            type: string
            pattern: '^[a-f0-9]{24}$'
            example: 5742b1f7535cf2baba8fff91
            description: The sharer user ID
          name:
            type: string
            description: >
              The sharer name. This is only provided if the sharer id is not the
              same as the requester id.
          email:
            type: string
            format: email
            description: >
              The sharer email. This is only provided if the sharer id is not
              the same as the requester id.
      sharee:
        type: object
        description: The sharee
        properties:
          id:
            type: string
            pattern: '^[a-f0-9]{24}$'
            example: 5742b1f7535cf2baba8fff91
            description: The sharee user ID
          name:
            type: string
            description: >
              The sharee name. This is only provided if the sharee id is not the
              same as the requester id.
          email:
            type: string
            format: email
            description: >
              The sharee email. This is only provided if the sharee id is not
              the same as the requester id.
  Subscription:
    type: object
    properties:
      _id:
        type: string
        pattern: '^[a-f0-9]{24}$'
        example: 5742b1f7535cf2baba8fff91
        description: ID of the item within the Wealthica system.
      plan:
        type: string
        description: Original provider plan or product name.
      unified_plan:
        type: string
        description: 'Unified plan name, the same between platforms.'
        example:
          - connect
          - connect_unlimited
          - premium
          - prestige
          - '*_addon'
      type:
        type: string
        description: Type of subscription
        enum:
          - plan
          - addon
      state:
        type: string
        description: Original current subscription state (status).
      payment_period:
        type: string
        description: Subscription period.
      is_active:
        type: boolean
        description: If subscription active.
      provider:
        type: string
        default: recurly
        enum:
          - recurly
          - apple
          - android
      created_at:
        format: date-time
        description: Created or purchase date.
      renew_at:
        format: date-time
        description: Renew at date.
      expires_at:
        format: date-time
        description: Expires at date.
      trial_ends_at:
        format: date-time
        description: Trial ends at date.
      price:
        format: number
        description: Subscription price for the period.
      currency:
        format: string
        description: Currency
  Document:
    type: object
    required:
      - _id
      - name
      - type
      - size
      - date
      - mime
      - user
      - institution
    properties:
      _id:
        type: string
        pattern: '^[a-f0-9]{24}$'
        example: 5742b1f7535cf2baba8fff91
        description: ID of the item within the Wealthica system.
      name:
        type: string
        example: Tax Receipts Q1-2021
        description: Name of the document.
      type:
        type: string
        enum:
          - statement
          - trade_confirmation
          - tax_receipt
          - fund_facts
          - investment_policy
          - other
        description: The document type.
      size:
        type: number
        description: The document size (in bytes).
      mime:
        type: string
        enum:
          - application/pdf
        description: The document mime type.
      preview:
        type: string
        description: The document preview (data URI).
      date:
        type: string
        format: date-time
        description: The date the document is issued.
      user:
        type: string
        pattern: '^[a-f0-9]{24}$'
        example: 5742b1f7535cf2baba8fff91
        description: ID of the item's owner user.
      institution:
        type: string
        pattern: '^[a-f0-9]{24}$'
        example: 5742b1f7535cf2baba8fff91
        description: >-
          ID of the institution the document belongs to. Mutually exclusive with
          asset.
      investments:
        type: array
        description: >
          The investment accounts the document belongs to. Could be account
          numbers in plain strings (e.g. ABCDEFGH01) or Wealthica investment id
          format (e.g. demo:cash:usd). Mutually exclusive with asset.
        items:
          type: string
      asset:
        type: string
        pattern: '^[a-f0-9]{24}$'
        example: 5742b1f7535cf2baba8fff91
        description: >-
          ID of the asset the document belongs to. Mutually exclusive with
          institution & investments.
      new:
        type: boolean
        description: Whether or not the document has been marked as viewed.
      url:
        type: string
        format: url
        description: |
          The document download url. Only available in GET /documents/{id} API.
      note:
        type: string
        description: |
          Some notes for the item set by the user.
  NewDocument:
    type: object
    required:
      - name
      - date
      - type
      - data
    properties:
      name:
        type: string
        example: Tax Receipts Q1-2021
        description: Name of the document.
      type:
        type: string
        enum:
          - statement
          - trade_confirmation
          - tax_receipt
          - fund_facts
          - investment_policy
          - other
        description: The document type.
      institution:
        type: string
        pattern: '^[a-f0-9]{24}$'
        example: 5742b1f7535cf2baba8fff91
        description: >-
          ID of the institution the document belongs to. Mutually exclusive with
          asset.
      investments:
        type: array
        description: >
          The investment accounts the document belongs to. Could be account
          numbers in plain strings (e.g. ABCDEFGH01) or Wealthica investment id
          format (e.g. demo:cash:usd). Mutually exclusive with asset.
        items:
          type: string
      asset:
        type: string
        pattern: '^[a-f0-9]{24}$'
        example: 5742b1f7535cf2baba8fff91
        description: >-
          ID of the asset the document belongs to. Mutually exclusive with
          institution & investments.
      date:
        type: string
        format: date-time
        description: The date the document is issued.
      note:
        type: string
        description: |
          Some notes for the item set by the user.
      data:
        type: string
        format: data URI
        maxLength: 20971520
        description: |
          The document file, in base64-encoded data URI.
  UpdateDocument:
    type: object
    properties:
      name:
        type: string
        example: Tax Receipts Q1-2021
        description: Name of the document.
      type:
        type: string
        enum:
          - statement
          - trade_confirmation
          - tax_receipt
          - fund_facts
          - investment_policy
          - other
        description: The document type.
      institution:
        type: string
        pattern: '^[a-f0-9]{24}$'
        example: 5742b1f7535cf2baba8fff91
        description: >-
          ID of the institution the document belongs to. Mutually exclusive with
          asset.
      investments:
        type: array
        description: >
          The investment accounts the document belongs to. Could be account
          numbers in plain strings (e.g. ABCDEFGH01) or Wealthica investment id
          format (e.g. demo:cash:usd). Mutually exclusive with asset.
        items:
          type: string
      asset:
        type: string
        pattern: '^[a-f0-9]{24}$'
        example: 5742b1f7535cf2baba8fff91
        description: >-
          ID of the asset the document belongs to. Mutually exclusive with
          institution & investments.
      date:
        type: string
        format: date-time
        description: The date the document is issued.
      note:
        type: string
        description: |
          Some notes for the item set by the user.
      data:
        type: string
        format: data URI
        maxLength: 20971520
        description: |
          The document file, in base64-encoded data URI.
  NewHistoryEntry:
    type: object
    allOf:
      - type: object
        required:
          - user
          - date
          - currency_value
        properties:
          user:
            type: string
            pattern: '^[a-f0-9]{24}$'
            example: 5742b1f7535cf2baba8fff91
            description: ID of the item's owner user.
          date:
            type: string
            format: date-time
            description: The date the history entry is recorded.
          currency_value:
            type: number
            description: >-
              The value of the investment, asset or liability at the recorded
              date, in its currency.
  UpdateHistoryEntry:
    type: object
    required:
      - currency_value
    properties:
      currency_value:
        type: number
        description: >-
          The value of the investment, asset or liability at the recorded date,
          in its currency.
  HistoryEntry:
    type: object
    description: 'A history entry for an investment, asset or liability.'
    allOf:
      - type: object
        required:
          - _id
          - user
          - date
          - currency_value
          - value
        properties:
          _id:
            type: string
            pattern: '^[a-f0-9]{24}$'
            example: 5742b1f7535cf2baba8fff91
            description: ID of the item within the Wealthica system.
          user:
            type: string
            pattern: '^[a-f0-9]{24}$'
            example: 5742b1f7535cf2baba8fff91
            description: ID of the item's owner user.
          date:
            type: string
            format: date-time
            description: The date the history entry is recorded.
          currency_value:
            type: number
            description: >-
              The value of the investment, asset or liability at the recorded
              date, in its currency.
          value:
            type: number
            description: >-
              The value of the investment, asset or liability at the recorded
              date, converted to user's preferred currency.
  User:
    type: object
    required:
      - id
      - email
      - name
      - first_name
      - last_name
      - banner
      - preferences
      - creation_date
    properties:
      id:
        type: string
        pattern: '^[a-f0-9]{24}$'
        example: 5742b1f7535cf2baba8fff91
        description: ID of the item within the Wealthica system.
      email:
        type: string
        format: email
        description: The user email address.
      name:
        type: string
        description: The user's full name.
      first_name:
        type: string
        description: The user's first name.
      last_name:
        type: string
        description: The user's last name.
      banner:
        type: string
        format: data URI
        maxLength: 102400
        description: >
          [Deprecated] The user's banner image, in base64-encoded data URI. In
          an UPDATE request, sending a `null` value for `banner` will remove the
          image.


          This attribute has been deprecated. Use preferences.banner instead.
      preferences:
        type: object
        required:
          - private_mode
          - hide_switch_user_modal
          - hide_welcome_modal
          - show_deleted_investments
          - notifications
          - currency
        properties:
          private_mode:
            type: boolean
            description: Whether or not to enable Private Mode on login.
          hide_switch_user_modal:
            type: boolean
            description: Whether or not to hide Switch User modal on login.
          hide_welcome_modal:
            type: boolean
            description: Whether or not to hide Welcome modal on login.
          hide_sidebar:
            type: boolean
            description: Whether or not to hide Sidebar.
          show_deleted_investments:
            type: boolean
            description: >-
              Whether or not to show deleted investments/assets/liabilities on
              Dashboard.
          notifications:
            type: object
            description: Notification preferences
            properties:
              suspicious_login:
                type: boolean
                description: >
                  Whether or not to send Suspicious Login and New Browsers
                  notifications.
              sync_failed:
                type: boolean
                description: Whether or not to send sync failed notifications.
              cash_drag:
                type: boolean
                description: Whether or not to send cash drag notifications.
              cash_drag_threshold:
                type: number
                description: >
                  The minimum amount of accumulated cash that triggers cash drag
                  notification.
              new_transactions:
                type: boolean
                description: Whether or not to send new transactions notifications.
              new_transactions_frequency:
                type: string
                enum:
                  - daily
                  - weekly
                  - monthly
                description: >
                  The frequency in which user receives new transactions
                  notifications (if any).
          currency:
            type: string
            enum:
              - aud
              - bbd
              - brl
              - btc
              - cad
              - chf
              - cny
              - dkk
              - eth
              - eur
              - gbp
              - hkd
              - huf
              - ils
              - inr
              - jpy
              - krw
              - mxn
              - nok
              - nzd
              - ron
              - pln
              - aed
              - sek
              - sgd
              - thb
              - twd
              - usd
              - vnd
              - zar
            description: >
              User's preferred currency. This is the currency of all values
              returned in other API requests.
          timezone:
            type: string
            description: >
              User's timezone, in which history data for assets & liabilities
              are recorded.
          banner:
            type: string
            format: data URI
            maxLength: 102400
            description: >
              The user's banner image, in base64-encoded data URI. In an UPDATE
              request, sending a `null` value for `banner` will remove the
              image.
          hide_first_time_connect_notice:
            type: boolean
            default: false
            description: Whether or not to hide Connect Notice modal on connection flow.
      creation_date:
        type: string
        format: date-time
        description: The user creation date.
      sessions:
        type: array
        maxItems: 5
        minItems: 5
        items:
          type: object
          properties:
            _id:
              type: string
              pattern: '^[a-f0-9]{24}$'
              example: 5742b1f7535cf2baba8fff91
              description: ID of the item within the Wealthica system.
            date:
              type: string
              format: date-time
              description: The login time.
            user:
              type: string
              pattern: '^[a-f0-9]{24}$'
              example: 5742b1f7535cf2baba8fff91
              description: ID of the item's owner user.
            browser:
              type: string
              description: The name of the browser the session originated from.
            os:
              type: string
              description: The name of the operating system the session originated from.
            ip:
              type: string
              description: The ip address the session originated from.
            app:
              type: string
              description: AWS Cognito App ID that the session belongs to.
        description: >
          List of 5 most recent login sessions. Only available in GET /users/me
          API.
      new_transactions:
        type: number
        description: >
          The number of new transactions since last getTransactions API call.
          Only available in GET /users/me API.
      new_documents:
        type: number
        description: >
          The number of new documents since last getDocuments API call. Only
          available in GET /users/me API.
      first_login:
        type: boolean
        description: >
          Whether this is the first API call in the life time of the user
          account. Only available in GET /users/me API.
  MinimalUser:
    type: object
    required:
      - id
      - email
      - name
    properties:
      id:
        type: string
        pattern: '^[a-f0-9]{24}$'
        example: 5742b1f7535cf2baba8fff91
        description: ID of the item within the Wealthica system.
      email:
        type: string
        format: email
        description: The user email address.
      name:
        type: string
        description: The user's full name.
  UpdateUser:
    type: object
    properties:
      banner:
        type: string
        format: data URI
        maxLength: 102400
        description: >
          [Deprecated] The user's banner image, in base64-encoded data URI. In
          an UPDATE request, sending a `null` value for `banner` will remove the
          image.


          This attribute has been deprecated. Use preferences.banner instead.
      preferences:
        type: object
        required:
          - private_mode
          - hide_switch_user_modal
          - hide_welcome_modal
          - show_deleted_investments
          - notifications
          - currency
        properties:
          private_mode:
            type: boolean
            description: Whether or not to enable Private Mode on login.
          hide_switch_user_modal:
            type: boolean
            description: Whether or not to hide Switch User modal on login.
          hide_welcome_modal:
            type: boolean
            description: Whether or not to hide Welcome modal on login.
          hide_sidebar:
            type: boolean
            description: Whether or not to hide Sidebar.
          show_deleted_investments:
            type: boolean
            description: >-
              Whether or not to show deleted investments/assets/liabilities on
              Dashboard.
          notifications:
            type: object
            description: Notification preferences
            properties:
              suspicious_login:
                type: boolean
                description: >
                  Whether or not to send Suspicious Login and New Browsers
                  notifications.
              sync_failed:
                type: boolean
                description: Whether or not to send sync failed notifications.
              cash_drag:
                type: boolean
                description: Whether or not to send cash drag notifications.
              cash_drag_threshold:
                type: number
                description: >
                  The minimum amount of accumulated cash that triggers cash drag
                  notification.
              new_transactions:
                type: boolean
                description: Whether or not to send new transactions notifications.
              new_transactions_frequency:
                type: string
                enum:
                  - daily
                  - weekly
                  - monthly
                description: >
                  The frequency in which user receives new transactions
                  notifications (if any).
          currency:
            type: string
            enum:
              - aud
              - bbd
              - brl
              - btc
              - cad
              - chf
              - cny
              - dkk
              - eth
              - eur
              - gbp
              - hkd
              - huf
              - ils
              - inr
              - jpy
              - krw
              - mxn
              - nok
              - nzd
              - ron
              - pln
              - aed
              - sek
              - sgd
              - thb
              - twd
              - usd
              - vnd
              - zar
            description: >
              User's preferred currency. This is the currency of all values
              returned in other API requests.
          timezone:
            type: string
            description: >
              User's timezone, in which history data for assets & liabilities
              are recorded.
          banner:
            type: string
            format: data URI
            maxLength: 102400
            description: >
              The user's banner image, in base64-encoded data URI. In an UPDATE
              request, sending a `null` value for `banner` will remove the
              image.
          hide_first_time_connect_notice:
            type: boolean
            default: false
            description: Whether or not to hide Connect Notice modal on connection flow.
  Preferences:
    type: object
    required:
      - private_mode
      - hide_switch_user_modal
      - hide_welcome_modal
      - show_deleted_investments
      - notifications
      - currency
    properties:
      private_mode:
        type: boolean
        description: Whether or not to enable Private Mode on login.
      hide_switch_user_modal:
        type: boolean
        description: Whether or not to hide Switch User modal on login.
      hide_welcome_modal:
        type: boolean
        description: Whether or not to hide Welcome modal on login.
      hide_sidebar:
        type: boolean
        description: Whether or not to hide Sidebar.
      show_deleted_investments:
        type: boolean
        description: >-
          Whether or not to show deleted investments/assets/liabilities on
          Dashboard.
      notifications:
        type: object
        description: Notification preferences
        properties:
          suspicious_login:
            type: boolean
            description: >
              Whether or not to send Suspicious Login and New Browsers
              notifications.
          sync_failed:
            type: boolean
            description: Whether or not to send sync failed notifications.
          cash_drag:
            type: boolean
            description: Whether or not to send cash drag notifications.
          cash_drag_threshold:
            type: number
            description: >
              The minimum amount of accumulated cash that triggers cash drag
              notification.
          new_transactions:
            type: boolean
            description: Whether or not to send new transactions notifications.
          new_transactions_frequency:
            type: string
            enum:
              - daily
              - weekly
              - monthly
            description: >
              The frequency in which user receives new transactions
              notifications (if any).
      currency:
        type: string
        enum:
          - aud
          - bbd
          - brl
          - btc
          - cad
          - chf
          - cny
          - dkk
          - eth
          - eur
          - gbp
          - hkd
          - huf
          - ils
          - inr
          - jpy
          - krw
          - mxn
          - nok
          - nzd
          - ron
          - pln
          - aed
          - sek
          - sgd
          - thb
          - twd
          - usd
          - vnd
          - zar
        description: >
          User's preferred currency. This is the currency of all values returned
          in other API requests.
      timezone:
        type: string
        description: >
          User's timezone, in which history data for assets & liabilities are
          recorded.
      banner:
        type: string
        format: data URI
        maxLength: 102400
        description: >
          The user's banner image, in base64-encoded data URI. In an UPDATE
          request, sending a `null` value for `banner` will remove the image.
      hide_first_time_connect_notice:
        type: boolean
        default: false
        description: Whether or not to hide Connect Notice modal on connection flow.
  ErrorResponse:
    required:
      - message
    properties:
      message:
        type: string
      code:
        type: integer
