---
title: "Reference: Workflow.createRun() | Workflows"
description: Documentation for the `Workflow.createRun()` method in workflows, which creates a new workflow run instance.
packages:
  - "@mastra/core"
---

# Workflow.createRun()

The `.createRun()` method creates a new workflow run instance, allowing you to execute the workflow with specific input data. This is the current API that returns a `Run` instance.

## Usage example

```typescript
await workflow.createRun();
```

## Parameters

<PropertiesTable
  content={[
    {
      name: "runId",
      type: "string",
      description: "Optional custom identifier for the workflow run",
      isOptional: true,
    },
    {
      name: "resourceId",
      type: "string",
      description: "Optional identifier to associate the workflow run with a specific resource (e.g., user ID, tenant ID). This value is persisted with the workflow run and can be used for filtering and querying runs.",
      isOptional: true,
    },
    {
      name: "disableScorers",
      type: "boolean",
      description: "Optional flag to disable scorers for this workflow run",
      isOptional: true,
    },
  ]}
/>

## Returns

<PropertiesTable
  content={[
    {
      name: "run",
      type: "Run",
      description:
        "A new workflow run instance that can be used to execute the workflow",
    },
  ]}
/>

## Extended usage example

```typescript
const workflow = mastra.getWorkflow("workflow");

const run = await workflow.createRun();

const result = await run.start({
  inputData: {
    value: 10,
  },
});
```

## Using resourceId

The `resourceId` parameter associates a workflow run with a specific resource, such as a user or tenant. This is useful for multi-tenant applications or when you need to track which user initiated a workflow.

```typescript
const workflow = mastra.getWorkflow("workflow");

// Create a run associated with a specific user
const run = await workflow.createRun({
  resourceId: "user-123",
});

const result = await run.start({
  inputData: {
    value: 10,
  },
});

// Later, retrieve the run and access the resourceId
const storedRun = await workflow.getWorkflowRunById(run.runId);
console.log(storedRun.resourceId); // "user-123"
```

## Related

- [Run Class](../run)
- [Workflows overview](/docs/v1/workflows/overview)
