> ## Documentation Index > Fetch the complete documentation index at: https://learn.servitly.com/llms.txt > Use this file to discover all available pages before exploring further. # Schedule a new data-import > Imports historical metrics data for a specific thing through a CSV file.
Note that, depending on the size of the provided CSV, a data-import may require several minutes to complete.
Periodically check the data-import status by calling the get data-import by id method issuing the data-import identifier.

Here is an example of the CSV file:
TIMESTAMP,<metric-name>,<metric-name>,<metric-name>
1751882400000,25,true,"foo bar"
1751882430000,26.5,false,"abc"


- The TIMESTAMP column must contain UTC values (long) in ascending order.
- The column header for a metric should be the name of the metric itself.

Limitations:
- It is possible to import historical data for any raw and computed (derived and counter) metric.
- The file provided cannot exceed the size of 10 MiB and 50,000 rows.
- Only one import per thing can be performed at a time.
- Completed imports are automatically removed after 30 days.

Required permissions: IMPORT_DATA. ## OpenAPI ````json POST /data/dataImports { "openapi": "3.1.0", "info": { "title": "Servitly DPS API", "version": "1.0.0" }, "servers": [ { "url": "https://api.servitly-sandbox.com", "description": "[AWS SANDBOX]" }, { "url": "https://api.servitly.com", "description": "[AWS PRODUCTION Ireland]" }, { "url": "https://api-ap.servitly.com", "description": "[AWS Hong Kong]" }, { "url": "https://azapi.servitly-dev.com", "description": "[AZURE DEV Frankfurt]" }, { "url": "https://azapi.servitly-staging.com", "description": "[AZURE STAGING Frankfurt]" }, { "url": "https://azapi.servitly.com", "description": "[AZURE PRODUCTION Frankfurt]" } ], "security": [ { "bearerAuth": [] } ], "tags": [ { "name": "ACTIONS" }, { "name": "ALERTS" }, { "name": "API GATEWAY" }, { "name": "AUTHENTICATION" }, { "name": "AUTHORIZATIONS" }, { "name": "CUSTOMERS" }, { "name": "DATA IMPORT / EXPORT" }, { "name": "EVENTS" }, { "name": "LOCATIONS" }, { "name": "MAINTENANCE" }, { "name": "MAPPING" }, { "name": "METRIC DATA" }, { "name": "MOBILE APP" }, { "name": "ORGANIZATION" }, { "name": "PARTNERS" }, { "name": "PRODUCT MODELS" }, { "name": "SPARE PARTS" }, { "name": "STATISTICS" }, { "name": "STORE ORDERS" }, { "name": "SUBSCRIPTIONS" }, { "name": "SUBSCRIPTIONS (OLD)" }, { "name": "THING CONTROL" }, { "name": "THING DEFINITIONS" }, { "name": "THING MANAGEMENT" }, { "name": "THINGS" }, { "name": "TICKETS" }, { "name": "USER TYPES" }, { "name": "USERS" }, { "name": "WORK SESSIONS" } ], "paths": { "/data/dataImports": { "post": { "summary": "Schedule a new data-import", "description": "Imports historical metrics data for a specific thing through a CSV file.
Note that, depending on the size of the provided CSV, a data-import may require several minutes to complete.
Periodically check the data-import status by calling the get data-import by id method issuing the data-import identifier.

Here is an example of the CSV file:
TIMESTAMP,<metric-name>,<metric-name>,<metric-name>
1751882400000,25,true,\"foo bar\"
1751882430000,26.5,false,\"abc\"


- The TIMESTAMP column must contain UTC values (long) in ascending order.
- The column header for a metric should be the name of the metric itself.

Limitations:
- It is possible to import historical data for any raw and computed (derived and counter) metric.
- The file provided cannot exceed the size of 10 MiB and 50,000 rows.
- Only one import per thing can be performed at a time.
- Completed imports are automatically removed after 30 days.

Required permissions: IMPORT_DATA.", "tags": [ "DATA IMPORT / EXPORT" ], "parameters": [ { "$ref": "#/components/parameters/tenantNameHeader" }, { "in": "query", "name": "thingId", "required": "true", "schema": { "$ref": "#/components/schemas/ObjectId" }, "description": "The identifier of the thing whose data-imports must be retrieved." }, { "in": "query", "name": "csvHeaderRow", "required": "false", "schema": { "type": "integer", "minimum": "1" }, "description": "The index (1-based) of the row containing the CSV header." } ], "requestBody": { "description": "The details of the scheduled data-import.", "required": "true", "content": { "multipart/form-data": { "schema": { "type": "object", "properties": { "file": { "type": "string", "format": "binary", "description": "The CSV file to import. Alternatively, a ZIP containing the CSV file can be provided." } } }, "encoding": { "file": { "contentType": "text/csv" } } } } }, "responses": { "201": { "description": "Successfully created.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DataImport" } } } }, "400": { "$ref": "#/components/responses/BadRequest" }, "401": { "$ref": "#/components/responses/NotAuthenticated" }, "403": { "$ref": "#/components/responses/NotAuthorized" }, "429": { "$ref": "#/components/responses/ApiLimit" }, "500": { "$ref": "#/components/responses/IntError" } } } } }, "components": { "parameters": { "tenantNameHeader": { "in": "header", "name": "X-Servitly-Tenant", "required": "true", "schema": { "type": "string", "example": "{{tenantName}}" }, "description": "The name of the tenant (e.g. acme)." } }, "schemas": { "ObjectId": { "type": "string", "example": "abcd1234", "minimum": "1", "description": "The object identifier (e.g. 6620e4bb42541977c406b984)." }, "DataImport": { "type": "object", "description": "The bean providing data-import details.", "properties": { "id": { "type": "string", "description": "The data-import unique identifier.", "readOnly": "true" }, "dateTime": { "type": "integer", "format": "int64", "description": "The timestamp UTC the data-import has been scheduled.", "example": "1578438000000" }, "state": { "type": "string", "enum": [ "PENDING", "COMPLETED", "ERROR" ], "description": "The data-import status.", "readOnly": "true" } } } }, "responses": { "BadRequest": { "description": "Request data not valid.", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string", "description": "The error response.", "example": "Bad request" } } } } } }, "NotAuthenticated": { "description": "User not authenticated.", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string", "description": "The error response.", "example": "User not authenticated" } } } } } }, "NotAuthorized": { "description": "User not authorized.", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string", "description": "The error response.", "example": "User not authorized" } } } } } }, "ApiLimit": { "description": "API call rate limit exceeded.", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string", "description": "The error response.", "example": "API call rate limit exceeded" } } } } } }, "IntError": { "description": "Internal server error.", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string", "description": "The error response.", "example": "Internal Server Error" } } } } } } }, "securitySchemes": { "bearerAuth": { "type": "http", "scheme": "bearer" } } } } ````