> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mileapp.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Read import monitoring records

> This endpoint retrieves a paginated list of import monitoring records. These records track the status and progress of all data import operations initiated by users in the organization. You can filter by import type, status, data type, and other criteria.

**Use Cases:**
- Monitor ongoing imports
- Review completed imports
- Download failed records for correction
- Track import history

**Polling Recommendation:**
For real-time status updates of ongoing imports, poll this endpoint every 3-5 seconds while import status is 'onprocess'.



## OpenAPI

````yaml /openapi/public/openapi-importexport.json get /import-monitoring
openapi: 3.0.0
info:
  title: MileApp API - ImportExport
  version: 3.0.0
  description: MileApp API Documentation - RESTful API for field operations management.
servers:
  - url: https://apiweb.mile.app/api/v3
security:
  - bearerAuth: []
tags:
  - name: Data Import
    description: >-
      The Data Import module allows users to upload and import data source
      records from Excel or CSV files. Import operations are processed in the
      background via queue system for scalability and can handle large datasets.
      The import process validates data against data type schemas, tracks
      processing status in real-time, and generates detailed reports including
      failed records for review. All import activities can be monitored through
      import-monitoring endpoints with 30-day data retention.
  - name: Export Task
    description: >-
      The Export Task module provides functionality to export task data and data
      source records to various formats (XLSX, JSON). It supports both direct
      export for small datasets and background processing for large exports.
      Users can customize exports using export configurations, filter data by
      multiple criteria, and monitor export operations through export logs.
      Export files are stored securely with 30-day retention period.
  - name: Export Config
    description: >-
      The Export Config module is used to save and manage the specific fields
      that a user wants included in export results. This allows users to
      customize their exported data by selecting only the necessary fields for
      each export, ensuring that the output contains exactly the information
      they need.


      **To see the details of export config object, please follow [this
      link](#tag/export_config_model)**
  - name: Import Config
    description: >-
      The Import Config module saves and manages column mapping presets for bulk
      import features across MileApp. Users can store field-to-Excel-column
      mappings so they can be reused across multiple imports. Each config is
      linked to a specific resource and contains the mapping between its fields
      and Excel header columns.
paths:
  /import-monitoring:
    get:
      tags:
        - Data Import
      summary: Read import monitoring records
      description: >-
        This endpoint retrieves a paginated list of import monitoring records.
        These records track the status and progress of all data import
        operations initiated by users in the organization. You can filter by
        import type, status, data type, and other criteria.


        **Use Cases:**

        - Monitor ongoing imports

        - Review completed imports

        - Download failed records for correction

        - Track import history


        **Polling Recommendation:**

        For real-time status updates of ongoing imports, poll this endpoint
        every 3-5 seconds while import status is 'onprocess'.
      operationId: GetImportMonitoring
      parameters:
        - name: page
          in: query
          required: false
          description: |-
            Page number for pagination.
            **Example:** `1`
            **Default:** `1`
          schema:
            type: integer
        - name: limit
          in: query
          required: false
          description: |-
            Number of records per page.
            **Example:** `20`
            **Default:** `20`
            **Max:** `100`
          schema:
            type: integer
        - name: type
          in: query
          required: false
          description: |-
            Filter by import type. Comma-separated for multiple types.
            **enum:** `datasource`, `task`, `visit`, `route`
            **Example:** `datasource,task`
          schema:
            type: string
        - name: status
          in: query
          required: false
          description: |-
            Filter by import status. Comma-separated for multiple statuses.
            **enum:** `onprocess`, `success`, `partially`, `failed`
            **Example:** `onprocess,success`
          schema:
            type: string
        - name: dataTypeId
          in: query
          required: false
          description: >-
            Filter by data type ID (for datasource imports only). Use [GET
            /data-types API](#tag/Data-Type/operation/getDataType) to get the
            list of Data Type IDs.

            **Example:** `63db2fb476bc679c540369c4`
          schema:
            type: string
        - name: sortBy
          in: query
          required: false
          description: |-
            Sort by field.
            **Example:** `createdTime`, `updatedTime`, `status`
            **Default:** `createdTime`
          schema:
            type: string
        - name: sortOrder
          in: query
          required: false
          description: |-
            Sort order.
            **enum:** `asc`, `desc`
            **Default:** `desc`
          schema:
            type: string
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                title: ImportMonitoringListResponse
                properties:
                  status:
                    type: boolean
                    description: Status of response.
                  message:
                    description: Message of API response.
                    type: string
                  data:
                    description: Paginated list of import monitoring records.
                    type: object
                    properties:
                      current_page:
                        type: integer
                        description: Current page number
                      data:
                        type: array
                        description: Array of import monitoring records
                        items:
                          $ref: '#/components/schemas/ImportMonitoringObject'
                      first_page_url:
                        type: string
                        description: URL to first page
                      from:
                        type: integer
                        description: Starting record number
                      last_page:
                        type: integer
                        description: Last page number
                      last_page_url:
                        type: string
                        description: URL to last page
                      links:
                        type: array
                        description: Pagination links
                        items:
                          type: object
                          additionalProperties: true
                      next_page_url:
                        type: string
                        description: URL to next page
                      path:
                        type: string
                        description: Base path for pagination
                      per_page:
                        type: integer
                        description: Records per page
                      prev_page_url:
                        type: string
                        description: URL to previous page
                      to:
                        type: integer
                        description: Ending record number
                      total:
                        type: integer
                        description: Total records
                example:
                  status: true
                  message: Success
                  data:
                    current_page: 1
                    data:
                      - _id: 65f8a4c2d9e3b1234567890a
                        organizationId: 63c61d865347e356d05e3052
                        type: string
                        hubId: 63c63ab1b6972d3150348172
                        filename: outlets_import.xlsx
                        totalRows: 150
                        totalValid: 145
                        totalInvalid: 5
                        status: partially
                        dataTypeId: 63db2fb476bc679c540369c4
                        dataTypeName: OutletDetail
                        fileTemplate: >-
                          https://staticdev.mile.app/dev-mile/templates/template_OutletDetail.xlsx
                        fileFailedImported: >-
                          https://staticdev.mile.app/dev-mile/failed/failed_outlets_import_65f8a4c2d9e3b1234567890a.xlsx
                        processedAt: '2024-03-18 10:32:15'
                        processingDuration: 90
                        totalChunks: 3
                        processedChunks: 3
                        createdBy: john.doe@mile.app
                        updatedBy: system
                        createdTime: '2024-03-18 10:30:45'
                        updatedTime: '2024-03-18 10:32:15'
                      - _id: 65f8a3b1c8d2a0123456789b
                        organizationId: 63c61d865347e356d05e3052
                        type: string
                        hubId: 63c63ab1b6972d3150348172
                        filename: tasks_import.csv
                        totalRows: 500
                        totalValid: 500
                        totalInvalid: 0
                        status: success
                        flowId: 63d8c9b0dbd5ef20a627dd86
                        flowName: Delivery
                        fileTemplate: >-
                          https://staticdev.mile.app/dev-mile/templates/template_task_import.xlsx
                        processedAt: '2024-03-18 10:25:30'
                        processingDuration: 120
                        totalChunks: 5
                        processedChunks: 5
                        createdBy: jane.smith@mile.app
                        updatedBy: system
                        createdTime: '2024-03-18 10:23:30'
                        updatedTime: '2024-03-18 10:25:30'
                    first_page_url: https://apiweb.mile.app/api/v3/import-monitoring?page=1
                    from: 1
                    last_page: 5
                    last_page_url: https://apiweb.mile.app/api/v3/import-monitoring?page=5
                    links:
                      - url: null
                        label: '&laquo; Previous'
                        active: false
                      - url: >-
                          https://apiweb.mile.app/api/v3/import-monitoring?page=1
                        label: '1'
                        active: true
                      - url: >-
                          https://apiweb.mile.app/api/v3/import-monitoring?page=2
                        label: '2'
                        active: false
                      - url: >-
                          https://apiweb.mile.app/api/v3/import-monitoring?page=2
                        label: Next &raquo;
                        active: false
                    next_page_url: https://apiweb.mile.app/api/v3/import-monitoring?page=2
                    path: https://apiweb.mile.app/api/v3/import-monitoring
                    per_page: 20
                    prev_page_url: null
                    to: 20
                    total: 95
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                  message:
                    type: string
                  failedCode:
                    type: string
              examples:
                response:
                  value:
                    status: false
                    message: Invalid status value
                    failedCode: import-003
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                  message:
                    type: string
                  failedCode:
                    type: string
              examples:
                response:
                  value:
                    status: false
                    message: Unauthorized
                    failedCode: auth-001
        '500':
          description: Server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                  message:
                    type: string
                  failedCode:
                    type: string
              examples:
                response:
                  value:
                    status: false
                    message: Internal server error
                    failedCode: import-045
      deprecated: false
      security:
        - bearerAuth: []
      x-code-samples:
        - lang: cURL
          source: >-
            curl -X GET
            "https://apiweb.mile.app/api/v3/import-monitoring?type=datasource&status=onprocess&limit=20&page=1"
            \
              -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
components:
  schemas:
    ImportMonitoringObject:
      title: ImportMonitoringObject
      type: object
      description: >-
        Complete import monitoring record with all fields from the
        ImportMonitoring model
      properties:
        _id:
          type: string
          description: >-
            Unique identifier for the import monitoring record generated by
            system.

            **Example:** `65f8a4c2d9e3b1234567890a`
        organizationId:
          type: string
          description: |-
            Organization ID that owns this import.
            **Example:** `63c61d865347e356d05e3052`
        inputType:
          type: string
          description: The input type of the component (e.g., string, number, date, etc.)
        hubId:
          type: string
          description: |-
            Hub ID associated with this import (if applicable).
            **Example:** `63c63ab1b6972d3150348172`
        filename:
          type: string
          description: |-
            Original filename of the uploaded file.
            **Example:** `outlets_import.xlsx`
        totalRows:
          type: integer
          description: |-
            Total number of rows in the imported file (excluding header).
            **Example:** `150`
        totalValid:
          type: integer
          description: |-
            Total number of valid rows successfully imported.
            **Example:** `145`
        totalInvalid:
          type: integer
          description: |-
            Total number of invalid rows that failed validation or import.
            **Example:** `5`
        status:
          type: string
          description: |-
            Current status of the import process.
            - `onprocess`: Import is currently being processed
            - `success`: All rows imported successfully
            - `partially`: Some rows succeeded, some failed
            - `failed`: Import completely failed
            **enum:** `onprocess`, `success`, `partially`, `failed`
            **Example:** `partially`
          enum:
            - onprocess
            - success
            - partially
            - failed
        fileTemplate:
          type: string
          description: >-
            URL to download the template file for this import type. Template is
            generated based on data type schema or flow configuration.

            **Example:**
            `https://staticdev.mile.app/dev-mile/templates/template_OutletDetail.xlsx`
        fileFailedImported:
          type: string
          description: >-
            URL to download file containing failed records. Only available when
            status is 'partially' or 'failed' and there are invalid rows. File
            includes error messages for each failed row.

            **Example:**
            `https://staticdev.mile.app/dev-mile/failed/failed_outlets_import_65f8a4c2d9e3b1234567890a.xlsx`
        dataTypeId:
          type: string
          description: >-
            **[Datasource Import Only]** Data type ID for datasource imports.
            This field is populated only when type='datasource'.

            Use [GET /data-types API](#tag/Data-Type/operation/getDataType) to
            get valid data type IDs.

            **Example:** `63db2fb476bc679c540369c4`
        dataTypeName:
          type: string
          description: >-
            **[Datasource Import Only]** Data type name for datasource imports.
            This field is populated only when type='datasource'.

            **Example:** `OutletDetail`
        flowId:
          type: string
          description: >-
            **[Task Import Only]** Flow ID for task imports. This field is
            populated only when type='task'. Note: Full task import
            implementation may still be in progress.

            Use [GET /flows API](#tag/Flow/operation/getflow) to get valid flow
            IDs.

            **Example:** `63d8c9b0dbd5ef20a627dd86`
        flowName:
          type: string
          description: >-
            **[Task Import Only]** Flow name for task imports. This field is
            populated only when type='task'. Note: Full task import
            implementation may still be in progress.

            **Example:** `Delivery`
        visitTypeId:
          type: string
          description: >-
            **[Visit Import Only - Future]** Visit type ID for visit imports.
            This field will be populated when type='visit'. Feature may be under
            development.

            **Example:** `64a5c8d2e9f1b2345678901c`
        visitTypeName:
          type: string
          description: >-
            **[Visit Import Only - Future]** Visit type name for visit imports.
            This field will be populated when type='visit'. Feature may be under
            development.

            **Example:** `Customer Visit`
        routeConfigId:
          type: string
          description: >-
            **[Route Import Only - Future]** Route configuration ID for route
            imports. This field will be populated when type='route'. Feature may
            be under development.

            **Example:** `65b6d9e3f0a2c3456789012d`
        routeConfigName:
          type: string
          description: >-
            **[Route Import Only - Future]** Route configuration name for route
            imports. This field will be populated when type='route'. Feature may
            be under development.

            **Example:** `Daily Route Config`
        errorMessage:
          type: string
          description: >-
            Error message if the import completely failed. Populated when
            status='failed'.

            **Example:** `File validation failed: Invalid data type ID`
        processedAt:
          type: string
          description: >-
            Timestamp when the import processing was completed. Format: Y-m-d
            H:i:s

            **Example:** `2024-03-18 10:32:15`
        processingDuration:
          type: integer
          description: >-
            Duration of import processing in seconds. Calculated as difference
            between processedAt and createdTime.

            **Example:** `90`
        totalChunks:
          type: integer
          description: >-
            Total number of chunks the file was divided into for processing.
            Large files are processed in chunks for better performance.

            **Example:** `3`
        processedChunks:
          type: integer
          description: >-
            Number of chunks that have been processed. Use this with totalChunks
            to calculate processing progress.

            **Example:** `3`
        createdBy:
          type: string
          description: |-
            Email of the user who initiated the import.
            **Example:** `john.doe@mile.app`
        updatedBy:
          type: string
          description: >-
            Email of the user/system that last updated this record. Usually
            'system' for background processing updates.

            **Example:** `system`
        createdTime:
          type: string
          description: |-
            Timestamp when the import was created. Format: Y-m-d H:i:s
            **Example:** `2024-03-18 10:30:45`
        updatedTime:
          type: string
          description: |-
            Timestamp when the record was last updated. Format: Y-m-d H:i:s
            **Example:** `2024-03-18 10:32:15`
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Use a valid Bearer token to authenticate.

````