Lean Technologies Accounts Raw Data API

The Accounts Raw Data API from Lean Technologies — 1 operation(s) for accounts raw data.

OpenAPI Specification

lean-technologies-accounts-raw-data-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Consents Account On File Account Controls (New) Account Controls (New) Accounts Raw Data API
  version: v0.2.3
servers:
- url: https://sandbox.leantech.me
  description: Sandbox
- url: https://api2.leantech.me
  description: Production
security:
- bearerAuth: []
tags:
- name: Accounts Raw Data
  x-displayName: Accounts Raw Data
paths:
  /data/v2/accounts:
    servers: []
    get:
      operationId: fetchAccountsV2
      summary: Get Accounts
      description: "The Get Accounts endpoint retrieves a list of bank accounts that have been linked by a user via LinkSDK, identified by their entity_id.\nEach account object contains fields such as account_id, account status, currency, account_sub_type, account identifiers (such as IBAN, ACCOUNT_NUMBER, and NATIONAL_ID) and other data points related accounts. \nYou can use the resulting account_ids to query additional financial data through other Lean APIs such as transactions, balances, beneficiaries, and other data APIs.\n"
      parameters:
      - $ref: '#/components/parameters/AsyncParameter'
      - $ref: '#/components/parameters/PageParameter'
      - $ref: '#/components/parameters/SizeParameter'
      - $ref: '#/components/parameters/EntityIdParameter'
      - $ref: '#/components/parameters/MetaParameter'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountsRequestResultV2'
              examples:
                GetAccounts_V2_KSA_Example:
                  summary: Successful get accounts - KSA
                  value:
                    status: OK
                    results_id: 81bac9e7-e51b-45bd-b660-a7557b286642
                    message: Data successfully retrieved
                    meta: null
                    timestamp: '2025-09-11T19:02:04.447189646Z'
                    status_detail: {}
                    data:
                      type: accounts
                      accounts:
                      - entity_id: 550e8400-e29b-41d4-a716-446655440000
                        account_id: 7c8a9f12-3456-4abc-b123-9876543210ab
                        account_holder_name: Ahmed Abdullah
                        account_holder_short_name: Ahmed
                        status: ENABLED
                        status_update_date_time: '2025-08-01T10:30:00.000Z'
                        currency: SAR
                        account_type: PERSONAL
                        account_sub_type: CURRENT
                        nickname: Main Account
                        description: Personal current account
                        opening_date: '2023-01-15'
                        maturity_date: null
                        account:
                        - scheme_name: IBAN
                          identification: SA4420000001234567891234
                          name: Ahmed Abdullah
                        - scheme_name: BBAN
                          identification: '20000001234567891234'
                          name: Ahmed Abdullah
                        servicer:
                          scheme_name: BICFI
                          identification: RIBLSARI
                      - entity_id: 550e8400-e29b-41d4-a716-446655440000
                        account_id: 9d2e4f56-7890-4bcd-e345-fedcba987654
                        account_holder_name: Ahmed Abdullah
                        account_holder_short_name: Ahmed
                        status: ENABLED
                        status_update_date_time: '2025-07-15T14:20:00.000Z'
                        currency: SAR
                        account_type: PERSONAL
                        account_sub_type: SAVINGS
                        nickname: Savings Account
                        description: Personal savings account
                        opening_date: '2023-03-20'
                        maturity_date: null
                        account:
                        - scheme_name: IBAN
                          identification: SA8830000009876543210987
                          name: Ahmed Abdullah
                        - scheme_name: BBAN
                          identification: '30000009876543210987'
                          name: Ahmed Abdullah
                        servicer:
                          scheme_name: BICFI
                          identification: RIBLSARI
                      page:
                        number: 0
                        size: 100
                        total_elements: 2
                        total_pages: 1
                    type: accounts
                    refreshed_at: '2025-08-07T12:10:15.643Z'
                GetAccounts_V2_UAE_Example:
                  summary: Successful get accounts - UAE
                  value:
                    status: OK
                    results_id: c7f9cb2c-1ad0-402f-b0b9-a6eadbcd4817
                    message: Data successfully retrieved
                    meta: null
                    timestamp: '2025-08-28T11:28:56.547000863Z'
                    status_detail: null
                    data:
                      type: accounts
                      accounts:
                      - entity_id: 550e8400-e29b-41d4-a716-446655440000
                        account_id: a1b2c3d4-5678-90ef-a123-1234567890ab
                        account_holder_name: Mohammed Ahmed
                        account_holder_short_name: Mohammed
                        status: ENABLED
                        status_update_date_time: '2025-08-15T09:45:00.000Z'
                        currency: AED
                        account_type: PERSONAL
                        account_sub_type: CURRENT
                        nickname: Primary Account
                        description: Main current account
                        opening_date: '2022-06-10'
                        maturity_date: null
                        account:
                        - scheme_name: IBAN
                          identification: AE070331234567890123456
                          name: Mohammed Ahmed Al-Maktoum
                        - scheme_name: BBAN
                          identification: 0331234567890123456
                          name: Mohammed Ahmed
                        servicer:
                          scheme_name: BICFI
                          identification: EBILAEAD
                      - entity_id: 550e8400-e29b-41d4-a716-446655440000
                        account_id: b2c3d4e5-6789-01fa-b234-234567890bcd
                        account_holder_name: Mohammed Ahmed
                        account_holder_short_name: Mohammed
                        status: ENABLED
                        status_update_date_time: '2025-07-20T16:30:00.000Z'
                        currency: AED
                        account_type: PERSONAL
                        account_sub_type: SAVINGS
                        nickname: Savings Account
                        description: Personal savings account
                        opening_date: '2022-09-25'
                        maturity_date: null
                        account:
                        - scheme_name: IBAN
                          identification: AE230331987654321098765
                          name: Mohammed Ahmed
                        - scheme_name: BBAN
                          identification: 0331987654321098765
                          name: 'Mohammed Ahmed '
                        servicer:
                          scheme_name: BICFI
                          identification: EBILAEAD
                      page:
                        number: 0
                        size: 100
                        total_elements: 2
                        total_pages: 1
                    type: accounts
                    refreshed_at: '2025-08-28T11:17:25.347Z'
                BankIssueV2Example:
                  $ref: '#/components/examples/BankIssueV2Example'
        '202':
          description: Accepted (Asynchronous request) when async=true
          content:
            application/json:
              examples:
                GetAccountsV2AsyncExample:
                  $ref: '#/components/examples/AsyncProcessingV2Example'
        '400':
          description: Bad Request
          content:
            application/json:
              examples:
                InvalidParametersExample:
                  $ref: '#/components/examples/InvalidParametersExample'
        '404':
          description: Entity not found
          content:
            application/json:
              examples:
                UnknownEntityExample:
                  $ref: '#/components/examples/UnknownEntityExample'
        '500':
          description: Internal Server Error
          content:
            application/json:
              examples:
                InternalServerErrorExample:
                  $ref: '#/components/examples/InternalServerErrorExample'
      tags:
      - Accounts Raw Data
