Skip to main content

Data Migration - Export

Endpoint

/i/datamigration/export

Overview

Starts export generation for one or more apps. It can:

  • generate export archive only,
  • generate shell commands only,
  • or generate and send export to another server.

Authentication

Countly API supports three authentication methods:

  1. API key query parameter: api_key=YOUR_API_KEY
  2. Auth token query parameter: auth_token=YOUR_AUTH_TOKEN
  3. Auth token header: countly-token: YOUR_AUTH_TOKEN

Permissions

Requires data_migration Create permission.

Request Parameters

ParameterTypeRequiredDescription
appsStringYesComma-separated app IDs to export.
only_exportNumber/StringNo1 = export only, 2 = export commands only, other values = export + send.
server_tokenStringConditionalRequired when sending export to remote server (only_export not 1 or 2).
server_addressStringConditionalRequired when sending export to remote server.
target_pathStringNoServer-side path for export archive output.
aditional_filesNumber/StringNo1 enables additional file export (for example symbolication files).
redirect_trafficNumber/StringNo1 enables redirect handoff metadata for completion flow.
argsJSON String (Object)NoOptional JSON-stringified helper args.
api_keyStringConditionalRequired if auth_token is not provided.
auth_tokenStringConditionalRequired if api_key is not provided.

Response

Success Response

Archive mode (only_export=1 or remote-send mode):

{
"result": "f9b35d90be5f2240eafced7c6bfdf130856cd0a7"
}

Command mode (only_export=2):

mongodump '...'
mongodump '...'

Response Fields

FieldTypeDescription
resultStringExport ID for archive/generate-send modes.
(root value)TextRaw command script text in command mode (returnRaw).

Error Responses

  • 404
{
"result": "data-migration.no_app_ids"
}
  • 404
{
"result": "data-migration.token_missing"
}
  • 404
{
"result": "data-migration.address_missing"
}

Behavior/Processing

Behavior Modes

ModeTriggerProcessing PathResponse Shape
Export commands onlyonly_export=2Generates command list and returns downloadable text content.Raw text payload
Export archive onlyonly_export=1Generates export package and records status in migration tracking.Wrapped export ID
Export and sendonly_export missing or other valueValidates remote token/address, generates package, and sends asynchronously.Wrapped export ID

Impact on Other Data

  • Creates/updates migration status records in countly.data_migrations.
  • Creates export artifacts under plugin export workspace.
  • Asynchronous lifecycle updates can trigger send/import phases.

Audit & System Logs

ActionTriggerPayload
export_finished / export_failedExport lifecycle reaches terminal state{ app_ids, status, message }

Database Collections

CollectionUsed forData touched by this endpoint
countly.data_migrationsExport lifecycle trackingCreates/updates export state (step, status, progress, app list, remote send metadata).
countly.systemlogsAudit trailWrites terminal export status actions via progress updater.
countly.* and countly_drill.*Export data sourceReads selected app data for package generation.

Examples

Export archive only

/i/datamigration/export?
apps=6991c75b024cb89cdc04efd2&
only_export=1

Generate export commands only

/i/datamigration/export?
apps=6991c75b024cb89cdc04efd2&
only_export=2

Export and send to remote server

/i/datamigration/export?
apps=6991c75b024cb89cdc04efd2&
server_address=http://target-countly.example.com&
server_token=2fc9d68f6f284f9fa95b93b7d598

Operational Considerations

  • Export processing is asynchronous; returned export ID should be tracked with status endpoints.
  • Export and send mode depends on outbound connectivity to target server.

Last Updated

2026-02-17