Skip to main content

Import event schema from CSV

Enterprise

This endpoint is part of Countly Enterprise. To get access, contact sales or compare versions. Existing customers can reach the support portal with questions.

Endpoint

/i/data-manager/import-schema

Overview

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

Authentication

Pass api_key or auth_token as a query parameter, or send countly-token as a header. See Authentication.

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.

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

Response

Success Response

"Success"

Response Fields

FieldTypeDescription
(root value)StringSuccess when import completes.

Error Responses

  • 500
{
"result": "Error"
}

Behavior

  • 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.

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.
Implementation details

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.