Lean Technologies Enrichment API

The Enrichment API from Lean Technologies — 2 operation(s) for enrichment.

OpenAPI Specification

lean-technologies-enrichment-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Consents Account On File Account Controls (New) Account Controls (New) Enrichment API
  version: v0.2.3
servers:
- url: https://sandbox.leantech.me
  description: Sandbox
- url: https://api2.leantech.me
  description: Production
security:
- bearerAuth: []
tags:
- name: Enrichment
paths:
  /insights/v2/income:
    post:
      summary: Get Income
      deprecated: false
      description: Provides insights on the salary and non-salary income received in the bank account.
      operationId: getIncome
      tags:
      - Enrichment
      parameters:
      - name: async
        in: query
        description: When true the API will only return a results_id which can be fetched from the /results endpoint when ready.
        required: false
        schema:
          type: boolean
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                estimated_monthly_income:
                  type: number
                  description: 'Monthly income for the user that you have gathered from another source (e.g.: reported by the user).'
                start_date:
                  type: string
                  description: The start date in UTC (in the format YYYY-MM-DD) you want to query transactions for. If not provided, we will default to 6 months before now.
                  format: date
                entity_id:
                  type: string
                  description: The `entity_id` you are querying for. The entity needs to have permissions for `accounts` and `transactions`.
                  format: uuid
                income_type:
                  type: string
                  enum:
                  - ALL
                  - SALARY
                  - NON-SALARY
                  description: If you want to get salary or non-salary income or both. If you do not provide any value, it will default to ALL.
              required:
              - estimated_monthly_income
              - start_date
              - entity_id
              - income_type
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                    - OK
                    - PENDING
                    - FAILED
                    - CONSENT_EXPIRED
                  message:
                    type: string
                  timestamp:
                    type: string
                  insights:
                    type: object
                    properties:
                      salary:
                        properties:
                          currency:
                            type: string
                            description: The 3 Letter ISO code denominating the currency that the salary is provided in. This will be local currency.
                          total:
                            type: object
                            properties:
                              count:
                                type: integer
                                description: Number of salary payments since start_date.
                              amount:
                                type: number
                                description: Total salary since start_date.
                              first_date_time:
                                type: string
                                description: UTC datetime of first salary payment since start_date.
                                format: date-time
                              last_date_time:
                                type: string
                                description: UTC datetime of last salary payment.
                                format: date-time
                              average_monthly_count:
                                type: number
                                description: Average number of salary payments per month since start_date.
                              average_monthly_amount:
                                type: number
                                description: Average salary amount received per month since start_date.
                              minimum_monthly_amount:
                                type: object
                                properties:
                                  month:
                                    type: integer
                                    description: 'Number of month within the year (e.g.: January is represented as 1 and December is represented as 12)'
                                  year:
                                    type: integer
                                  amount:
                                    type: number
                                    description: Total salary for the month
                                description: Minimum salary amount received in a month since start_date and month when this happened.
                                required:
                                - month
                                - year
                                - amount
                              maximum_monthly_amount:
                                type: object
                                properties:
                                  month:
                                    type: integer
                                  year:
                                    type: integer
                                  amount:
                                    type: number
                                    description: Total salary for the month
                                description: Maximum salary amount received in a month since start_date and month when this happened.
                                required:
                                - month
                                - year
                                - amount
                            description: Insights on the salaries received since `start_date`
                            required:
                            - count
                            - amount
                            - first_date_time
                            - last_date_time
                            - average_monthly_count
                            - average_monthly_amount
                            - minimum_monthly_amount
                            - maximum_monthly_amount
                          monthly_totals:
                            type: array
                            items:
                              type: object
                              properties:
                                month:
                                  type: integer
                                  description: 'Number of month within the year (e.g.: January is represented as 1 and December is represented as 12)'
                                year:
                                  type: integer
                                amount:
                                  type: number
                                  description: Total salary for the month.
                                count:
                                  type: integer
                                  description: Number of salary transaction detected within the month.
                                is_month_complete:
                                  type: boolean
                                  description: Determines if Lean retrieved the data for all days for the month. This will always be `true`, except for the first and last month retrieved.
                              required:
                              - month
                              - year
                              - amount
                              - count
                              - is_month_complete
                          transactions:
                            type: string
                        required:
                        - currency
                        - total
                        - monthly_totals
                        - transactions
                        $ref: '#/components/schemas/IncomeResponse'
                      non_salary:
                        properties:
                          currency:
                            type: string
                            description: The 3 Letter ISO code denominating the currency that the salary is provided in. This will be local currency.
                          total:
                            type: object
                            properties:
                              count:
                                type: integer
                                description: Number of salary payments since start_date.
                              amount:
                                type: number
                                description: Total salary since start_date.
                              first_date_time:
                                type: string
                                description: UTC datetime of first salary payment since start_date.
                                format: date-time
                              last_date_time:
                                type: string
                                description: UTC datetime of last salary payment.
                                format: date-time
                              average_monthly_count:
                                type: number
                                description: Average number of salary payments per month since start_date.
                              average_monthly_amount:
                                type: number
                                description: Average salary amount received per month since start_date.
                              minimum_monthly_amount:
                                type: object
                                properties:
                                  month:
                                    type: integer
                                    description: 'Number of month within the year (e.g.: January is represented as 1 and December is represented as 12)'
                                  year:
                                    type: integer
                                  amount:
                                    type: number
                                    description: Total salary for the month
                                description: Minimum salary amount received in a month since start_date and month when this happened.
                                required:
                                - month
                                - year
                                - amount
                              maximum_monthly_amount:
                                type: object
                                properties:
                                  month:
                                    type: integer
                                  year:
                                    type: integer
                                  amount:
                                    type: number
                                    description: Total salary for the month
                                description: Maximum salary amount received in a month since start_date and month when this happened.
                                required:
                                - month
                                - year
                                - amount
                            description: Insights on the salaries received since `start_date`
                            required:
                            - count
                            - amount
                            - first_date_time
                            - last_date_time
                            - average_monthly_count
                            - average_monthly_amount
                            - minimum_monthly_amount
                            - maximum_monthly_amount
                          monthly_totals:
                            type: array
                            items:
                              type: object
                              properties:
                                month:
                                  type: integer
                                  description: 'Number of month within the year (e.g.: January is represented as 1 and December is represented as 12)'
                                year:
                                  type: integer
                                amount:
                                  type: number
                                  description: Total salary for the month.
                                count:
                                  type: integer
                                  description: Number of salary transaction detected within the month.
                                is_month_complete:
                                  type: boolean
                                  description: Determines if Lean retrieved the data for all days for the month. This will always be `true`, except for the first and last month retrieved.
                              required:
                              - month
                              - year
                              - amount
                              - count
                              - is_month_complete
                          transactions:
                            type: string
                        required:
                        - currency
                        - total
                        - monthly_totals
                        - transactions
                        $ref: '#/components/schemas/IncomeResponse'
                    required:
                    - salary
                    - non_salary
                required:
                - status
                - message
                - timestamp
                - insights
              example:
                status: OK
                message: Data successfully retrieved
                timestamp: '2023-10-20T07:59:14.304154468Z'
                insights:
                  salary:
                    currency: AED
                    total:
                      amount: 18000
                      count: 1
                      last_date_time: '2023-08-25T11:18:25Z'
                      first_date_time: '2023-08-25T11:18:25Z'
                      average_monthly_amount: 18000
                      average_monthly_count: 1
                      maximum_monthly_amount:
                        month: 8
                        year: 2023
                        amount: 18000
                      minimum_monthly_amount:
                        month: 8
                        year: 2023
                        amount: 18000
                    monthly_totals:
                    - month: 10
                      year: 2023
                      amount: 0
                      count: 0
                      is_month_complete: false
                    - month: 9
                      year: 2023
                      amount: 0
                      count: 0
                      is_month_complete: true
                    - month: 8
                      year: 2023
                      amount: 18000
                      count: 1
                      is_month_complete: false
                    transactions:
                    - account_id: 571e3eec-35f3-4158-b54d-015a5c08474e
                      transaction_id: 11747f8c-b6c9-47ca-afad-a651a2c912c9
                      transaction_information: 'incoming inward TT REF: HFT2323772535 /REF/AUGSAL'
                      booking_date_time: '2023-08-25T11:18:25Z'
                      amount: 18000
          headers: {}
      security:
      - bearer: []
  /insights/v2/expenses:
    get:
      summary: Get Expenses
      deprecated: false
      description: Provides insights on the expenses from a bank account (only supported for retail bank accounts).
      operationId: getExpenses
      tags:
      - Enrichment
      parameters:
      - name: async
        in: query
        description: When true the API will only return a results_id which can be fetched from the /results endpoint when ready.
        required: false
        example: 'false'
        schema:
          type: boolean
      - name: start_date
        in: query
        description: The start date in UTC (in the format YYYY-MM-DD) you want to query expenses for.
        required: false
        example: '2023-05-01'
        schema:
          type: string
          format: date
      - name: entity_id
        in: query
        description: The entity_id you're querying for.
        required: false
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                    - OK
                    - PENDING
                    - FAILED
                    - CONSENT_EXPIRED
                  message:
                    type: string
                  timestamp:
                    type: string
                  insights:
                    type: object
                    properties:
                      currency:
                        type: string
                        description: The 3 Letter ISO code denominating the currency that the salary is provided in.
                      total:
                        type: object
                        properties:
                          amount:
                            type: number
                            description: Total expenses since start_date.
                          count:
                            type: integer
                            description: Number of expenses transactions since start_date.
                          last_date_time:
                            type: string
                            description: UTC datetime of last expense transaction.
                          first_date_time:
                            type: string
                            description: UTC datetime of first expense transaction since start_date.
                          average_monthly_amount:
                            type: number
                            description: Average expenses amount per month since start_date.
                          average_monthly_count:
                            type: number
                            description: Average number of expenses transactions per month since start_date.
                          maximum_monthly_amount:
                            type: object
                            properties:
                              month:
                                type: integer
                              year:
                                type: integer
                              amount:
                                type: number
                            required:
                            - month
                            - year
                            - amount
                            description: Maximum expenses amount in a month since start_date and month when this happened.
                          minimum_monthly_amount:
                            type: object
                            properties:
                              month:
                                type: integer
                              year:
                                type: integer
                              amount:
                                type: number
                            required:
                            - month
                            - year
                            - amount
                            description: Minimum expenses amount in a month since start_date and month when this happened.
                          breakdown:
                            type: array
                            items:
                              type: object
                              properties:
                                by:
                                  type: string
                                  description: Criteria by which we are breakdowning down the expenses.
                                  enum:
                                  - category
                                breakdowns:
                                  type: array
                                  items:
                                    type: object
                                    properties:
                                      category:
                                        type: string
                                        description: The category of the expenses.
                                        enum:
                                        - BANK_FEES_AND_CHARGES
                                        - CHARITY
                                        - EDUCATION
                                        - ENTERTAINMENT
                                        - GOVERNMENT
                                        - GROCERIES
                                        - HEALTH_AND_WELLBEING
                                        - LOANS_AND_INVESTMENTS
                                        - RENT_AND_SERVICES
                                        - RESTAURANTS_DINING
                                        - RETAIL
                                        - TRANSFER
                                        - TRANSPORT
                                        - TRAVEL
                                        - OTHER
                                      amount:
                                        type:
                                        - number
                                        - integer
                                        description: Total expenses for the month.
                                      count:
                                        type: integer
                                        description: Number of expenses transactions for the month.
                                      fraction_of_total_expenses:
                                        type: number
                                        description: Fraction of the total expenses that this category represents for the month.
                                      average_days_between_transactions:
                                        type: number
                                      last_date_time:
                                        type: string
                                      first_date_time:
                                        type: string
                                      average_monthly_amount:
                                        type: number
                                      average_monthly_count:
                                        type:
                                        - integer
                                        - number
                                      maximum_monthly_amount:
                                        type: object
                                        properties:
                                          month:
                                            type: integer
                                          year:
                                            type: integer
                                          amount:
                                            type:
                                            - number
                                            - integer
                                        required:
                                        - month
                                        - year
                                        - amount
                                      minimum_monthly_amount:
                                        type: object
                                        properties:
                                          month:
                                            type: integer
                                          year:
                                            type: integer
                                          amount:
                                            type:
                                            - number
                                            - integer
                                        required:
                                        - month
                                        - year
                                        - amount
                                    required:
                                    - category
                                    - amount
                                    - count
                                    - fraction_of_total_expenses
                                    - average_days_between_transactions
                                    - last_date_time
                                    - first_date_time
                                    - average_monthly_amount
                                    - average_monthly_count
                                    - maximum_monthly_amount
                                    - minimum_monthly_amount
                                  description: Breakdown of the expenses by category.
                            description: Breakdown of expenses by category.
                        required:
                        - amount
                        - count
                        - last_date_time
                        - first_date_time
                        - average_monthly_amount
                        - average_monthly_count
                        - maximum_monthly_amount
                        - minimum_monthly_amount
                        - breakdown
                        description: Insights on the expenses since start_date.
                      monthly_totals:
                        type: array
                        items:
                          type: object
                          properties:
                            month:
                              type: integer
                            year:
                              type: integer
                            amount:
                              type:
                              - number
                              - integer
                            count:
                              type: integer
                            is_month_complete:
                              type: boolean
                            breakdown:
                              type: array
                              items:
                                type: object
                                properties:
                                  by:
                                    type: string
                                  breakdowns:
                                    type: array
                                    items:
                                      type: object
                                      properties:
                                        category:
                                          type: string
                                        amount:
                                          type:
                                          - number
                                          - integer
                                        count:
                                          type: integer
                                        fraction_of_total_expenses:
                                          type:
                                          - number
                                          - integer
                                      required:
                                      - category
                                      - amount
                                      - count
                                      - fraction_of_total_expenses
                                required:
                                - by
                                - breakdowns
                          required:
                          - month
                          - year
                          - amount
                          - count
                          - is_month_complete
                          - breakdown
                    required:
                    - currency
                    - total
                    - monthly_totals
                required:
                - status
                - message
                - timestamp
                - insights
              example:
                status: OK
                message: The request completed successfully.
                timestamp: '2023-10-20T08:40:40.392167892Z'
                meta: {}
                insights:
                  currency: AED
                  total:
                    amount: 327110.87
                    count: 423
                    last_date_time: '2023-10-18T16:26:26Z'
                    first_date_time: '2023-05-01T17:22:17Z'
                    average_monthly_amount: 54518.48
                    average_monthly_count: 70.5
                    maximum_monthly_amount:
                      month: 6
                      year: 2023
                      amount: 124948.66
                    minimum_monthly_amount:
                      month: 7
                      year: 2023
                      amount: 3418.33
                    breakdown:
                    - by: category
                      breakdowns:
                      - category: OTHER
                        amount: 64427.96
                        count: 72
                        fraction_of_total_expenses: 0.2
                        average_days_between_transactions: 2.3661921296296295
                        last_date_time: '2023-10-18T04:02:29Z'
                        first_date_time: '2023-05-03T04:02:46Z'
                        average_monthly_amount: 10737.99
                        average_monthly_count: 12
                        maximum_monthly_amount:
                          month: 9
                          year: 2023
                          amount: 21265.28
                        minimum_monthly_amount:
                          month: 7
                          year: 2023
                          amount: 164.4
                      - category: RESTAURANTS_DINING
                        amount: 7964.15
                        count: 49
                        fraction_of_total_expenses: 0.02
                        average_days_between_transactions: 3.4500462962962963
                        last_date_time: '2023-10-14T07:50:12Z'
                        first_date_time: '2023-05-01T17:22:17Z'
                        average_monthly_amount: 1327.36
                        average_monthly_count: 8.166666666666666
                        maximum_monthly_amount:
                          month: 5
                          year: 2023
                          amount: 2566.6
                        minimum_monthly_amount:
                          month: 10
                          year: 2023
                          amount: 222.81
                      - category: TRANSPORT
                        amount: 8288.46
                        count: 141
                        fraction_of_total_expenses: 0.03
                        average_days_between_transactions: 1.2027893518518518
                        last_date_time: '2023-10-18T04:14:01Z'
                        first_date_time: '2023-05-02T18:50:50Z'
                        average_monthly_amount: 1381.41
                        average_monthly_count: 23.5
                        maximum_monthly_amount:
                          month: 5
                          year: 2023
                          amount: 2339.08
                        minimum_monthly_amount:
                          month: 7
                          year: 2023
                          amount: 181.5
                      - category: LOAN
                        amount: 90800
                        count: 5
                        fraction_of_total_expenses: 0.28
                        average_days_between_transactions: 30.997974537037038
                        last_date_time: '2023-09-25T00:09:44Z'
                        first_date_time: '2023-05-24T00:21:23Z'
                        average_monthly_amount: 15133.

# --- truncated at 32 KB (54 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/lean-technologies/refs/heads/main/openapi/lean-technologies-enrichment-api-openapi.yml