Import Configuration
Endpoint
/i/import
Ⓔ Enterprise Only
This API is available exclusively in Countly Enterprise.
Overview
Imports previously exported configuration data into an application. Reads an uploaded JSON export file, validates all items for compatibility, performs ID mapping, and inserts the configuration into the target application with automatic dependency resolution.
Authentication
- Authentication methods:
- API Key (parameter):
api_key=YOUR_API_KEY - Auth Token (parameter):
auth_token=YOUR_AUTH_TOKEN - Auth Token (header):
countly-token: YOUR_AUTH_TOKEN
- API Key (parameter):
Permissions
- Required permission:
Updateon the Config Transfer feature (config_transfer)
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| api_key | String | Yes (or auth_token) | API key for authentication |
| auth_token | String | Yes (or api_key) | Auth token for authentication |
| app_id | String | Yes | Target application identifier (where to import configuration) |
| import_file | File | Yes | Multipart-uploaded JSON file exported from the Config Transfer export endpoint. |
import_file Format
JSON file structure exactly as exported from /o/export:
[
{
"name": "feature_name",
"data": [],
"dependencies": {}
}
]
Response
Success Response
"Success"
Response Fields
| Field | Type | Description |
|---|---|---|
(root value) | String | Status message on successful import |
Error Responses
| HTTP Status | Error Response | Description |
|---|---|---|
| 400 | {"result": "Missing parameter \"api_key\" or \"auth_token\""} | Missing authentication parameters |
| 401 | {"result": "No app_id provided"} | Missing target app identifier |
| 401 | {"result": "User does not have right"} | User lacks Update permission on Config Transfer feature |
| 500 | {"result": "Error in import"} | Import validation or data insertion failed |
Behavior/Processing
Import Process
-
Validation Phase:
- Validates update permission for
config_transferfeature - Reads and parses uploaded JSON file from
import_file - Validates imported data structure
- Validates update permission for
-
Feature Validation:
- For each feature in import file:
- Dispatches
/import/validateto the feature plugin - Receives validation result with status and old→new ID mapping
- Collects plugin ID maps
- Dispatches
- For each feature in import file:
-
Dependency Validation:
- Processes dependency items:
- Dispatches
/import/validatefor each dependency - Builds complete ID map (old IDs → newly generated IDs)
- Dispatches
- Processes dependency items:
-
ID Reference Updates:
- Replaces all references in imported data:
APP_IDplaceholder → Target application IDOWNER_IDplaceholder → Importing user's member ID- Old object IDs → Newly generated IDs
- Ensures all cross-references remain valid
- Replaces all references in imported data:
-
Import Execution:
- Imports dependencies first (in correct order)
- Then imports main items
- Dashboard widgets imported last due to dependency on dashboards
- Dispatches
/importevent to each feature plugin for data insertion
-
Data Persistence:
- Each feature plugin manages writing to its own collections
- Maintains referential integrity across features
Database Collections
| Collection | Used for | Data touched by this endpoint |
|---|---|---|
/import | Dispatches | event to feature plugins; Dashboard plugin writes to dashboard collections; Cohorts plugin writes to cohort collections; Segments plugin writes to segment collections; etc. |
Examples
Example 1: Import configuration file to target app
Request (multipart/form-data):
curl -X POST "https://your-server.com/i/import" \
-F "api_key=YOUR_API_KEY" \
-F "app_id=TARGET_APP_ID" \
-F "import_file=@export_config.json;type=application/json"
Where export_config.json contains the JSON array returned by /o/export.
Response:
"Success"
Example 2: Save export, then import to another app
Step 1: Export from source app:
Save the JSON response from /o/export into a file:
curl -G "https://your-server.com/o/export" \
--data-urlencode "api_key=YOUR_API_KEY" \
--data-urlencode "app_id=SOURCE_APP_ID" \
--data-urlencode 'exportData=[{"id":"dashboards","name":"Dashboards","children":[{"id":"DASHBOARD_ID","name":"Dashboard"}]}]' \
> export_config.json
Step 2: Import to target app:
curl -X POST "https://your-server.com/i/import" \
-F "api_key=YOUR_API_KEY" \
-F "app_id=TARGET_APP_ID" \
-F "import_file=@export_config.json;type=application/json"
Response:
"Success"
Limitations
- File size: Import file size limited by server upload limits (typically 100MB).
- File format: Current implementation reads
import_fileand parses it withJSON.parse; archive formats such as.tar.gzare not accepted by this endpoint. - Supported features: Only features that implement
/importand/import/validatedispatches can be imported. Check plugin documentation for import support. - ID replacement mechanism: IDs are replaced using string replacement of
APP_IDandOWNER_IDplaceholders. Custom serialization logic in imported data may break if not handled properly. - Dependency conflicts: If exported item depends on items not being imported, import may fail with validation error from the feature plugin.
- User-specific data: Some user-specific data (permissions, favorites, personal settings) may not be exported depending on feature implementation.
- Ownership: Imported items are assigned to the importing user. Previous ownership is not preserved.
- Duplicate handling: Importing the same configuration twice creates duplicate items (no upsert/merge logic).
Related Endpoints
- Config Transfer - Export
- Dashboards - API Documentation - Dashboard creation and management
- Cohorts - API Documentation - Cohort creation and management
Ⓔ Enterprise
This feature is part of Countly Enterprise.
Get Access:
Already a Customer? Use support portal if you have any questions
Last Updated
2026-02-16