Skip to main content

Data Migration - Create Import Token

Endpoint

/o/datamigration/createimporttoken

Overview

Creates a scoped auth token that can call /i/datamigration/import.

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
ttlNumberNoToken TTL in minutes. Default becomes 1 day (86400 seconds) when omitted.
multiBooleanNoIntended multi-use control flag.
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

{
"result": "ea6bc25d4fc04ed8b8af79f0f8f95d89"
}

Response Fields

FieldTypeDescription
resultStringGenerated scoped import token.

Error Responses

  • 404
{
"result": "data-migration.unable-to-create-token"
}

Behavior/Processing

Behavior Modes

ModeTriggerProcessing PathResponse Shape
Token createdAuthorization storage succeedsSaves endpoint-scoped token for /i/datamigration/import.Wrapped token string
Token create failedAuthorization save failsReturns failure key.Wrapped failure key

Impact on Other Data

  • Creates/updates scoped auth token record for import endpoint access.

Database Collections

CollectionUsed forData touched by this endpoint
countly.auth_tokensScoped token storageInserts token record with owner, TTL, endpoint restrictions, and usage policy.

Examples

Create one-day import token

/o/datamigration/createimporttoken?
ttl=1440

Limitations

  • multi is only interpreted as false when passed as a real boolean false value; string values like "false" are treated as multi-use.

Last Updated

2026-02-17