openapi: 3.0.0
info:
  title: Insight API
  contact:
    name: API Integration Support
    email: integration@dintero.com
  description: |
    # Changelog
    All notable changes to the API.

    ## 2025-09-16

    > Add new report configuration endpoint for updating existing report configurations.
    > - [PUT /v1/accounts/{aid}/insight/reports/configuration/{report_configuration_id}](/insight-api/report-configuration/aid_reports_configuration_put)

    ## 2025-05-31

    > Add new KPI endpoint for getting aggregated checkout transaction by status.
    > - [GET /v1/accounts/{aid}/insight/kpi/checkout-transaction-status](/insight-api/kpi/api_insight_checkout_transactions_status_kpis_get)

    > Add new KPI endpoint for getting aggregated checkout transaction events
    > - [GET /v1/accounts/{aid}/insight/kpi/checkout-transaction-events](/insight-api/kpi/api_insight_checkout_transactions_events_kpis_get)

    ## 2025-03-31

    > Extend open transactions report configuration to support csv
    > - [GET /v1/accounts/{aid}/insight/report/configuration](/insight-api/report-configuration/aid_report_configuration_post)

    ## 2024-05-31

    > Add missing response type "Conflict"
    > - [POST /v1/accounts/{aid}/insight/reports/configuration](/insight-api/report-configuration/aid_report_configuration_post)

    ## 2024-05-01

    > Add support for generating Wallets transactions reports and
    > manage Wallets transaction report configuration
    > - [POST /v1/accounts/{aid}/insight/generate-report](/insight-api/generate-insight-report/aid_insight_service_generate_report)
    > - [POST /v1/accounts/{aid}/insight/reports/configuration](/insight-api/report-configuration/aid_report_configuration_post)

    ## 2022-12-13

    > Extend the `reportFilters` parameter to support filtering on `payout_destination_id` for `checkout/transactions`
    > - [POST /v1/accounts/{aid}/insight/reports/configuration](/insight-api/report-configuration/aid_report_configuration_post)

    ## 2022-08-01

    > Extend the `aggregate_functions` query parameter to support `currency`
    > - [GET /v1/accounts/{aid}/insight/kpi/checkout ](/insight-api/kpi/api_insight_checkout_kpis_get)

    ## 2022-05-30

    > Updates made to the endpoint - [GET /v1/accounts/{aid}/insight/report/configuration](/insight-api/report-configuration/aid_report_configuration_post)
    > * Added new type of report configuration for checkout transactions, allowing reports showing open transactions
    > * Added daily schedule option to existing insight transactions report
    ## 2022-05-13

    > Updated the endpoint - [GET /v1/accounts/{aid}/insight/kpi/checkout](/insight-api/kpi/api_insight_checkout_kpis_get)
    > Added new input param `event_created_at_gte` to filter the period to create kpis from.

    ## 2022-05-01

    > Change base path for the API to `/v1/accounts/{aid}/insight/`. The original
    > prefix `/v1/accounts/{aid}/insight-service/` is deprecated.

    ## 2022-03-07

    > Added endpoint for fetching kpis from checkout data \

    ## 2021-12-01

    > Updated Report configuration with the following fields \
    > * Name (custom report name)
    > * Emails (will be used by the reports api to send email containing the final report)
    > * Language
    > * ReportFilters
    > * Added discriminator field to ensure valid report configuration input


    ## 2021-06-29

    > Initial version
  version: LATEST
  license:
    name: UNLICENSED
    url: https://dintero.com
  x-logo:
    url: https://docs.dintero.com/img/dintero-dark-padded.svg
    altText: Dintero Logo
security:
  - JWT: []
tags:
  - name: generate-insight-report
    x-displayName: Generate report
    description: Generate reports from parameters
  - name: report-configuration
    x-displayName: Report configuration
    description: Manage report configurations
  - name: kpi
    x-displayName: KPI
    description: Get KPI data
