> ## Documentation Index
> Fetch the complete documentation index at: https://docs.go.gbgplc.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Step 6: Fetch journey state

> Track the progress of a journey instance by fetching its current state to determine if it is in progress, completed, or requires further input.

export const VersionWarningBanner = () => {
  const [latestUrl, setLatestUrl] = useState(null);
  useEffect(() => {
    if (typeof window === "undefined") return;
    const {pathname, hash, search} = window.location;
    if (!pathname.includes("/go-v1/")) return;
    setLatestUrl(`${pathname.replace("/go-v1/", "/go-v2/")}${search}${hash}`);
  }, []);
  if (!latestUrl) return null;
  return <div className="not-prose my-6 rounded-xl border border-amber-500/30 bg-amber-500/10 px-4 py-3 text-sm text-gray-800 dark:text-gray-100">
      ⚠️ You are viewing the <strong>GBG GO v1</strong> documentation.
      <a href={latestUrl} className="ml-2 font-medium underline text-amber-700 dark:text-amber-400 hover:text-amber-800 dark:hover:text-amber-300">
        View the latest version (v2) →
      </a>
    </div>;
};

<VersionWarningBanner />

Fetching the journey state allows you to track the progress of a journey instance. It helps you determine whether the journey is still in progress, has completed, or requires further input from the customer.

## When to fetch the journey state

You should check the journey:

* After starting a journey – to confirm it was created successfully
* After submitting task data – to see if the journey progressed or completed
* To monitor progress – during multi-step journeys with multiple tasks
* Before triggering next steps – some workflows depend on the journey being completed
* For troubleshooting – to identify if the journey has stalled

## What you need before fetching

Make sure you have:

* **Access token** – Refer to [Authenticate](/docs/go-v1/developer-integration/execute-customer-journeys/authenticate)
* **Instance ID** – Returned from [Start a journey](/docs/go-v1/developer-integration/execute-customer-journeys/start-a-journey-step)

## API request to fetch state

Send a `POST` request to the [`/journey/state/fetch`](/docs/go-v1/api-reference/endpoint/fetch-journey-state) endpoint. Your request should follow this format:

```bash CURL theme={null}
curl --request POST \
  --url https://eu.platform.go.gbgplc.com/captain/api/journey/state/fetch \
  --header 'Authorization: Bearer your_access_token' \
  --header 'Content-Type: application/json' \
  --data '{
    "instanceId": "your-instance-id"
  }'
```

<Note>
  {" "}

  Replace `"your-instance-id"` with the actual journey instance ID returned when
  the journey was started." "
</Note>

You receive a response in this format:

```json JSON theme={null}
{
  "metaData": {
    "createdTime": "2024-02-15T22:16:33.213Z",
    "completedTime": ""
  },
  "status": "InProgress",
  "data": {},
  "instanceId": "PiIuACmx8Q8R7qPnAkLAqBAT"
}
```

Refer to the [Fetch journey state](/docs/go-v1/api-reference/endpoint/fetch-journey-state) API reference for details on the request and response definitions.

### What happens next?

Depending on the state:

| State         | What it means                                                     |
| ------------- | ----------------------------------------------------------------- |
| `IN_PROGRESS` | The journey is still active. Retrieve remaining tasks.            |
| `COMPLETED`   | The journey is done. No further action is needed.                 |
| `FAILED`      | The journey encountered an error. Review previous steps or retry. |

### Best practices

* Periodically check the state for long-running journeys.
* Always handle `FAILED` states gracefully and retry if appropriate.
* Use the `COMPLETED` state to trigger downstream business logic.

## Next steps

* If the journey is complete, your integration is done.
* If you encountered an error, refer to the [Handle errors](/docs/go-v1/developer-integration/error-handling) guide for troubleshooting tips.
* Check out [best practices](/docs/go-v1/developer-integration/best-practices) for executing customer journeys to help with your integration.
* Use Investigate, a feature in GBG GO to review submitted customer information collected during journey execution. For more information, refer to [Investigate overview](/docs/go-v1/platform/investigate/overview).
