Skip to main content
Version: 24.05

Create Custom Event

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/journey-engine/event

Overview​

Creates a custom event for journey flows and registers it in both event metadata and Drill metadata.

Authentication​

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

Permissions​

  • Required permission: Create on the journey_engine feature

Request Parameters​

ParameterTypeRequiredDescription
api_keyStringYes (or auth_token)API key authentication
auth_tokenStringYes (or api_key)Auth token authentication
app_idStringYesApplication identifier
eventObject (JSON string)YesStringified custom event definition

event Object Fields​

FieldTypeRequiredDescription
keyStringYesEvent key (normalized by common.fixEventKey)
nameStringYesEvent display name
descriptionStringNoEvent description
segmentsArrayYesSegment definitions used for event metadata
segments[].nameStringYesSegment key

Examples​

Endpoint form:

https://your-server.com/i/journey-engine/event?api_key=YOUR_API_KEY&app_id=64afe321d5f9b2f77cb2c8ed&event={"key":"purchase","name":"Purchase","description":"Order completed","segments":[{"name":"amount","type":"number"}]}

Decoded event object:

{
"key": "purchase",
"name": "Purchase",
"description": "Order completed",
"segments": [
{
"name": "amount",
"type": "number"
}
]
}

Response​

Success Response​

"Success"

Response Fields​

FieldTypeDescription
(root value)StringOperation status

Error Responses​

HTTP StatusResponse
500{ "result": "Error" }

Behavior​

  1. Parses event from query string.
  2. Validates and normalizes event key.
  3. Writes event metadata into events collection.
  4. Writes Drill metadata into drill_meta collection.
  5. Logs creation in system logs.
Implementation details

Database Collections

CollectionUsed forData touched by this endpoint
countly.eventsEndpoint data source** - Updates event map/list/segment metadata for the app
countly_drill.drill_metaEndpoint data source** - Creates Drill event metadata