paths:
  /accounts/{aid}/insight/generate-report:
    post:
      operationId: aid_insight_service_generate_report
      summary: aid_insight_service_generate_report
      description: |
        Create a report from the report params, this bypasses the normal schedule
        report setup and triggers report generation instantly

        The "from" and "to" parameters needs to be populated with values matching
        the provided schedule

        NB! For internal use only!

        **scopes**:
        - admin:insight
        - write:insight
      x-scopes:
        - admin:insight
        - write:insight
      tags:
        - generate-insight-report
      parameters:
        - $ref: '#/components/parameters/accountId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InsightReportParams'
        description: Insight Report Params
        required: true
      responses:
        '200':
          $ref: '#/components/responses/InsightReportParams'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/ServerError'
      x-mint:
        metadata:
          title: Generate report from reportparams
          sidebarTitle: Generate report from reportparams
  /accounts/{aid}/insight/kpi/checkout:
    get:
      operationId: api_insight_checkout_kpis_get
      summary: api_insight_checkout_kpis_get
      description: |
        Get a list of kpis where the transactiosn used is in the aggregations are transactions from "event_created_at_gte",
        until now. However, transactions from the "current" interval are not included.\
        E.g if week is provided as interval, then no transactions from the current week are included. This is true for
        day and month intervals aswell.

        Scopes:
          - read:insight
          - admin:insight
        **deprecated** 2025-05-20
      x-scopes:
        - read:insight
        - admin:insight
      tags:
        - kpi
      parameters:
        - $ref: '#/components/parameters/accountId'
        - name: interval
          in: query
          required: true
          description: |
            The interval over which the data will be aggregated.
          schema:
            type: string
            enum:
              - day
              - week
              - month
        - name: field
          in: query
          required: true
          description: |
            The field (db column) used as source for the kpi, eg, total_amount, vat etc.
          schema:
            type: string
            enum:
              - total_amount
        - name: transaction_status
          in: query
          required: true
          description: |
            Only transactions with this status will be included in the aggregation
          schema:
            type: string
            enum:
              - CAPTURED
              - REFUNDED
              - AUTHORIZED
        - name: aggregate_functions
          in: query
          required: true
          description: |
            The functions applied to the data for every interval.

            - The functions should be provided as a stringified array
            - At least one function must be provided, `currency` must be combined
              with another function

            Available functions:
            - sum
            - avg
            - count
            - currency
          example: '["count","sum","avg","currency"]'
          schema:
            type: string
        - name: event_created_at_gte
          in: query
          required: false
          description: |
            Transaction events with created_at date at or later than this date will be included in the aggregations.\
            If this date parameter is not included, all transactions regardless of creation date are included.\
            NB! This is not the transactions created_at date, this is the date the event was created (e.g AUTHORIZE, CAPTURE etc..)
          schema:
            type: string
      responses:
        '200':
          $ref: '#/components/responses/InsightCheckoutKpisList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/ServerError'
      x-mint:
        metadata:
          title: List checkout kpis
          sidebarTitle: List checkout kpis
  /accounts/{aid}/insight/kpi/checkout-transaction-events:
    get:
      operationId: api_insight_checkout_transactions_events_kpis_get
      summary: api_insight_checkout_transactions_events_kpis_get
      description: |
        Get a list of KPIs where the result is the aggregation of the specified
        event type given provided interval

        Scopes:
          - read:insight
          - admin:insight
      x-scopes:
        - read:insight
        - admin:insight
      tags:
        - kpi
      parameters:
        - $ref: '#/components/parameters/accountId'
        - name: interval
          in: query
          required: true
          description: |
            The interval over which the data will be aggregated.
          schema:
            type: string
            enum:
              - day
        - name: event
          in: query
          required: true
          description: |
            Only transactions with this event type will be included in the aggregation
          schema:
            type: string
            enum:
              - AUTHORIZE
              - CAPTURE
              - REFUND
              - VOID
        - name: created_at_gte
          in: query
          required: true
          description: |
            Filter by event created_at, not when the transaction was created
          schema:
            type: string
      responses:
        '200':
          $ref: '#/components/responses/InsightCheckoutTransactionEventsKPIs'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/ServerError'
      x-mint:
        metadata:
          title: Checkout transaction event KPIs
          sidebarTitle: Checkout transaction event KPIs
  /accounts/{aid}/insight/kpi/checkout-transaction-status:
    get:
      operationId: api_insight_checkout_transactions_status_kpis_get
      summary: api_insight_checkout_transactions_status_kpis_get
      description: |
        Get a list of KPIs where the result is the aggregation of transactions
        where that match provided status

        Scopes:
          - read:insight
          - admin:insight
      x-scopes:
        - read:insight
        - admin:insight
      tags:
        - kpi
      parameters:
        - $ref: '#/components/parameters/accountId'
        - name: interval
          in: query
          required: true
          description: |
            The interval over which the data will be aggregated.
          schema:
            type: string
            enum:
              - day
        - name: status
          in: query
          required: true
          description: |
            Only transactions with this status type will be included in the aggregation
          schema:
            type: string
            enum:
              - AUTHORIZED
        - name: created_at_gte
          in: query
          required: true
          description: |
            Filter by event created_at, not when the transaction was created
          schema:
            type: string
      responses:
        '200':
          $ref: '#/components/responses/InsightCheckoutTransactionEventsKPIs'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/ServerError'
      x-mint:
        metadata:
          title: Checkout transaction status KPIs
          sidebarTitle: Checkout transaction status KPIs
  /accounts/{aid}/insight/reports/configuration:
    get:
      operationId: aid_reports_configuration_get
      summary: aid_reports_configuration_get
      description: |
        List all insight report configurations for the account.

        scopes:
          - read:insight
          - admin:insight
      x-scopes:
        - read:insight
        - admin:insight
      tags:
        - report-configuration
      parameters:
        - $ref: '#/components/parameters/accountId'
      responses:
        '200':
          $ref: '#/components/responses/InsightReportConfigList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/ServerError'
      x-mint:
        metadata:
          title: List insight configurations
          sidebarTitle: List insight configurations
    post:
      operationId: aid_report_configuration_post
      summary: aid_report_configuration_post
      description: |
        Create a new report configuration

        scopes:
          - write:insight
          - admin:insight
      x-scopes:
        - write:insight
        - admin:insight
      tags:
        - report-configuration
      parameters:
        - $ref: '#/components/parameters/accountId'
      requestBody:
        $ref: '#/components/requestBodies/InsightReportConfig'
      responses:
        '200':
          $ref: '#/components/responses/InsightReportConfig'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '500':
          $ref: '#/components/responses/ServerError'
      x-mint:
        metadata:
          title: Create new insight report configuration
          sidebarTitle: Create new insight report configuration
  /accounts/{aid}/insight/reports/configuration/{id}:
    delete:
      operationId: aid_reports_configuration_delete
      summary: aid_reports_configuration_delete
      description: |
        Delete insight report configuration.

        scopes:
          - write:insight
          - admin:insight
      x-scopes:
        - admin:insight
        - write:insight
      tags:
        - report-configuration
      parameters:
        - $ref: '#/components/parameters/accountId'
        - $ref: '#/components/parameters/InsightReportConfigId'
      responses:
        '200':
          $ref: '#/components/responses/DeletedInsightReportConfig'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/ServerError'
      x-mint:
        metadata:
          title: Delete insight report configuration
          sidebarTitle: Delete insight report configuration
    put:
      operationId: aid_reports_configuration_put
      summary: aid_reports_configuration_put
      description: |
        Update insight report configuration.

        Scopes:
          - write:insight
          - admin:insight
      x-scopes:
        - admin:insight
        - write:insight
      tags:
        - report-configuration
      parameters:
        - $ref: '#/components/parameters/accountId'
        - $ref: '#/components/parameters/InsightReportConfigId'
      requestBody:
        $ref: '#/components/requestBodies/InsightReportConfig'
      responses:
        '200':
          $ref: '#/components/responses/InsightReportConfig'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/ServerError'
      x-mint:
        metadata:
          title: Update insight report configuration
          sidebarTitle: Update insight report configuration
