---
title: "Flows"
description: "<p>Create and manage flows that orchestrate multi-step audience journeys.</p>"
url: "https://www.contentstack.com/docs/developers/apis/lytics-api/flows"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2026-11-20"
---

# Flows

Create and manage flows that orchestrate multi-step audience journeys.

## Get flows

### Get flows

**GET** `/v2/flow`

Get all flows for an account. Each version of each flow is returned unless latest=true.

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.
- **latest** (optional)
  Return only the latest version of each flow

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": [
    {
      "aid": 0,
      "created": "2019-08-24T14:15:22Z",
      "description": "string",
      "entry_condition": "in_segment",
      "entry_segment_id": "string",
      "expires_at": "2019-08-24T14:15:22Z",
      "id": "string",
      "label": "string",
      "modified": "2019-08-24T14:15:22Z",
      "reentry_allowed": true,
      "reentry_condition": "in_segment",
      "reentry_delay": 0,
      "root_step_id": 0,
      "state": "draft",
      "state_modified_at": "2019-08-24T14:15:22Z",
      "steps": [
        {
          "affinity_config_id": "string",
          "delay": 0,
          "delay_condition": "string",
          "delay_until": {
            "day_of_week": 0,
            "kind": "day_of_week",
            "time_of_day": "09:30",
            "timezone": "America/New_York"
          },
          "delay_until_enters": [
            "string"
          ],
          "id": 0,
          "label": "string",
          "next": 0,
          "slug": "string",
          "split_affinities": [
            {
              "affinity": "string",
              "label": "string",
              "next": 0,
              "priority": 0
            }
          ],
          "split_conditions": [
            {
              "conditions": "string",
              "label": "string",
              "next": 0,
              "priority": 0
            }
          ],
          "split_probabilities": [
            {
              "next": 0,
              "prob": 0
            }
          ],
          "type_hint": "work_export",
          "work_config": {},
          "work_exit_step_ref": 0,
          "work_id": "string"
        }
      ],
      "version": 0
    }
  ],
  "request_id": "string",
  "status": 0
}
```

## Create or update flow

### Create or update flow

**POST** `/v2/flow`

Create a new flow or update an existing one. The flow id is taken from the request body.

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": {
    "aid": 0,
    "created": "2019-08-24T14:15:22Z",
    "description": "string",
    "entry_condition": "in_segment",
    "entry_segment_id": "string",
    "expires_at": "2019-08-24T14:15:22Z",
    "id": "string",
    "label": "string",
    "modified": "2019-08-24T14:15:22Z",
    "reentry_allowed": true,
    "reentry_condition": "in_segment",
    "reentry_delay": 0,
    "root_step_id": 0,
    "state": "draft",
    "state_modified_at": "2019-08-24T14:15:22Z",
    "steps": [
      {
        "affinity_config_id": "string",
        "delay": 0,
        "delay_condition": "string",
        "delay_until": {
          "day_of_week": 0,
          "kind": "day_of_week",
          "time_of_day": "09:30",
          "timezone": "America/New_York"
        },
        "delay_until_enters": [
          "string"
        ],
        "id": 0,
        "label": "string",
        "next": 0,
        "slug": "string",
        "split_affinities": [
          {
            "affinity": "string",
            "label": "string",
            "next": 0,
            "priority": 0
          }
        ],
        "split_conditions": [
          {
            "conditions": "string",
            "label": "string",
            "next": 0,
            "priority": 0
          }
        ],
        "split_probabilities": [
          {
            "next": 0,
            "prob": 0
          }
        ],
        "type_hint": "work_export",
        "work_config": {},
        "work_exit_step_ref": 0,
        "work_id": "string"
      }
    ],
    "version": 0
  },
  "request_id": "string",
  "status": 0
}
```

## Get flow states

### Get flow states

**GET** `/v2/flow/state`

Get all possible flow state values (step slugs / personalization keys) for the account.

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": [
    "string"
  ],
  "request_id": "string",
  "status": 0
}
```

## Get flow

### Get flow

**GET** `/v2/flow/{name}`

Get a flow by name. All versions are returned unless latest=true.

#### URL Parameters

- **name** (required)
  The flow name

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.
- **latest** (optional)
  Return only the latest version of the flow

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": {
    "aid": 0,
    "created": "2019-08-24T14:15:22Z",
    "description": "string",
    "entry_condition": "in_segment",
    "entry_segment_id": "string",
    "expires_at": "2019-08-24T14:15:22Z",
    "id": "string",
    "label": "string",
    "modified": "2019-08-24T14:15:22Z",
    "reentry_allowed": true,
    "reentry_condition": "in_segment",
    "reentry_delay": 0,
    "root_step_id": 0,
    "state": "draft",
    "state_modified_at": "2019-08-24T14:15:22Z",
    "steps": [
      {
        "affinity_config_id": "string",
        "delay": 0,
        "delay_condition": "string",
        "delay_until": {
          "day_of_week": 0,
          "kind": "day_of_week",
          "time_of_day": "09:30",
          "timezone": "America/New_York"
        },
        "delay_until_enters": [
          "string"
        ],
        "id": 0,
        "label": "string",
        "next": 0,
        "slug": "string",
        "split_affinities": [
          {
            "affinity": "string",
            "label": "string",
            "next": 0,
            "priority": 0
          }
        ],
        "split_conditions": [
          {
            "conditions": "string",
            "label": "string",
            "next": 0,
            "priority": 0
          }
        ],
        "split_probabilities": [
          {
            "next": 0,
            "prob": 0
          }
        ],
        "type_hint": "work_export",
        "work_config": {},
        "work_exit_step_ref": 0,
        "work_id": "string"
      }
    ],
    "version": 0
  },
  "request_id": "string",
  "status": 0
}
```

