Skip to main content

Import event schema from CSV

Enterprise Only
This API is available exclusively in Countly Enterprise.

Endpoint

/i/data-manager/import-schema

Overview

Imports event/segment schema definitions from a CSV file and upserts metadata.

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_manager Update permission.

Request Parameters

ParameterTypeRequiredDescription
app_idStringYesTarget app ID.
import_fileFileYesCSV schema file uploaded as multipart form-data.
api_keyStringConditionalRequired if auth_token is not provided.
auth_tokenStringConditionalRequired if api_key is not provided.

Response

Success Response

"Success"

Response Fields

FieldTypeDescription
(root value)StringSuccess when import completes.

Error Responses

  • 500
{
"result": "Error"
}

Behavior/Processing

  • Parses CSV with csvtojson from uploaded import_file.
  • Upserts event metadata into countly_drill.drill_meta.
  • Updates countly.events map/list/segments.
  • Inserts missing categories into countly.event_categories.
  • Supports list segment options by writing biglist metadata records.

Audit & System Logs

  • This endpoint does not emit /systemlogs actions.

Database Collections

CollectionUsed forData touched by this endpoint
countly_drill.drill_metaImported event/segment metadata storageBulk-upserts event metadata documents and segment option metadata (biglist records).
countly.eventsEvent list/map/segment indexUpdates app-level event list, segments, and map objects to match imported schema.
countly.event_categoriesCategory dictionaryReads existing categories and inserts new category documents discovered in CSV.

Examples

Endpoint formation

/i/data-manager/import-schema?
app_id=64f5c0d8f4f7ac0012ab3456

Multipart fields

import_file=schema.csv (binary)
app_id=64f5c0d8f4f7ac0012ab3456
api_key=YOUR_API_KEY

Operational Considerations

  • Large schema files can trigger many upserts and category writes in one request.
  • Import updates event metadata and segment definitions together; run during controlled maintenance windows for large schema changes.


Last Updated

2026-02-16