---
displayed_sidebar: workflowsSidebar
slug: /references/workflows/parallelize
sidebar_label: parallelize
---

import ParameterTypes from "@site/src/components/ParameterTypes"

# parallelize - Workflows API Reference

This documentation provides a reference to the `parallelize` . It belongs to the `@medusajs/workflows-sdk` package.

This function is used to run multiple steps in parallel. The result of each step will be returned as part of the result array.

## Example

```ts
import {
  createWorkflow,
  parallelize
} from "@medusajs/workflows-sdk"
import {
  createProductStep,
  getProductStep,
  createPricesStep,
  attachProductToSalesChannelStep
} from "./steps"

interface WorkflowInput {
  title: string
}

const myWorkflow = createWorkflow<
  WorkflowInput,
  Product
>("my-workflow", (input) => {
   const product = createProductStep(input)

   const [prices, productSalesChannel] = parallelize(
     createPricesStep(product),
     attachProductToSalesChannelStep(product)
   )

   const id = product.id
   return getProductStep(product.id)
 }
)
```

## Type Parameters

<ParameterTypes parameters={[
  {
    "name": "TResult",
    "type": "[WorkflowDataProperties](../types/workflows.WorkflowDataProperties.mdx)&#60;unknown&#62;[]",
    "description": "The type of the expected result.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

## Parameters

<ParameterTypes parameters={[
  {
    "name": "steps",
    "type": "`TResult`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

## Returns

<ParameterTypes parameters={[
  {
    "name": "TResult",
    "type": "`TResult`",
    "optional": false,
    "defaultValue": "",
    "description": "The step results. The results are ordered in the array by the order they're passed in the function's parameter.",
    "expandable": false,
    "children": []
  }
]} />
