Skip to main content
Version: 24.05

Journey Engine - Approve or Reject

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

Overview​

Approves or rejects a journey that is waiting for approval. Approving carries out the submitted action (publish, pause or resume); rejecting restores the journey's previous status.

Authentication​

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

Permissions​

  • Required permission: Update on the journey_engine feature
  • Additional rule: the member must be a journey approver or a global admin. Other members get 403.
  • Additional rule: a member who submitted the journey cannot approve it, unless they are a global admin.

Request Parameters​

ParameterTypeRequiredDescription
app_idStringYesApp ID the journey belongs to.
journeyIdStringYesJourney definition ID.
versionIdStringYesID of the version that was submitted for approval.
approveBoolean StringYestrue to approve, false to reject.
reasonStringNoReason for a rejection. Truncated to 1024 characters.

Examples​

Approve a journey​

/i/journey-engine/approve?api_key=YOUR_API_KEY&app_id=YOUR_APP_ID&journeyId=67164f4a1f1bd90d6354430a&versionId=67164f4a1f1bd90d6354430b&approve=true

Reject a journey​

/i/journey-engine/approve?api_key=YOUR_API_KEY&app_id=YOUR_APP_ID&journeyId=67164f4a1f1bd90d6354430a&versionId=67164f4a1f1bd90d6354430b&approve=false&reason=Missing%20consent%20step

Response​

Success Response​

{
"result": "approved",
"status": "active",
"journeyId": "67164f4a1f1bd90d6354430a",
"versionId": "67164f4a1f1bd90d6354430b"
}

Response Fields​

FieldTypeDescription
resultStringapproved or rejected.
statusStringJourney status after the request.
journeyIdStringJourney definition ID.
versionIdStringVersion ID the request acted on.

Error Responses​

HTTP StatusResponse
400Error: ... (missing or invalid journeyId, versionId or approve)
400Journey is not pending approval
400You cannot approve a journey you submitted
400Journey has no submitted version to approve
400Version does not match the one submitted for approval
400Version not found or already active
403You do not have permission to approve or reject journeys
404Journey not found
500Failed to process approval

Behavior​

  • Loads the journey in the given app and requires its status to be pending approval.
  • The version in the request must be the one recorded when the journey was submitted.
  • On approval, the submitted action decides what happens:
    • publish (default): sets all non-deleted versions of the journey to draft, then makes the submitted version active. The journey becomes active.
    • pause: pauses the version. The journey becomes draft.
    • resume: resumes the version. The journey becomes active.
  • On rejection, the journey returns to the status it had before it was submitted (draft if none is recorded). The rejection reason is stored, and the member who submitted the journey is notified by email.
  • Emits journey_<action>_approved or journey_<action>_rejected system log actions.
Implementation details

Database Collections

CollectionUsed forData touched by this endpoint
countly.journey_definitionJourney definitionsReads the journey and updates its status and approval record.
countly.journey_versionsJourney versionsReads and updates version status.
countly.membersMembersReads the submitting member for the rejection email.