components:
  schemas:
    Servicer:
      type: object
      properties:
        scheme_name:
          $ref: '#/components/schemas/ServicerSchemeName'
        identification:
          description: Servicer identification code
          type: string
      x-toBuilder: true
    DataResult:
      type: object
      allOf:
      - $ref: '#/components/schemas/Result'
      - type: object
        properties:
          refreshed_at:
            description: The datetime of when the data was refreshed
            type:
            - string
            - 'null'
            format: date-time
          type:
            description: The endpoint the original request was made to.
            type:
            - string
            - 'null'
    Currency:
      description: The ISO 3 letter currency code
      type: string
      examples:
      - AED
      pattern: ^[A-Z]{3}$
    AccountSubType:
      description: Specifies the sub type of account i.e., product family group such as CURRENT, SAVINGS, SAVINGS and CREDIT
      type: string
      enum:
      - CHARGE_CARD
      - CREDIT
      - CURRENT
      - EMONEY
      - LOAN
      - MORTGAGE
      - PERSONAL_LOAN
      - PREPAID
      - SAVINGS
      - CALL
      - UNSUPPORTED
    PageMetadata:
      description: Metadata about the current page of results
      type: object
      properties:
        number:
          description: The current page being returned by the API
          type: integer
          format: int32
        size:
          description: The page size requested
          type: integer
          format: int32
        total_elements:
          description: The total number of elements in all pages
          type: integer
          format: int64
        total_pages:
          description: The total number of pages retrievable
          type: integer
          format: int32
        sort:
          description: Sort parameters applied to the results
          type: array
          items:
            type: string
      required:
      - number
      - size
      - total_elements
      - total_pages
    Account:
      type: object
      properties:
        entity_id:
          description: The unique identifier for the entity. Provided as a UUID.
          type: string
          format: uuid
        account_id:
          description: The unique identifier for the account. Provided as a UUID.
          type: string
          format: uuid
        account_holder_name:
          description: The Account Holder Name is the name or names of the Account owner(s) represented at the account level
          type: string
        account_holder_short_name:
          description: Short form of the account holder name
          type: string
        status:
          $ref: '#/components/schemas/AccountStatus'
        status_update_date_time:
          description: The datetime that the account status was updated.
          type:
          - string
          - 'null'
          format: date-time
        currency:
          $ref: '#/components/schemas/Currency'
        account_type:
          $ref: '#/components/schemas/AccountType'
        account_sub_type:
          $ref: '#/components/schemas/AccountSubType'
        nickname:
          description: The nickname for the account as set by the owner of the account. This name is known to the end-user
          type:
          - string
          - 'null'
        description:
          description: Specifies the description of the account sub-type.
          type:
          - string
          - 'null'
        opening_date:
          description: The date the account was opened.
          type:
          - string
          - 'null'
          format: date
        maturity_date:
          description: Maturity date of the account.
          type:
          - string
          - 'null'
          format: date-time
        account:
          description: A list of identifications for the account assigned by the Bank based on the Account Scheme Name
          type: array
          items:
            $ref: '#/components/schemas/AccountIdentification'
        servicer:
          description: Party that manages the account on behalf of the account owner, that is manages the registration and booking of entries on the account, calculates balances on the account and provides information about the account.
          allOf:
          - $ref: '#/components/schemas/Servicer'
      required:
      - account_id
      x-toBuilder: true
    AccountIdentification:
      type: object
      properties:
        scheme_name:
          $ref: '#/components/schemas/SchemeName'
        identification:
          description: The identification value for the account assigned by the Bank based on the Account Scheme Name.
          type: string
        name:
          description: Account name
          type: string
    AccountsData:
      type: object
      properties:
        type:
          description: The endpoint the original request was made to.
          type: string
        accounts:
          description: An array of accounts associated with the Entity.
          type: array
          items:
            $ref: '#/components/schemas/Account'
        page:
          $ref: '#/components/schemas/PageMetadata'
      required:
      - type
      - page
      - accounts
      x-toBuilder: true
    AccountsRequestResultV2:
      type: object
      allOf:
      - $ref: '#/components/schemas/DataResult'
      - properties:
          data:
            $ref: '#/components/schemas/AccountsData'
        type: object
      x-toBuilder: true
    Result:
      type: object
      properties:
        status:
          $ref: '#/components/schemas/ResultStatus'
        results_id:
          description: The unique identifier for the request
          type: string
          format: uuid
        message:
          description: A message describing the status of the request
          type: string
        meta:
          description: Meta information about the request
          type:
          - object
          - 'null'
          additionalProperties:
            type: string
        timestamp:
          description: The datetime of when the request was made
          type: string
          format: date-time
        status_detail:
          description: Additional information about the status
          type:
          - object
          - 'null'
          allOf:
          - $ref: '#/components/schemas/StatusDetail'
      required:
      - status
      - results_id
      - message
      - timestamp
    AccountType:
      description: Specifies the type of account (PERSONAL or BUSINESS).
      type: string
      enum:
      - PERSONAL
      - BUSINESS
      - UNSUPPORTED
    AccountStatus:
      description: The current status of the account. Indicating whether it is in active use or not.
      type:
      - string
      - 'null'
      enum:
      - DELETED
      - DISABLED
      - ENABLED
      - PENDING
      - PROFORMA
      - UNSUPPORTED
    SchemeName:
      description: The scheme name of the account identification value
      type: string
      enum:
      - PAN
      - IBAN
      - BBAN
      - COMMERCIAL_REGISTRATION_NUMBER
      - EMAIL
      - MOBILE_NUMBER
      - NATIONAL_ID
      - IQAMA_NUMBER
      - PASSPORT_NUMBER
      - OTHER
      - UNSUPPORTED
    ServicerSchemeName:
      description: Servicer identification scheme name
      type: string
      enum:
      - BICFI
      - OTHER
      - UNSUPPORTED
    ResultStatus:
      description: The status of the request
      type: string
      enum:
      - OK
      - PENDING
      - FAILED
      - CONSENT_EXPIRED
      - RECONNECT_REQUIRED
      - PROCESSING_STARTED
    StatusDetail:
      type:
      - object
      - 'null'
      properties:
        granular_status_code:
          description: Granular status code
          type:
          - string
          - 'null'
        status_additional_info:
          description: Additional information about the status
          type:
          - string
          - 'null'
  examples:
    InternalServerErrorExample:
      summary: Internal server error response
      description: Response when an unexpected server error occurs
      value:
        results_id: 516adc40-af36-4284-bfba-46ec69dfe6d3
        timestamp: '2025-08-07T13:07:38.834977945Z'
        status: INTERNAL_SERVER_ERROR
        message: Something has gone wrong. If you continue to see this error, please get in touch with Lean.
        metadata: null
    UnknownEntityExample:
      summary: Entity not found error response
      description: Response when the provided entity_id is not found
      value:
        results_id: 516adc40-af36-4284-bfba-46ec69dfe6d3
        timestamp: '2025-09-10T21:03:05.413806605Z'
        status: UNKNOWN_ENTITY
        message: The entity_id provided did not match an account in our records.
        metadata: null
    InvalidParametersExample:
      summary: Invalid parameters error response
      description: Response when required parameters are missing or invalid
      value:
        results_id: 516adc40-af36-4284-bfba-46ec69dfe6d3
        timestamp: '2025-09-10T21:05:59.919233187Z'
        status: INVALID_PARAMETERS
        message: 'The request is badly formatted or a parameter of the wrong type has been provided, field: entity_id, value: e34d8e49-9af2-4252-a53e-bd2df855134.'
        metadata: null
    BankIssueV2Example:
      summary: Failed request due to bank technical issues
      description: Response when the bank is experiencing technical problems
      value:
        status: FAILED
        results_id: 516adc40-af36-4284-bfba-46ec69dfe6d3
        message: Your bank is currently experiencing technological problems. Please try again later.
        meta: null
        timestamp: '2025-09-12T05:13:49.739987382Z'
        status_detail:
          granular_status_code: BANK_ISSUE
          status_additional_info: Your bank is currently experiencing technological problems. Please try again later.
        type: null
        refreshed_at: null
    AsyncProcessingV2Example:
      summary: Asynchronous processing response with async=true
      description: Response to request with async=true
      value:
        status: PENDING
        results_id: df73d596-7138-46df-af96-cbcbe9a8af59
        message: Please wait for a webhook or try again later.
        meta: null
        timestamp: '2025-09-11T19:15:07.829993148Z'
        status_detail: null
        data: null
        type: null
        refreshed_at: null
  parameters:
    MetaParameter:
      name: meta
      description: 'Additional data you would like to store against the request. Example: {"foo": "val"}'
      in: query
      required: false
      schema:
        type: string
    SizeParameter:
      name: size
      description: The number of objects you want to return as a page size.
      in: query
      required: false
      schema:
        type: integer
        default: 50
        maximum: 100
        minimum: 1
    EntityIdParameter:
      name: entity_id
      description: The entity_id you're querying for, which is created by LinkSDK `.connect()` function.
      in: query
      required: false
      schema:
        type: string
        format: uuid
    AsyncParameter:
      name: async
      in: query
      description: 'When true the API will return a results_id which can be fetched from the /data/v2/results endpoint when ready. **Note: it''s recommended to use the sync flow (async=false) for all requests by adapting the [data workflow](https://docs.leantech.me/docs/data-workflow) for connected entities.**'
      required: false
      schema:
        type: boolean
        default: false
      deprecated: true
    PageParameter:
      name: page
      in: query
      description: The page you're requesting - returns page 0 of a response if not specified.
      required: false
      schema:
        type: integer
        default: 0
        minimum: 0
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer