---
title: "Hosted Application Simulation (v4)"
url: "https://docs.wayflyer.com/embedded-journey-v5-overview/v4-legacy/v4-hosted-application-simulation"
image: "https://docs.wayflyer.com/_og/d/c_Ocean.takumi,title_Hosted+Application+Simulation+(v4),props_eyJ0aGVtZSI6eyJtb2RlIjoibGlnaHQiLCJjb2xvcnMiOnsicHJpbWFyeSI6IiMyMzIzMmQifX19,p_Ii9lbWJlZGRlZC1qb3VybmV5LXY1LW92ZXJ2aWV3L3Y0LWxlZ2FjeS92NC1ob3N0ZWQtYXBwbGljYXRpb24tc2ltdWxhdGlvbiI,s_aFPeDSHnOZmgZwPV.png"
---

## Simulating the Hosted Application

A guide to understanding and using the Hosted Application Simulation API.

> **This page documents v4 (Hosted Application).** v4 is in maintenance mode. New integrations should use [v5 (Embedded Journey)](https://docs.wayflyer.com/embedded-journey-v5-overview). Existing partners can follow the [Migration Guide](https://docs.wayflyer.com/embedded-journey-v5-overview/migration-guide) to upgrade.

## [Overview](#overview)

The Hosted Application Simulation allows you to mimic the behavior of a Hosted Application without interacting with the production APIs. All initial steps for starting a Hosted Application are identical to production, but the simulation environment provides placeholder URLs and endpoints to control state transitions.

Once the call to start the Hosted Application has been made, you will as usual receive a `next` parameter in the response payload. In production, this URL directs users to the Wayflyer funding web application. In the sandbox environment, the `next` parameter points to a placeholder page showing relevant handoff information, providing visual confirmation of a successful handover.

## [Using the Simulation API](#using-the-simulation-api)

Once a Hosted Application has been started, the simulation API allows you to advance the application's lifecycle:

### [Endpoint](#endpoint)

`GET /v1/company/hosted-application/simulation`

### [Response](#response)

```text
{
  "status": "AWAITING_UW_DECISION",
  "valid_actions": ["pass-uw", "fail-uw"]
}
```

-   **status**: The current simulation status of the application. Unlike production, this only changes when a simulation action is performed.
-   **valid\_actions**: A list of actions that can be performed in the current state. An empty list indicates a terminal status with no further actions allowed.

### [Performing Actions](#performing-actions)

To perform a simulation action, send a POST request to the corresponding action endpoint:

```text
POST /v1/company/hosted-application/simulation
{
  "action": "fail-uw",
}
```

-   **Success Response**: 204 No Content
-   **Error Response**: 400 Bad Request _(occurs if the action is invalid, e.g., trying to pass-uw on a terminal application)_

Some actions include additional parameters to model all potential outcomes. For more detail, see the sandbox API documentation.

## [Simulation State Diagram](#simulation-state-diagram)

The full simulation lifecycle is illustrated below:

![simulation diagram](https://cdn.sanity.io/images/1aendizt/production/19666f56cc3c8f32f5c03f45644f8ef1bf5b246c-2000x1958.jpg)

## [Combining with the Call-to-Action API](#combining-with-the-call-to-action-api)

You can combine the simulation API with the CTA API to view the effect these state changes have on the behaviour of the call to action. This allows for a fully representative simulation of the entire Hosted Application lifecycle.