Skip to main content
POST
/
data
/
import
cURL
curl -X POST "https://apiweb.mile.app/api/v3/data/import" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -F "file=@/path/to/datasource_import.xlsx" \
  -F "dataTypeId=63db2fb476bc679c540369c4" \
  -F "hubId=63c63ab1b6972d3150348172"
{
  "status": true,
  "message": "Import process has been queued successfully",
  "data": {
    "_id": "65f8a4c2d9e3b1234567890a",
    "organizationId": "63c61d865347e356d05e3052",
    "type": "string",
    "hubId": "63c63ab1b6972d3150348172",
    "filename": "outlets_import.xlsx",
    "totalRows": 150,
    "totalValid": 0,
    "totalInvalid": 0,
    "status": "onprocess",
    "dataTypeId": "63db2fb476bc679c540369c4",
    "dataTypeName": "OutletDetail",
    "fileTemplate": "https://staticdev.mile.app/dev-mile/templates/template_OutletDetail.xlsx",
    "totalChunks": 3,
    "processedChunks": 0,
    "createdBy": "john.doe@mile.app",
    "createdTime": "2024-03-18 10:30:45",
    "updatedTime": "2024-03-18 10:30:45"
  }
}

Authorizations

Authorization
string
header
required

Use a valid Bearer token to authenticate.

Body

multipart/form-data
file
file
required

The file containing data to import. Supported formats: CSV, XLS, XLSX. Maximum file size: 20MB. Example: datasource_import.xlsx

dataTypeId
string
required

The identifier for the data type. Required for datasource import type. Use GET /data-types API to get the list of Data Type IDs. Example: 63db2fb476bc679c540369c4

hubId
string

The identifier for the hub. Required if the data type has commonData set to false (hub-specific data). Use GET /hubs API to get the list of Hub IDs. Example: 63c63ab1b6972d3150348172

Response

Success - File uploaded and import process queued

status
boolean

Status of response.

message
string

Message of API response.

data
object

Import monitoring record created for this import.