Skip to main content

/i/event_groups/create

Endpoint

/i/event_groups/create

Overview

Create a grouped event definition in countly.event_groups.

Authentication

  • API Key (parameter): api_key=YOUR_API_KEY
  • Auth Token (parameter): auth_token=YOUR_AUTH_TOKEN
  • Auth Token (header): countly-token: YOUR_AUTH_TOKEN

Permissions

  • Requires Create permission on feature core for the app provided in args.app_id.

Request Parameters

ParameterTypeRequiredDescription
api_keyStringYes (or use auth_token)Dashboard API authentication key.
auth_tokenStringYes (or use api_key)Dashboard auth token.
argsJSON String (Object)YesGroup definition object. Must be valid JSON.

args Object Structure

FieldTypeRequiredDescription
app_idStringYesApp ID used for permission validation and document scoping.
nameStringYesGroup display name.
source_eventsArrayYesSource event keys that belong to the group.
display_mapObjectYesDisplay metadata object for the group.
statusBooleanYesGroup active state.
descriptionStringNoOptional description text.

Response

Success Response

{
"result": "Success"
}

Response Fields

FieldTypeDescription
resultStringOperation status message.

Error Responses

Status Code: 400 Bad Request

{
"result": "Error: args not found"
}

Status Code: 400 Bad Request

{
"result": "Error: Invalid type for source_events"
}

Status Code: 400 Bad Request

{
"result": "Missing parameter \"api_key\" or \"auth_token\""
}

Status Code: 401 Unauthorized

{
"result": "No app_id provided"
}

Status Code: 500 Internal Server Error

{
"result": "error: duplicate key error collection: event_groups index: _id_ dup key"
}

Behavior/Processing

Behavior Modes

ModeTriggerProcessing PathResponse Shape
Standard createValid args payload and permissionsValidates required fields and types, generates _id, inserts group document.Wrapped string: { "result": "Success" }

Impact on Other Data

  • This endpoint writes only to event group definitions.
  • It does not update events.overview during creation.

Database Collections

CollectionUsed forData touched by this endpoint
countly.membersAuthentication and permission validationReads member identity and app-level create permissions.
countly.event_groupsGroup definition storageInserts new group record with generated _id, source events, and metadata.

Examples

Example 1: Create enabled group

/i/event_groups/create?api_key=YOUR_API_KEY&args={"app_id":"6991c75b024cb89cdc04efd2","name":"Playback Group","source_events":["Playback Started","Playback Resumed"],"display_map":{},"status":true}

Example 2: Create disabled group with description

/i/event_groups/create?api_key=YOUR_API_KEY&args={"app_id":"6991c75b024cb89cdc04efd2","name":"Campaign Group","source_events":["Campaign Viewed","Campaign Clicked"],"display_map":{},"status":false,"description":"Campaign funnel events"}

Limitations

  • args must be valid JSON.
  • JSON parse failures for args are not handled by a dedicated endpoint error branch.
  • Group ID generation includes timestamp input, so repeated create calls produce different IDs even with the same payload.

Last Updated

2026-02-17