x-tagGroups:
  - name: Insight
    tags:
      - generate-insight-report
      - kpi
  - name: Configuration
    tags:
      - report-configuration
servers:
  - url: https://api.dintero.com/v1
components:
  parameters:
    accountId:
      name: aid
      description: |
        An id that uniquely identifies the account.
      in: path
      required: true
      schema:
        type: string
        format: ^[PT]{1}\d{8}$
        minLength: 9
        maxLength: 9
    InsightReportConfigId:
      name: id
      in: path
      required: true
      description: |
        An id that uniquely identifies the insight report configuration.
      schema:
        type: string
  responses:
    InsightReportParams:
      description: Insight report params used to generate report
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InsightReportParams'
    BadRequest:
      description: Bad / Invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ServerError:
      description: Unexpected Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InsightCheckoutKpisList:
      description: Checkout KPIs
      content:
        application/json:
          schema:
            type: array
            items:
              $ref: '#/components/schemas/InsightCheckoutKpis'
    InsightCheckoutTransactionEventsKPIs:
      description: Checkout Transaction events KPIs
      content:
        application/json:
          schema:
            type: array
            items:
              $ref: '#/components/schemas/InsightCheckoutTransactionEventsKPIs'
    InsightReportConfigList:
      description: All insight report configurations for the account
      content:
        application/json:
          schema:
            type: array
            items:
              allOf:
                - $ref: '#/components/schemas/Persisted'
                - $ref: '#/components/schemas/InsightReportConfig'
    InsightReportConfig:
      description: Insight Report Configuration
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Persisted'
              - $ref: '#/components/schemas/InsightReportConfig'
    Conflict:
      description: Conflict
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    DeletedInsightReportConfig:
      description: The deleted report configuration
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Persisted'
              - $ref: '#/components/schemas/InsightReportConfig'
  requestBodies:
    InsightReportConfig:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InsightReportConfig'
      description: Insight Report Configuration
      required: true
  securitySchemes:
    JWT:
      type: http
      description: |
        Bearer authentication (token authentication) should be used for accessing the API.

        Use [Get Token](/api-reference/authenticate/aid_auths_oauth_token_post) to get an access token for client credentials.
        Pass the token in the request header:

            Authorization: Bearer {access_token}

        where the **access_token** is JSON Web Tokens (JWT).
      scheme: bearer
      bearerFormat: JWT
  schemas:
    InsightCheckoutTransactionsReportParams:
      x-discriminator-value: checkout/transactions
      type: object
      allOf:
        - $ref: '#/components/schemas/InsightReportParamsBase'
        - type: object
          required:
            - dataType
            - language
            - schedule
          properties:
            dataType:
              type: string
              enum:
                - checkout/transactions
            schedule:
              type: string
              description: Schedule for the report, how often will the report be generated
              enum:
                - monthly
                - weekly
                - daily
            language:
              type: string
              description: Report Language
              enum:
                - 'no'
                - en
            reportFilters:
              type: array
              description: List of filters used to filter the data for the report. Similar to SQL WHERE-clause. i.e, WHERE filter=value
              items:
                $ref: '#/components/schemas/InsightTransactionReportFilter'
            contentType:
              type: string
              description: Content type for the report
              enum:
                - application/pdf
                - text/csv
      title: checkout/transactions
    InsightCheckoutTransactionsReportConfig:
      x-discriminator-value: checkout/transactions
      type: object
      allOf:
        - $ref: '#/components/schemas/InsightReportConfigBase'
        - type: object
          required:
            - dataType
            - language
            - schedule
          properties:
            dataType:
              type: string
              enum:
                - checkout/transactions
            schedule:
              type: string
              description: Schedule for the report, how often will the report be generated
              enum:
                - monthly
                - weekly
                - daily
            language:
              type: string
              description: Report Language
              enum:
                - 'no'
                - en
            reportFilters:
              type: array
              description: List of filters used to filter the data for the report. Similar to SQL WHERE-clause. i.e, WHERE filter=value
              items:
                $ref: '#/components/schemas/InsightTransactionReportFilter'
            contentTypes:
              type: array
              description: Content types for the report
              items:
                type: string
                enum:
                  - application/pdf
                  - text/csv
      title: checkout/transactions
    InsightCheckoutOpenTransactionsReportConfig:
      x-discriminator-value: checkout/transactions/open
      type: object
      allOf:
        - $ref: '#/components/schemas/InsightReportConfigBase'
        - type: object
          required:
            - dataType
            - language
            - schedule
          properties:
            dataType:
              type: string
              enum:
                - checkout/transactions/open
            schedule:
              type: string
              description: Schedule for the report, how often will the report be generated
              enum:
                - monthly
                - weekly
                - daily
            language:
              type: string
              description: Report Language
              enum:
                - 'no'
                - en
            reportFilters:
              type: array
              description: List of filters used to filter the data for the report. Similar to SQL WHERE-clause. i.e, WHERE filter=value
              items:
                $ref: '#/components/schemas/InsightOpenTransactionReportFilter'
            contentTypes:
              type: array
              description: Content types for the report
              items:
                type: string
                enum:
                  - application/pdf
                  - text/csv
      title: checkout/transactions/open
    InsightOrdersOrderOperationsReportParams:
      x-discriminator-value: orders/orderoperations
      type: object
      allOf:
        - $ref: '#/components/schemas/InsightReportParamsBase'
        - type: object
          required:
            - dataType
            - language
            - schedule
          properties:
            dataType:
              type: string
              enum:
                - orders/orderoperations
            schedule:
              type: string
              description: Schedule for the report, how often will the report be generated
              enum:
                - weekly
                - twice-a-month
                - daily
            language:
              type: string
              description: Report Language
              enum:
                - 'no'
                - en
            reportFilters:
              type: array
              description: List of filters used to filter the data for the report. Similar to SQL WHERE-clause. i.e, WHERE filter=value
              items:
                $ref: '#/components/schemas/InsightOrderReportFilter'
            contentType:
              type: string
              description: Content type for the report
              enum:
                - text/csv
      title: orders/orderoperations
    InsightOrdersOrderOperationsReportConfig:
      x-discriminator-value: orders/orderoperations
      type: object
      allOf:
        - $ref: '#/components/schemas/InsightReportConfigBase'
        - type: object
          required:
            - dataType
            - language
            - schedule
          properties:
            dataType:
              type: string
              enum:
                - orders/orderoperations
            schedule:
              type: string
              description: Schedule for the report, how often will the report be generated
              enum:
                - weekly
                - twice-a-month
                - daily
            language:
              type: string
              description: Report Language
              enum:
                - 'no'
                - en
            reportFilters:
              type: array
              description: List of filters used to filter the data for the report. Similar to SQL WHERE-clause. i.e, WHERE filter=value
              items:
                $ref: '#/components/schemas/InsightOrderReportFilter'
            contentTypes:
              type: array
              description: Content types for the report
              items:
                type: string
                enum:
                  - text/csv
      title: orders/orderoperations
    InsightWalletsTransactionsReportParams:
      x-discriminator-value: wallets/transactions
      type: object
      allOf:
        - $ref: '#/components/schemas/InsightReportParamsBase'
        - type: object
          required:
            - dataType
            - language
            - schedule
          properties:
            dataType:
              type: string
              enum:
                - wallets/transactions
            schedule:
              type: string
              description: Schedule for the report, how often will the report be generated
              enum:
                - monthly
                - weekly
                - daily
            language:
              type: string
              description: Report Language
              enum:
                - 'no'
                - en
            contentType:
              type: string
              description: Content type for the report
              enum:
                - application/pdf
                - text/csv
      title: wallets/transactions
    InsightWalletsTransactionsReportConfig:
      x-discriminator-value: wallets/transactions
      type: object
      allOf:
        - $ref: '#/components/schemas/InsightReportConfigBase'
        - type: object
          required:
            - dataType
            - language
            - schedule
          properties:
            dataType:
              type: string
              enum:
                - wallets/transactions
            schedule:
              type: string
              description: Schedule for the report, how often will the report be generated
              enum:
                - monthly
                - weekly
                - daily
            language:
              type: string
              description: Report Language
              enum:
                - 'no'
                - en
            contentTypes:
              type: array
              description: Content types for the report
              items:
                type: string
                enum:
                  - application/pdf
                  - text/csv
      title: wallets/transactions
    InsightReportParams:
      discriminator:
        propertyName: dataType
        mapping:
          checkout/transactions: '#/components/schemas/InsightCheckoutTransactionsReportParams'
          orders/orderoperations: '#/components/schemas/InsightOrdersOrderOperationsReportParams'
          wallets/transactions: '#/components/schemas/InsightWalletsTransactionsReportParams'
      oneOf:
        - $ref: '#/components/schemas/InsightCheckoutTransactionsReportParams'
        - $ref: '#/components/schemas/InsightOrdersOrderOperationsReportParams'
        - $ref: '#/components/schemas/InsightWalletsTransactionsReportParams'
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - message
          properties:
            code:
              type: string
              description: The code used to identify the error/warning
            errors:
              type: array
              description: The nested error(s) encountered during validation
              items:
                type: object
            message:
              type: string
              description: The human readable description of the error/warning
    InsightCheckoutKpis:
      type: object
      required:
        - kpi_name
        - values
      properties:
        kpi_name:
          enum:
            - avg
            - sum
            - count
        values:
          type: array
          items:
            type: object
            required:
              - value
              - date
            properties:
              currency:
                type: string
                description: |
                  Included if the aggregate_function included `currency`
                example: NOK
              value:
                type: number
                description: |
                  result of applying the aggregate_function for one period defined by
                  the aggregate_level
              date:
                type: string
                format: date-time
                description: |
                  Either the date for the aggregated data(when interval is day)
                  otherwise the first date of the period used to aggregate data
                  (week/month)
    InsightCheckoutTransactionEventsKPIs:
      type: object
      required:
        - interval
        - values
      properties:
        interval:
          type: string
          enum:
            - day
        values:
          description: Interval where the count is zero is excluded from the result
          type: array
          items:
            type: object
            required:
              - payment_product_type
              - currency
              - count
              - avg_amount
              - sum_amount
              - date
            properties:
              payment_product_type:
                type: string
                example: dintero_psp.creditcard
              currency:
                type: string
                example: NOK
              count:
                type: integer
                description: Event count given the interval
                minimum: 1
                example: 40
              avg_amount:
                type: integer
                description: |
                  Average event amount given the interval in minor units
                minimum: 1
                example: 19995
              sum_amount:
                type: integer
                description: |
                  Sum of event amount given the interval in minor units
                minimum: 1
                example: 799810
              date:
                type: string
                description: |
                  The date field in the response represents the UTC calendar date
                  derived from each event's created_at timestamp after converting it to UTC

                  As a result, depending on your local time zone, events that appear to span
                  midnight locally may be aggregated under a single UTC date or split across
                  two UTC dates.
                format: date
    Persisted:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: |
            An UUID that uniquely identifies the resource
          readOnly: true
        accountId:
          type: string
          format: uuid
          description: |
            An id that uniquely identifies the account
          readOnly: true
        created_at:
          type: string
          format: date-time
          description: |
            The date-time when the resource was created
          readOnly: true
        created_by:
          type: string
          example: 1c92f7e1-2897-4d46-bdcc-c127a914fb4e
          description: |
            The ID of the user/client that created the resource
          readOnly: true
    InsightReportConfig:
      discriminator:
        propertyName: dataType
        mapping:
          checkout/transactions: '#/components/schemas/InsightCheckoutTransactionsReportConfig'
          checkout/transactions/open: '#/components/schemas/InsightCheckoutOpenTransactionsReportConfig'
          orders/orderoperations: '#/components/schemas/InsightOrdersOrderOperationsReportConfig'
          wallets/transactions: '#/components/schemas/InsightWalletsTransactionsReportConfig'
      oneOf:
        - $ref: '#/components/schemas/InsightCheckoutTransactionsReportConfig'
        - $ref: '#/components/schemas/InsightCheckoutOpenTransactionsReportConfig'
        - $ref: '#/components/schemas/InsightOrdersOrderOperationsReportConfig'
        - $ref: '#/components/schemas/InsightWalletsTransactionsReportConfig'
    InsightTransactionReportFilter:
      type: object
      required:
        - filter
        - value
      properties:
        filter:
          type: string
          enum:
            - store_id
            - payout_destination_id
          description: The property the data will be filtered on
        value:
          type: string
          description: The value used to filter the data on
    InsightOpenTransactionReportFilter:
      type: object
      required:
        - filter
        - value
      properties:
        filter:
          type: string
          enum:
            - store_id
            - older_than_days
          description: The property the data will be filtered on
        value:
          type: string
          description: The value used to filter the data on
    InsightOrderReportFilter:
      type: object
      properties:
        filter:
          type: string
          enum:
            - operation_payout_destination
          description: The "field/column" the data will be filtered on
        value:
          type: string
          description: The value the records must contain for the provided filter (field/column)
    InsightReportParamsBase:
      type: object
      properties:
        dataType:
          type: string
          description: Service (source) and type of data used to create the report
          enum:
            - checkout/transactions
            - checkout/transactions/open
            - orders/orderoperations
            - wallets/transactions
        name:
          type: string
          description: Custom name of the report. Will be shown in report listing and in the report filename
          maxLength: 64
        emails:
          type: array
          description: Emails will receive auto-generated report (or link to report if the report is to large)
          items:
            type: string
        from:
          type: string
          format: date-time
          description: |
            The start of the data interval, must adhere to ISO 8601 dateformat (YYYY-MM-DD)
        to:
          type: string
          format: date-time
          description: |
            The end of the data interval, must adhere to ISO 8601 dateformat (YYYY-MM-DD)
      required:
        - name
        - from
        - to
    InsightReportConfigBase:
      type: object
      properties:
        dataType:
          type: string
          description: Service (source) and type of data used to create the report
          enum:
            - checkout/transactions
            - checkout/transactions/open
            - orders/orderoperations
            - wallets/transactions
        name:
          type: string
          description: Custom name of the report. Will be shown in report listing and in the report filename
          maxLength: 64
        emails:
          type: array
          description: Emails will receive auto-generated report (or link to report if the report is to large)
          items:
            type: string
      required:
        - name
