Skip to main content

Journey Engine - Versions Duplicate

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/duplicate

Overview

Create a new draft version by duplicating 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: Create on the journey_engine feature

Request Parameters

Request body JSON:

  • id (required): Version ID to duplicate

Examples

POST /i/journey-engine/versions/duplicate
Content-Type: application/json

{
"id": "67164f4a1f1bd90d6354430b"
}

Response

Success Response

{
"_id": "67164f4a1f1bd90d6354430c",
"journeyDefinitionId": "67164f4a1f1bd90d6354430a",
"version": 3,
"name": "v2 copy",
"status": "draft",
"appId": "64afe321d5f9b2f77cb2c8ed",
"blocks": [
{
"id": "block_1",
"subType": "incoming-data"
}
]
}

Response Fields

FieldTypeDescription
_idStringNew journey version ID
journeyDefinitionIdStringJourney definition ID
versionNumberNew version number
nameStringDuplicated version name (<original> copy)
statusStringAlways draft for duplicated version
appIdStringApplication ID
blocksArrayCopied block graph

Error Responses

  • HTTP 404
{
"result": "Version not found"
}
  • HTTP 500
{
"result": "Failed to duplicate version"
}

Behavior

  • Loads the source version by id.
  • Returns Version not found when the source version does not exist.
  • Creates a new version under the same journeyDefinitionId.
  • New version number is computed as the current maximum version number for the definition plus one.
  • New version name is <source name> copy.
  • Copies the source blocks, uses the same appId, and sets status to draft.
  • No related endpoints
Implementation details

Database Collections

CollectionUsed forData touched by this endpoint
countly.journey_versionsEndpoint data sourceStores endpoint-related records this endpoint reads or modifies.