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

# Import File Run History

> This API fetches the file processing status of each file contained in an import. The API request must contain either the import _name or the import_id. If you are not sure of the import-id or the import_name, you can use the Import Details API to get the import details, which can be further used in the Import File Run History API.

### Rate Limit

You can create 50 requests per minute.

### Postman Collections

We have made it easy for you to test the APIs. Click [here](https://www.postman.com/moengage-dev/api-docs/collection/mzt9mgo/moengage-status-and-run-history-api?action=share\&creator=3182294) to view it in Postman.


## OpenAPI

````yaml /api/data/data.yaml post /fileimports/import/run/history
openapi: 3.0.3
info:
  title: MoEngage Data APIs
  version: '1.0'
  description: >-
    This is a comprehensive OpenAPI specification for MoEngage's Data APIs,
    including User, Event, and Device management.

    It's designed to power an interactive API playground on your new
    documentation site.
servers:
  - url: https://api-0{dc}.moengage.com/v1
    description: MoEngage Core API Server
    variables:
      dc:
        default: '1'
        description: >-
          The ‘dc’ in the API Endpoint URL refers to the MoEngage Data Center
          (DC). MoEngage hosts each customer in a different DC. You can find
          your DC number and replace the value of ‘dc’ in the URL by referring
          to the DC and API endpoint mapping
          [here](https://help.moengage.com/hc/en-us/articles/360057030512-Data-Centers-in-MoEngage).
          Your MoEngage Data Center (DC) can be 1, 2, 3, 4,5, 6. 
        enum:
          - '1'
          - '2'
          - '3'
          - '4'
          - '5'
          - '6'
security:
  - Authentication: []
tags:
  - name: User
    description: Operations for creating, updating, retrieving, and managing user profiles.
  - name: Event
    description: Operations for tracking user events.
  - name: Device
    description: Operations for managing user devices.
  - name: Tracking
    description: Endpoints for tracking attribution and installs.
  - name: Utilities
    description: Utility endpoints for testing connections.
  - name: File Imports
    description: Operations for managing asynchronous file imports.
  - name: Bulk
    description: Operations for importing users and events in bulk.
  - name: Webhooks
    description: Incoming webhook specifications from MoEngage.
paths:
  /fileimports/import/run/history:
    post:
      tags:
        - File Import
      summary: Import File Run History
      description: >-
        This API fetches the file processing status of each file contained in an
        import. The API request must contain either the import _name or the
        import_id. If you are not sure of the import-id or the import_name, you
        can use the Import Details API to get the import details, which can be
        further used in the Import File Run History API.
      parameters:
        - name: MOE-APPKEY
          in: header
          required: true
          description: >-
            This is your MoEngage account's WORKSPACE ID that has to be passed
            along with the request.You can find your MoEngage Workspace ID at
            Settings -> Account -> APIs -> Workspace ID (earlier app id).
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FileRunHistoryRequest'
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileRunHistoryResponse'
              examples:
                success_response:
                  summary: Successful request
                  value:
                    status: success
                    total_count: '1'
                    data: null
                    type: object
                    items:
                      type: object
                      properties:
                        id: 672561rr0abd2da34cf7f7df
                        file_name: filename.csv
                        scheduled_at: '2024-11-14T12:31:31.713000'
                        completed_at: '2024-11-14T12:32:09.942000'
                        type: AUX_DATA
                        file_size: '1544'
                        file_status: SUCCESSFUL
                        status_msg: ''
                        total_rows: 10
                        skipped_rows: 0
                        updated_rows: 0
                        failed_rows: 0
                        aux_data_added_count: 10
                        aux_data_failed_count: 0
                        added_rows: 10
                    offset: 1
                    more_files: 'false'
        '400':
          description: >-
            This response is returned when the required parameters are missing
            from the request, attributes are not found, and incorrect values are
            passed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: fail
                    description: This field denotes the status of the request.
                  error_type:
                    type: object
                    description: This field denotes the type of error occured
                  message:
                    type: string
                    description: 'This field denotes the error message. '
              examples:
                bad_request:
                  summary: Bad request
                  value:
                    status: FAILURE
                    error_type: Import Doesn't Exist
                    message: >-
                      No import exist in the database with the given query
                      parameters.
                invalid_date_format:
                  summary: Date range not in ISO format
                  value:
                    status: FAILURE
                    error_type: Invalid Date format
                    message: >-
                      The date entered is not in the correct format. Please
                      ensure you are using the ISO 8601 format which should look
                      like this: YYYY-MM-DDTHH:MM:SS.ssssss. Please check this
                      and try again.
                incorrect_offset_value:
                  summary: Incorrect offset value passed
                  value:
                    status: FAILURE
                    error_type: Import Doesn't Exist
                    message: >-
                      No import exist in the database with the given query
                      parameters.
        '401':
          description: >-
            This response is returned when the APP Key is invalid or missing,
            the password is incorrect, or there are other such
            authorization-related errors in the request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  title:
                    type: string
                    example: fail
                    description: The title of the error.
                  description:
                    type: string
                    description: The description of the error.
              examples:
                missing_header:
                  summary: MOE-APPKEY is missing in Header
                  value:
                    title: HeaderMissing
                    description: MOE-APPKEY is missing in Header
        '404':
          description: >-
            This response is returned when the APP Key is invalid or missing,
            the password is incorrect, or there are other such
            authorization-related errors in the request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    description: >-
                      This field contains the status of the request and
                      specifies whether the request was a failure.
                    example: fail
                  data:
                    type: string
                    description: The description of the data.
              examples:
                invalid_endpoint:
                  summary: Resource not found
                  value:
                    status: fail
                    data: Resource not found.
        '415':
          description: >-
            This response is returned when the APP Key is invalid or missing,
            the password is incorrect, or there are other such
            authorization-related errors in the request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  title:
                    type: string
                    example: fail
                  error_description:
                    type: string
              examples:
                unsupported_media_type:
                  summary: Unsupported media type
                  value:
                    title: Unsupported media type
                    error_description: Content type is not supported
        '429':
          description: >-
            This response is returned when the number of requests has exceeded
            the rate limit..
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: fail
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                        description: >-
                          A descriptive error message explaining why the request
                          failed.
                      type:
                        type: string
                        description: >-
                          The type or category of the error (e.g., Rate Limits
                          Exceeded).
                      request_id:
                        type: string
                        description: >-
                          A unique identifier for the request, useful for
                          debugging.
              examples:
                rate_limit_exceeded:
                  summary: Rate limits exceeded
                  value:
                    status: fail
                    error:
                      message: Rate limits exceeded, please try after some time
                      type: Rate Limits Exceeded
                      request_id: '1234'
      servers:
        - url: https://fileimports-data-api-0{dc}.moengage.com/v1.0/data
          description: MoEngage File Imports API Server
          variables:
            dc:
              default: '1'
              description: >-
                The dc in the API Endpoint URL refers to the MoEngage Data
                Center (DC). MoEngage hosts each customer in a different DC.
              enum:
                - '1'
                - '2'
                - '3'
                - '4'
                - '5'
                - '6'
components:
  schemas:
    FileRunHistoryRequest:
      type: object
      required:
        - import_id
        - import_name
      properties:
        import_id:
          type: string
          description: >-
            The unique identifier is used to identify the import. You can find
            this on the Data Imports page of the MoEngage dashboard. Data > Data
            Imports > Click the ellipsis icon for an import > View. The
            import_id or the import_name must be passed.
        import_name:
          type: string
          description: >-
            This field denotes the name of the import.The import_id or
            import_name has to be passed. If both are passed, import_id takes
            precedence.
        date:
          type: object
          description: >
            This field denotes the file processing date. Supported values are:


            * `start_date`

            * `end_date`

            * `format`
              
            If this field is not passed, the API will respond with details of
            all the files corresponding to the import_id / import_name passed
            and in accordance to the offset and limit values.


            Supported date time formats are:

             * `"datetime_format": "YYYY-MM-DD"` (2022-01-22)
             * `"datetime_format": "YYYY/MM/DD"` (2022/01/22)
             * `"datetime_format": "DD/MM/YYYY"` (22/01/2022)
             * `"datetime_format": "DD-MM-YYYY"` (22-01-2022)
             * `"datetime_format": "DD-MM-YYYY hh:mm:ss"` (31-12-2022 12:10:33)
             * `"datetime_format": "DD/MM/YYYY hh:mm:ss"` (31/12/2022 12:10:33)
             * `"datetime_format": "YYYY-MM-DD hh:mm:ss"` (2019-02-22 17:54:14)
             * `"datetime_format": "YYYY/MM/DD hh:mm:ss"` (2019/02/22 17:54:14)
          properties:
            start_date:
              type: string
              format: date-time
              description: The start date of the import.
            end_date:
              type: string
              format: date-time
              description: The end date of the import.
            format:
              type: string
              description: The format of the date.
        file_status:
          type: array
          description: This field denotes the status of files contained in an import.
          items:
            type: string
            enum:
              - SUCCESSFUL
              - FAILED
              - PARTIAL_SUCCESS
              - PROCESSING
              - QUEUED
              - WAITING
        offset:
          type: integer
          description: >
            'API responds with a maximum of 50 file details in a single
            response. For example, if there are a total of 150 files that are
            part of the API response, then:

            * Offset = 1 will fetch the details of the first 50 files

            * Offset = 2 will fetch the file details of the next 50 imports

            * Offset = 3 will fetch the import details of the last 50 imports

            * If offset is not passed in the request body, the API response will
            consider offset = 1.


            You can refer to the total_count parameter in the response to
            understand how many total files are part of the response. 


            OR

             If the API responds with more_files = true, it indicates that there are more files that are not part of the current response for which another API request must be made with offset +1.'
          default: 1
    FileRunHistoryResponse:
      type: object
      properties:
        status:
          type: string
          description: This field denotes the status of the API response.
          example: success
        total_count:
          type: integer
          description: >-
            This field denotes the total count of the files fetched based on the
            API request.
          example: 1
        data:
          type: array
          description: This field contains the file data details.
          items:
            type: object
            properties:
              id:
                type: string
                description: This field denotes the unique ID of the file.
              file_name:
                type: string
                description: This field denotes the name of the file.
              scheduled_at:
                type: string
                description: This field denotes the time at which the file is scheduled.
                format: date-time
              completed_at:
                type: string
                description: This field denotes the time at which the file is completed.
                format: date-time
              type:
                type: string
                description: This field denotes the file type.
                enum:
                  - USERS
                  - EVENTS
                  - AUX_DATA
              file_size:
                type: string
                description: >-
                  This field denotes the file size in terms of the number of
                  rows in the file.
              file_status:
                type: string
                description: This field denotes the file status.
                enum:
                  - SUCCESSFUL
                  - FAILED
                  - PARTIAL_FAILURE
                  - QUEUED
              status_msg:
                type: string
                description: >-
                  This field denotes the error message in case of failure or
                  partial failure.
              total_rows:
                type: integer
                description: This field denotes the total number of rows in the file.
              skipped_rows:
                type: integer
                description: This field denotes the skipped number of rows in the file.
              updated_rows:
                type: integer
                description: This field denotes the updated number of rows in the file.
              failed_rows:
                type: integer
                description: >-
                  This field denotes the number of rows in the file that failed
                  to process.
              aux_data_added_count:
                type: integer
                description: >-
                  This field denotes the number of rows added as auxiliary data.
                  This is applicable to auxiliary data.
              aux_data_failed_count:
                type: integer
                description: >-
                  This field denotes the number of rows that failed to process.
                  This is applicable to auxiliary data.
              added_rows:
                type: integer
                description: >-
                  This field denotes the total number of rows added from the
                  file.
        offset:
          type: integer
          description: >
            This field denotes the pagination value of the imports. For example,
            if there are 100 imports to be fetched in the response:

            * Offset = 1 will return the first 50 imports

            * Offset = 2 will return the next 50 import details
        more_files:
          type: string
          description: >-
            This field indicates if there are more files. For example, if there
            are 100 imports and offset = 1, 50 imports will be returned with
            more_file = true to indicate that offset = 2 must be passed to get
            the next 50 imports.
  securitySchemes:
    Authentication:
      type: http
      scheme: basic
      description: >
        This authentication parameter, used for access control, must be passed
        along with the request. The API request will be authenticated through
        Basic Authentication. Basic Authentication sends a Base64-encoded string
        containing your username and password with every API request. It encodes
        a 'username:password' string in Base64 and appends the encoded string
        with 'Basic '. This string is included in the authorization header as
        shown below:


        `{"Authorization: Basic Base64_ENCODED_WORKSPACEID_APIKEY=="}`


        The username and password details can be obtained from the MoEngage
        Dashboard. If you're using the API for the first time, follow these
        steps:

        1. Navigate to Settings -> Account -> APIs.

        2. Copy the following details:
           * **Username:** Under Workspace ID (earlier app id), click the copy icon to copy the username.
           * **Password:** In the **API keys** section, click the copy icon in the **Data** tile to copy the API key.

        Use these details to authenticate the API requests.

````