Skip to main content
Version: 25.03

Journey Engine - Approve or Reject Journey

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 returns the journey to its 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 an approver (journey_approver) or a global admin. Other members get 403.
  • A member cannot approve or reject a journey they submitted themselves, unless they are a global admin.

Request Parameters​

ParameterTypeRequiredDescription
api_keyStringYes (or auth_token)API key authentication
auth_tokenStringYes (or api_key)Auth token authentication
app_idStringYesApp ID
journeyIdStringYesJourney definition ID.
versionIdStringYesID of the journey version that was submitted for approval.
approveBoolean StringYestrue to approve, false to reject.
reasonStringNoReason for a rejection. Only the first 1024 characters are kept.

Examples​

Example 1: Approve a journey​

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

Example 2: 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%20content

Response​

Success Response​

Approved:

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

Rejected:

{
"result": "rejected",
"status": "draft",
"journeyId": "67164f4a1f1bd90d6354430a",
"versionId": "67164f4a1f1bd90d6354430b"
}

Response Fields​

FieldTypeDescription
resultStringapproved or rejected.
statusStringThe journey's status after the decision.
journeyIdStringJourney definition ID.
versionIdStringID of the journey version that was decided 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​

  • Looks up the journey in the given app. It must have the status pending_approval.
  • versionId must be the version that was submitted for approval.
  • On approval, the submitted action is carried out:
    • publish (default): the submitted version becomes the active version, all other non-deleted versions of the journey become drafts, and the journey becomes active.
    • pause: the version is paused and the journey becomes draft.
    • resume: the version is resumed and the journey becomes active.
  • On rejection, the journey goes back to the status it had before it was submitted (or draft if none was recorded), and the reason is stored. If the submitting member is found, they are sent a rejection email with the reason.
  • The approver and the time of the decision are stored on the journey.
  • Writes a system log entry (journey_<action>_approved or journey_<action>_rejected).
Implementation details

Database Collections

CollectionUsed forData touched by this endpoint
countly.journey_definitionJourney definitionsReads the journey; updates its status and approval details.
countly.journey_versionsJourney versionsUpdates version statuses when publishing, pausing or resuming.
countly.membersDashboard membersReads the submitting member for the rejection email.
countly.systemlogsAudit trailReceives the approval or rejection entry.