## Create or update flow by name

### Create or update flow by name

**POST** `/v2/flow/{name}`

Create a new flow or update an existing one. When the body has no id, the name path param is used as the flow id.

#### URL Parameters

- **name** (required)
  The flow name (used as the flow id when the body has no id)

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": {
    "aid": 0,
    "created": "2019-08-24T14:15:22Z",
    "description": "string",
    "entry_condition": "in_segment",
    "entry_segment_id": "string",
    "expires_at": "2019-08-24T14:15:22Z",
    "id": "string",
    "label": "string",
    "modified": "2019-08-24T14:15:22Z",
    "reentry_allowed": true,
    "reentry_condition": "in_segment",
    "reentry_delay": 0,
    "root_step_id": 0,
    "state": "draft",
    "state_modified_at": "2019-08-24T14:15:22Z",
    "steps": [
      {
        "affinity_config_id": "string",
        "delay": 0,
        "delay_condition": "string",
        "delay_until": {
          "day_of_week": 0,
          "kind": "day_of_week",
          "time_of_day": "09:30",
          "timezone": "America/New_York"
        },
        "delay_until_enters": [
          "string"
        ],
        "id": 0,
        "label": "string",
        "next": 0,
        "slug": "string",
        "split_affinities": [
          {
            "affinity": "string",
            "label": "string",
            "next": 0,
            "priority": 0
          }
        ],
        "split_conditions": [
          {
            "conditions": "string",
            "label": "string",
            "next": 0,
            "priority": 0
          }
        ],
        "split_probabilities": [
          {
            "next": 0,
            "prob": 0
          }
        ],
        "type_hint": "work_export",
        "work_config": {},
        "work_exit_step_ref": 0,
        "work_id": "string"
      }
    ],
    "version": 0
  },
  "request_id": "string",
  "status": 0
}
```

## Delete flow

### Delete flow

**DELETE** `/v2/flow/{name}`

Delete all versions of a flow by name.

#### URL Parameters

- **name** (required)
  The flow name

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": {},
  "request_id": "string",
  "status": 0
}
```

## Get flow version

### Get flow version

**GET** `/v2/flow/{name}/{version}`

Get a specific version of a flow by name and version.

#### URL Parameters

- **name** (required)
  The flow name
- **version** (required)
  The flow version

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": {
    "aid": 0,
    "created": "2019-08-24T14:15:22Z",
    "description": "string",
    "entry_condition": "in_segment",
    "entry_segment_id": "string",
    "expires_at": "2019-08-24T14:15:22Z",
    "id": "string",
    "label": "string",
    "modified": "2019-08-24T14:15:22Z",
    "reentry_allowed": true,
    "reentry_condition": "in_segment",
    "reentry_delay": 0,
    "root_step_id": 0,
    "state": "draft",
    "state_modified_at": "2019-08-24T14:15:22Z",
    "steps": [
      {
        "affinity_config_id": "string",
        "delay": 0,
        "delay_condition": "string",
        "delay_until": {
          "day_of_week": 0,
          "kind": "day_of_week",
          "time_of_day": "09:30",
          "timezone": "America/New_York"
        },
        "delay_until_enters": [
          "string"
        ],
        "id": 0,
        "label": "string",
        "next": 0,
        "slug": "string",
        "split_affinities": [
          {
            "affinity": "string",
            "label": "string",
            "next": 0,
            "priority": 0
          }
        ],
        "split_conditions": [
          {
            "conditions": "string",
            "label": "string",
            "next": 0,
            "priority": 0
          }
        ],
        "split_probabilities": [
          {
            "next": 0,
            "prob": 0
          }
        ],
        "type_hint": "work_export",
        "work_config": {},
        "work_exit_step_ref": 0,
        "work_id": "string"
      }
    ],
    "version": 0
  },
  "request_id": "string",
  "status": 0
}
```

## Delete flow version

### Delete flow version

**DELETE** `/v2/flow/{name}/{version}`

Delete a single version of a flow by name and version.

#### URL Parameters

- **name** (required)
  The flow name
- **version** (required)
  The flow version

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": {},
  "request_id": "string",
  "status": 0
}
```

## Create flow step work

### Create flow step work

**POST** `/v2/flow/{name}/{version}/{step}/work`

Create the work for a given step of a flow version.

#### URL Parameters

- **name** (required)
  The flow name
- **version** (required)
  The flow version
- **step** (required)
  The flow step id

#### Query Parameters

- **account_id** (optional)
  The account ID. Defaults to the user's default account.

#### Headers

- **Authorization** (optional)

#### Sample Response

```json
{
  "_meta": {},
  "data": {
    "account_id": "string",
    "aid": 0,
    "auth_ids": [
      "string"
    ],
    "config": {},
    "created": "2019-08-24T14:15:22Z",
    "description": "string",
    "expires_at": "2019-08-24T14:15:22Z",
    "id": "string",
    "name": "string",
    "tag": "string",
    "updated": "2019-08-24T14:15:22Z",
    "workflow": "string",
    "workflow_id": "string"
  },
  "request_id": "string",
  "status": 0
}
```