What you need
Before sending the request, make sure you have:- Access token: Obtained in Step 1: Authenticate.
- Instance ID: The
instanceIdreturned when you started the journey.
Fetch journey state
Send aPOST request to the /journey/state/fetch endpoint:
BASH
Request body fields
Journey pending response:
If the end user has not yet completed the hosted journey, the response contains:JSON
Journey completed response:
Once the end user completes the hosted journey:JSON
Response fields
Journey lifecycle states
Polling for completion
Poll the state fetch endpoint at regular intervals until the journey completes:- Begin polling after sharing the
instanceUrlwith the end user. - Stop polling when
statuschanges toCompletedorFailed.
Recommended polling settings
Using webhooks as an alternative
Instead of polling, you can configure webhooks to receive real-time notifications when a journey completes or fails. This eliminates the need for repeated API calls and allows your backend to react immediately to status changes. To set up webhooks, refer to the Webhook module guide.Best practices
- Do not share your access token with the frontend. All polling should be done from your backend server.
- Handle the
Failedstatus gracefully. Inspect the response for error details and determine whether the journey should be retried or escalated.