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

# Private Workflows

> Private Workflows in Refold allow linked accounts to create and execute their own workflows.

## Overview

Private Workflows operate in the production environment, enabling real-time automation and execution.

Below is a sample implementation of Private Workflows once you have embedded it into your platform.

<img height="200" src="https://mintcdn.com/cobalt-55/YZVVpdFwo8NtLV-a/images/Concepts/add-public-workflow.png?fit=max&auto=format&n=YZVVpdFwo8NtLV-a&q=85&s=a717513081d9639021efb9af7fd978a5" alt="Creating a Private Workflow" data-path="images/Concepts/add-public-workflow.png" />

Since Private Workflows are designed to be live, any modifications are made in draft mode before being published. Users can:

* Edit the workflow in draft mode.
* Test changes using Workflow Testing.
* Publish the draft to update the live workflow.

Once published, the new workflow state becomes live, ensuring seamless execution.

## Private Workflow Types

Private Workflows can be created at two levels:

<Accordion title="App-Level Private Workflows">
  Created when a user authenticates with an integration (e.g., Salesforce, HubSpot).

  These workflows are tied to the specific app’s linked account.

  <img height="200" src="https://mintcdn.com/cobalt-55/YZVVpdFwo8NtLV-a/images/Concepts/app-public-workflow.png?fit=max&auto=format&n=YZVVpdFwo8NtLV-a&q=85&s=987d48865ddc7bf48beef7adc773f5f9" alt="Public App Workflows" data-path="images/Concepts/app-public-workflow.png" />
</Accordion>

<Accordion title="Account-Level Private Workflows (AI Workflows)">
  These are not linked to any specific integration and are used for internal automation on Refold account level.

  <img height="200" src="https://mintcdn.com/cobalt-55/YZVVpdFwo8NtLV-a/images/Concepts/internal-public-workflow.png?fit=max&auto=format&n=YZVVpdFwo8NtLV-a&q=85&s=26f3e2fd9bddcea170b037c282b22764" alt="Public Internal Conductor Workflows" data-path="images/Concepts/internal-public-workflow.png" />
</Accordion>

## Embed Private Workflows

To embed the Private Workflow into your platform, use the following iframe:

```bash theme={null}
<iframe
    src={ `https://app.gocobalt.io/workflows/${ workflowId }?token=${ cobaltSessionToken }` }
    height="100%"
    width="100%"
    style={{
        border: "none",
    }}
/>
```

You need to provide the [Workflow Id](https://docs.gocobalt.io/api-reference/private_workflows/get_private_workflows) and [Session Token](https://docs.gocobalt.io/api-reference/session-token/generate-token-for-linked-account).

## Creating Private Workflows

To create a Private Workflow, simply use Refold's API

```bash Create Private Workflow theme={null}
curl --request POST \
  --url https://api.gocobalt.io/api/v2/public/workflow \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer {Session_token}' \
  --data '{
  "name": "<string>",
  "slug": "<string>",
  "description": "<string>"
}'
```

<Tip>
  Learn more about the Create Private Workflow API [here](https://docs.gocobalt.io/api-reference/private_workflows/create_private_workflow).
</Tip>

To create a draft or editable version of the workflow, use the following cURL:

```bash Create Draft version theme={null}
curl --request GET \
  --url https://api.gocobalt.io/api/v2/public/workflow/:workflow_id/edit \
  --header 'Authorization: Bearer {Session_token}' \
```

<Tip>
  Learn more about the Create Draft of Workflow API [here](https://docs.gocobalt.io/api-reference/private_workflows/get_draft).
</Tip>

## Editing and Publishing Private Workflows

To modify a workflow, follow these steps:

<Steps>
  <Step title="Navigate to Edit mode">
    Click on the `+ Edit Workflow` button.

    <img height="200" src="https://mintcdn.com/cobalt-55/YZVVpdFwo8NtLV-a/images/Concepts/internal-public-workflow.png?fit=max&auto=format&n=YZVVpdFwo8NtLV-a&q=85&s=26f3e2fd9bddcea170b037c282b22764" alt="Edit a Private Workflow" data-path="images/Concepts/internal-public-workflow.png" />
  </Step>

  <Step title="Update and Publish">
    Make the required changes in the workflow while you are in Edit mode  and click `Publish` to make the workflow live.
    <Note>User config is not available in Private Workflows, so dataslots or mapping selected by the user cannot be used in workflows.</Note>
  </Step>

  <Step title="Save as Draft">
    If you do not wish to publish the changes, click `Cancel`, and the live workflow remains unchanged, while your changes are saved as draft.
    <Info>Draft workflows persist until they are published, allowing users to return and modify them anytime before finalizing.</Info>
  </Step>
</Steps>

## Executing Private Workflows

Private Workflows are triggered just like regular workflows in Refold. The execution depends on the event selected in the Start node.
Once live, the workflow runs based on its configured triggers, ensuring seamless automation.
