---
title: "Create or update flow by name"
method: POST
path: "/flow/{name}"
tags: ["Flows"]
---

# Create or update flow by name

`POST /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.

## Path parameters

- `name` string, required

## Query parameters

- `account_id` string

## Request body

- ModelsFlow
  - `aid` integer
  - `created` string, date-time
  - `description` string
  - `entry_condition` 'in_segment' | 'on_segment_entry'
  - `entry_segment_id` string
  - `expires_at` string, date-time
  - `id` string
  - `label` string
  - `modified` string, date-time
  - `reentry_allowed` boolean
  - `reentry_condition` 'in_segment' | 'on_segment_entry'
  - `reentry_delay` integer — Nanoseconds to wait before a profile may re-enter the flow.
  - `root_step_id` integer
  - `state` 'draft' | 'running' | 'draining' | 'deleted'
  - `state_modified_at` string, date-time
  - `steps` ModelsFlowStep[]
    - `affinity_config_id` string
    - `delay` integer — Nanoseconds to wait at this step. Mutually exclusive with delay_until.
    - `delay_condition` string
    - `delay_until` ModelsDelayUntil
      - `day_of_week` 0 | 1 | 2 | 3 | 4 | 5 | 6
      - `kind` 'day_of_week' | 'time_of_day'
      - `time_of_day` string
      - `timezone` string
    - `delay_until_enters` string[]
    - `id` integer
    - `label` string
    - `next` integer
    - `slug` string
    - `split_affinities` ModelsSplitAffinityKV[]
      - `affinity` string
      - `label` string
      - `next` integer
      - `priority` integer
    - `split_conditions` ModelsSplitConditionKV[]
      - `conditions` string
      - `label` string
      - `next` integer
      - `priority` integer
    - `split_probabilities` ModelsSplitProbKV[]
      - `next` integer
      - `prob` number
    - `type_hint` 'work_export' | 'delay' | 'conditional' | 'affinity' | 'ab_testing' | 'work_export_exit'
    - `work_config` object
    - `work_exit_step_ref` integer
    - `work_id` string
  - `version` integer

## Response `200`

Updated Flow

- object
  - `_meta` object — Response Metadata
  - `data` object — Response Payload
    - `aid` integer
    - `created` string, date-time
    - `description` string
    - `entry_condition` 'in_segment' | 'on_segment_entry'
    - `entry_segment_id` string
    - `expires_at` string, date-time
    - `id` string
    - `label` string
    - `modified` string, date-time
    - `reentry_allowed` boolean
    - `reentry_condition` 'in_segment' | 'on_segment_entry'
    - `reentry_delay` integer — Nanoseconds to wait before a profile may re-enter the flow.
    - `root_step_id` integer
    - `state` 'draft' | 'running' | 'draining' | 'deleted'
    - `state_modified_at` string, date-time
    - `steps` ModelsFlowStep[]
      - `affinity_config_id` string
      - `delay` integer — Nanoseconds to wait at this step. Mutually exclusive with delay_until.
      - `delay_condition` string
      - `delay_until` ModelsDelayUntil
        - `day_of_week` 0 | 1 | 2 | 3 | 4 | 5 | 6
        - `kind` 'day_of_week' | 'time_of_day'
        - `time_of_day` string
        - `timezone` string
      - `delay_until_enters` string[]
      - `id` integer
      - `label` string
      - `next` integer
      - `slug` string
      - `split_affinities` ModelsSplitAffinityKV[]
        - `affinity` string
        - `label` string
        - `next` integer
        - `priority` integer
      - `split_conditions` ModelsSplitConditionKV[]
        - `conditions` string
        - `label` string
        - `next` integer
        - `priority` integer
      - `split_probabilities` ModelsSplitProbKV[]
        - `next` integer
        - `prob` number
      - `type_hint` 'work_export' | 'delay' | 'conditional' | 'affinity' | 'ab_testing' | 'work_export_exit'
      - `work_config` object
      - `work_exit_step_ref` integer
      - `work_id` string
    - `version` integer
  - `request_id` string
  - `status` integer — HTTP Status Code

## Other responses

- `201` — Created Flow
- `400` — Bad Request
- `404` — Not Found
- `500` — Internal Server Error

---

[API](https://skmtc.net/lytics/apis/lytics-api.md) · [All operations](https://skmtc.net/lytics/apis/lytics-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/lytics/lytics-api/revisions/366eeabcb6de/schema)
