---
title: "Create a new workflow"
method: POST
path: "/hub/workflows"
tags: ["Workflows"]
---

# Create a new workflow

`POST /hub/workflows`

Creates a new workflow for defining node sequences

## Request body

- CreateWorkflowRequest
  - `name` string, required — Name of the workflow
  - `collection` string, required — Subject of the collection this workflow belongs to
  - `description` string — Optional description of the workflow
  - `config` WorkflowConfig
    - `nodes` object[] — Array of nodes in the workflow
      - `data` NodeData
        - `id` string — Unique identifier for the node
        - `name` string — Name of the node
        - `description` string — Description of the node
        - `node_type` 'function' | 'flow' | 'condition' | 'map' | 'eval' | 'integration' — ## Node Types ### 1. `function` **Definition**: A **Hydra function node** used to provide a *subject* or perform a custom computation. It encapsulates reusable logic defined within the Hydra platform. ### 2. `flow` **Definition**: A node that **invokes another flow**, either **synchronously** or **asynchronously**, enabling flow modularization and reuse. ### 3. `condition` **Definition**: A **branching node** that evaluates a condition to determine the **flow of execution**, similar to `if`/`else` logic in programming. ### 4. `map` **Definition**: A **data transformation node** used to **reshape or remap the payload**, allowing the flow to adapt the structure of data as it progresses. ### 5. `eval` **Definition**: Executes **simple JavaScript code** to dynamically **evaluate expressions**, perform calculations, or manipulate data inline within the flow. ### 6. `integration` **Definition**: Similar to a `function` node, but specifically tied to **predefined APIs**. It uses an HTTP-like interface and references **a known set of external services** managed by the platform.
        - `subject` string — Subject identifier for function or flow node types
        - `payload` unknown
        - `response_map` unknown
        - `options` NodeOptions — Node execution options
          - `flat_map` boolean — Whether to flatten the response
          - `backoff_ms` integer — Backoff duration in milliseconds - how long to wait before next attempt. Applies to function and flow nodes only.
          - `timeout` integer — Timeout duration in milliseconds. Applies to function and flow nodes only.
          - `attempts` integer — Number of retry attempts. Applies to function and flow nodes only.
          - `ignore_response_codes` integer[] — List of HTTP response codes to ignore. Applies to function nodes only.
        - `await` boolean — Whether to wait for completion nad return the result
      - `position` object — Visual position of the node in the workflow editor
      - `style` object — Visual styling of the node
    - `edges` Edge[] — Array of edges connecting nodes in the workflow
      - `source` string, required — ID of the source node
      - `target` string, required — ID of the target node
      - `id` string — Optional unique identifier for the edge
      - `sourceHandle` string — Optional source handle identifier
      - `targetHandle` string — Optional target handle identifier
    - `static` object — Static data available to all nodes in the workflow
    - `result` string — Expression to determine the final result of the workflow
    - `options` object
      - `run_type` 'debounced' | 'ordered' — Execution mode for the workflow
      - `order_on` string — Field to order workflow executions by
      - `debounce_on` string — Field to debounce workflow executions on
      - `debounce_time` integer — Debounce time in milliseconds
      - `debounce_max` integer — Maximum debounce time in milliseconds

## Response `201`

Workflow created successfully

- CreateWorkflowResponse
  - `subject` string — Subject identifier for the workflow
  - `name` string — Name of the workflow
  - `collection` string — Subject of the collection this workflow belongs to
  - `description` string — Description of the workflow
  - `config` WorkflowConfig
    - `nodes` object[] — Array of nodes in the workflow
      - `data` NodeData
        - `id` string — Unique identifier for the node
        - `name` string — Name of the node
        - `description` string — Description of the node
        - `node_type` 'function' | 'flow' | 'condition' | 'map' | 'eval' | 'integration' — ## Node Types ### 1. `function` **Definition**: A **Hydra function node** used to provide a *subject* or perform a custom computation. It encapsulates reusable logic defined within the Hydra platform. ### 2. `flow` **Definition**: A node that **invokes another flow**, either **synchronously** or **asynchronously**, enabling flow modularization and reuse. ### 3. `condition` **Definition**: A **branching node** that evaluates a condition to determine the **flow of execution**, similar to `if`/`else` logic in programming. ### 4. `map` **Definition**: A **data transformation node** used to **reshape or remap the payload**, allowing the flow to adapt the structure of data as it progresses. ### 5. `eval` **Definition**: Executes **simple JavaScript code** to dynamically **evaluate expressions**, perform calculations, or manipulate data inline within the flow. ### 6. `integration` **Definition**: Similar to a `function` node, but specifically tied to **predefined APIs**. It uses an HTTP-like interface and references **a known set of external services** managed by the platform.
        - `subject` string — Subject identifier for function or flow node types
        - `payload` unknown
        - `response_map` unknown
        - `options` NodeOptions — Node execution options
          - `flat_map` boolean — Whether to flatten the response
          - `backoff_ms` integer — Backoff duration in milliseconds - how long to wait before next attempt. Applies to function and flow nodes only.
          - `timeout` integer — Timeout duration in milliseconds. Applies to function and flow nodes only.
          - `attempts` integer — Number of retry attempts. Applies to function and flow nodes only.
          - `ignore_response_codes` integer[] — List of HTTP response codes to ignore. Applies to function nodes only.
        - `await` boolean — Whether to wait for completion nad return the result
      - `position` object — Visual position of the node in the workflow editor
      - `style` object — Visual styling of the node
    - `edges` Edge[] — Array of edges connecting nodes in the workflow
      - `source` string, required — ID of the source node
      - `target` string, required — ID of the target node
      - `id` string — Optional unique identifier for the edge
      - `sourceHandle` string — Optional source handle identifier
      - `targetHandle` string — Optional target handle identifier
    - `static` object — Static data available to all nodes in the workflow
    - `result` string — Expression to determine the final result of the workflow
    - `options` object
      - `run_type` 'debounced' | 'ordered' — Execution mode for the workflow
      - `order_on` string — Field to order workflow executions by
      - `debounce_on` string — Field to debounce workflow executions on
      - `debounce_time` integer — Debounce time in milliseconds
      - `debounce_max` integer — Maximum debounce time in milliseconds
  - `modified` integer — Timestamp of last modification

## Other responses

- `400` — Bad request
- `404` — Resource not found
- `409` — Workflow already exists

---

[API](https://skmtc.net/quivaworks/apis/quiva-ai-gateway-3.md) · [All operations](https://skmtc.net/quivaworks/apis/quiva-ai-gateway-3/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/quivaworks/quiva-ai-gateway-3/revisions/872d6eb3b682/schema)
