> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Sample Flows

## Article: Sample Flows

## Article Link: https://dev.wix.com/docs/api-reference/mobile/containers-app/containers-projects/project-v1/sample-flows.md

## Article Content:

# Containers Projects API: Sample Flows

This article presents possible use cases and corresponding sample flows that you can support. It provides a useful starting point as you plan your implementation.

## Save a design change and preview it

When a user changes the design of their app, such as its colors or fonts, your app saves the change as a new draft release and shows the user a preview. The project's live app doesn't change. This flow is for projects whose `platform` is `HIMALAYA_MOBILE`.

To save a design change and preview it:

1. Call [Get Project](https://dev.wix.com/docs/api-reference/mobile/containers-app/containers-projects/project-v1/get-project.md) with the project's ID. Save the returned `project.headReleaseId`. This is the release that your app shows to the user.

1. Call [Get Himalaya Authorization](https://dev.wix.com/docs/api-reference/mobile/containers-app/containers-projects/project-v1/get-himalaya-authorization.md) with the project's ID. Check that `saveDesign` is `true`, and save the returned `canonicalApp`.

1. Call [Save Project Design](https://dev.wix.com/docs/api-reference/mobile/containers-app/containers-projects/project-v1/save-project-design.md) with these values:

    - `projectId`: The project's ID.
    - `baseReleaseId`: The release ID that you saved in step 1.
    - `tokensJson`: The complete design-token document, including the user's change.
    - `himalayaControlToken`: A short-lived control credential for the project's app releases.
    - `canonicalApp`: The value that you saved in step 2.
    - `conversationId`: The ID of the conversation that the user is viewing, to add a checkpoint for the saved version.

1. Use the returned `previewToken` to show the user a preview of the saved release. The token expires at `previewTokenExpiresAt`. Save the returned `himalayaReleaseId`, so the user can go back to this version later.

## Restore an earlier version of a project

When a user wants to go back to a version of their app that they saved earlier, your app restores that release. The restored release becomes the base for the next design save or edit, and the live app doesn't change.

To restore an earlier version of a project:

1. Each time you call [Save Project Design](https://dev.wix.com/docs/api-reference/mobile/containers-app/containers-projects/project-v1/save-project-design.md), store the returned `himalayaReleaseId`, so you can show the user a list of saved versions.

1. When the user selects a version, call [Restore Release](https://dev.wix.com/docs/api-reference/mobile/containers-app/containers-projects/project-v1/restore-release.md) with the project's ID and the selected release ID in `releaseId`. Specify `himalayaControlToken` to confirm that the release belongs to the project, and `conversationId` to add a checkpoint for the restored version.

1. Show the user the restored release. The returned `project.headReleaseId` is now the restored release ID. Use it as `baseReleaseId` the next time you call [Save Project Design](https://dev.wix.com/docs/api-reference/mobile/containers-app/containers-projects/project-v1/save-project-design.md).

## Resume work on a project

When a user returns to a project that the coding agent has already built, your app resumes the project so the coding agent can continue to work on it. This flow is for projects whose `platform` is `HIMALAYA_MOBILE`.

To resume work on a project:

1. Call [Get Project](https://dev.wix.com/docs/api-reference/mobile/containers-app/containers-projects/project-v1/get-project.md) with the project's ID. Check that `project.status` is `BUILDING`.

1. Call [Get Himalaya Authorization](https://dev.wix.com/docs/api-reference/mobile/containers-app/containers-projects/project-v1/get-himalaya-authorization.md) with the project's ID. Check that `workerLaunch` is `true`.

1. Call [Resume Project](https://dev.wix.com/docs/api-reference/mobile/containers-app/containers-projects/project-v1/resume-project.md) with the project's ID. The project's remote development environment starts in the background.

1. Call [Send Message](https://dev.wix.com/docs/api-reference/mobile/containers-app/containers-chat/send-message.md) in the Containers Chat API with the user's request. The coding agent picks up the request when the environment is ready. To track the response, poll [Query Messages](https://dev.wix.com/docs/api-reference/mobile/containers-app/containers-chat/query-messages.md).