Skip to main content

Update segment status

Enterprise Only
This API is available exclusively in Countly Enterprise.

Endpoint

/i/data-manager/segment/toggle-status

Overview

Sets status for one or more event segments.

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.
statusStringYesNew segment status.
eventSegmentsJSON String (Array)YesArray of { "event": "...", "segment": "..." } objects.
api_keyStringConditionalRequired if auth_token is not provided.
auth_tokenStringConditionalRequired if api_key is not provided.

eventSegments Array Structure

Each array item defines one event-segment pair to update.

FieldTypeRequiredDescription
eventStringYesEvent key.
segmentStringYesSegment key under the event.

Decoded example:

[
{ "event": "purchase", "segment": "country" },
{ "event": "purchase", "segment": "price" }
]

Configuration Impact

SettingDefaultAffectsUser-visible impact
data-manager.allowUnplannedEventsALLOWParent event visibility assignment when status=unplannedIf set to ALLOW, parent events can remain visible for unplanned segment status; if set to DISALLOW, parent visibility is forced hidden.

Response

Success Response

"Success"

Response Fields

FieldTypeDescription
(root value)StringSuccess when status updates are applied.

Error Responses

  • 500
{
"result": "Error"
}

Behavior/Processing

  • Updates segment status in countly_drill.drill_meta for each event+segment pair.
  • Updates parent event is_visible in countly.events using status visibility rules.
  • Writes dm-segment-edit system log entries.
  • Invalidates cache.

Audit & System Logs

ActionTriggerPayload
dm-segment-editPer-segment status update{ segment, ev, status }
dm-segment-editSummary log after all selected segments are processed{ ev: [eventKeys] }

Database Collections

CollectionUsed forData touched by this endpoint
countly_drill.drill_metaSegment status storageUpdates sg.{segment}.status for each requested event/segment pair.
countly.eventsParent event visibility mapUpdates map.{event}.is_visible based on the requested status and unplanned-event config.
countly.systemlogsAudit trailWrites per-segment and summary dm-segment-edit log entries.

Examples

Set segments to live

/i/data-manager/segment/toggle-status?
app_id=64f5c0d8f4f7ac0012ab3456&
status=live&
eventSegments=[
{"event":"purchase","segment":"country"},
{"event":"purchase","segment":"price"}
]

Set segments to unplanned

/i/data-manager/segment/toggle-status?
app_id=64f5c0d8f4f7ac0012ab3456&
status=unplanned&
eventSegments=[
{"event":"purchase","segment":"country"}
]

Operational Considerations

  • Each segment update can also change parent event visibility, so one call may affect multiple event-map entries.


Last Updated

2026-02-16