Journey Engine - Versions Save
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/versions/save
Overview
Create a new journey version or update blocks for an existing version.
Authentication
Pass api_key or auth_token as a query parameter, or send countly-token as a header. See Authentication.
Permissions
- Required permission:
Createon thejourney_enginefeature
Request Parameters
Request body JSON:
journeyDefinitionId(required): Journey definition IDappId(required): Application IDname(required for create): Version nameblocks(required): Block graph for the version_id(optional): Version ID for update case
Examples
Create new version
POST /i/journey-engine/versions/save
Content-Type: application/json
{
"journeyDefinitionId": "67164f4a1f1bd90d6354430a",
"appId": "64afe321d5f9b2f77cb2c8ed",
"name": "v2",
"blocks": [{"id": "block_1", "subType": "incoming-data"}]
}
Update version blocks
POST /i/journey-engine/versions/save
Content-Type: application/json
{
"_id": "67164f4a1f1bd90d6354430b",
"blocks": [{"id": "block_1", "subType": "incoming-data"}]
}
Response
Success Response
{
"_id": "67164f4a1f1bd90d6354430b",
"journeyDefinitionId": "67164f4a1f1bd90d6354430a",
"version": 2,
"name": "v2",
"status": "draft",
"appId": "64afe321d5f9b2f77cb2c8ed",
"blocks": [
{
"id": "block_1",
"subType": "incoming-data"
}
]
}
Response Fields
| Field | Type | Description |
|---|---|---|
_id | String | Journey version ID |
journeyDefinitionId | String | Journey definition ID |
version | Number | Version number |
name | String | Version name |
status | String | Version status |
appId | String | Application ID |
blocks | Array | Version block graph |
Error Responses
- HTTP 400
{
"result": "Invalid request"
}
- HTTP 500
{
"result": "Failed to update journey version"
}
- HTTP 500
{
"result": "Failed to create journey version"
}
Behavior
- Parses request body JSON and returns
Invalid requestif it is empty. - If
_idis provided, updates onlyblocksfor that existing version and returns the request body. - If
_idis not provided, creates a new version forjourneyDefinitionId. - New version number is computed as the current maximum version number for the definition plus one.
- New versions are always created with status
draft.
Related Endpoints
- No related endpoints
Implementation details
Database Collections
| Collection | Used for | Data touched by this endpoint |
|---|---|---|
countly.journey_versions | Endpoint data source | Stores endpoint-related records this endpoint reads or modifies. |