Skip to main content
Version: 25.03

Update segment metadata

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/segment/edit

Overview​

Updates metadata for one segment under a specific event.

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.
eventKeyStringYesParent event key.
segmentJSON String (Object)YesSegment payload. Uses segment.name and optional type, status, description, required.
api_keyStringConditionalRequired if auth_token is not provided.
auth_tokenStringConditionalRequired if api_key is not provided.

segment Object Structure​

FieldTypeRequiredDescription
nameStringYesSegment key to update.
typeStringNoSegment data type code (for example s, n).
statusStringNoSegment status value.
descriptionStringNoSegment description text.
requiredBoolean/StringNoSegment required flag.

Decoded example:

{
"name": "country",
"type": "s",
"status": "live",
"description": "ISO country code",
"required": true
}

Examples​

/i/data-manager/segment/edit?
app_id=64f5c0d8f4f7ac0012ab3456&
eventKey=purchase&
segment={
"name":"country",
"type":"s",
"status":"approved",
"description":"ISO country",
"required":false
}

Response​

Success Response​

"Success"

Response Fields​

FieldTypeDescription
(root value)StringSuccess when segment update completes.

Error Responses​

  • 500
{
"result": "Error"
}

Behavior​

  • Loads current event metadata and detects segment type changes.
  • Runs migrateDataType(...) for changed type transitions.
  • Updates only provided segment fields (status, description, required) in drill meta.
  • Writes dm-segment-edit system log and invalidates cache.
Implementation details

Audit & System Logs

ActionTriggerPayload
dm-segment-editAfter segment metadata update{ sg: JSON.stringify(segment), ev: eventKey, segment: segment.name }

Database Collections

CollectionUsed forData touched by this endpoint
countly_drill.drill_metaSegment metadata storageUpdates target segment metadata fields (type, status, description, required) under the event metadata document.
countly.appsApp-level type override cache (indirect via type migration helper)Updates override entries when segment type changes require migration bookkeeping.
countly.systemlogsAudit trailWrites dm-segment-edit and type-migration actions for changed segment types.