---
title: "Copy a Workflow"
method: POST
path: "/v3/workflows/copy"
tags: ["Workflows"]
---

# Copy a Workflow

`POST /v3/workflows/copy`

**Copy a workflow to a new name.**

Forks the source workflow's current version into a brand-new
workflow at `versionNum: 1`. The full node graph and edges are
carried over, but the *functions* the copied nodes reference are
shared, not duplicated — both workflows now point at the same
functions.

Useful for forking a production workflow to test a topology change
without disturbing the live caller.

## Request body

- WorkflowCopyRequest
  - `sourceWorkflowName` string, required — Name of the source workflow to copy from.
  - `sourceWorkflowVersionNum` integer — Optional version number of the source workflow to copy. If not provided, copies the current version.
  - `targetEnvironment` string — Optional target environment name. If provided, copies the workflow to a different environment. When copying to a different environment, all functions used in the workflow will also be copied.
  - `targetWorkflowName` string, required — Name for the new copied workflow. Must be unique within the target environment.
  - `targetDisplayName` string — Optional display name for the copied workflow. If not provided, uses the source workflow's display name with " (Copy)" appended.
  - `tags` string[] — Optional tags for the copied workflow. If not provided, uses the source workflow's tags.

## Response `200`

The request has succeeded.

- WorkflowCopyResponseV3
  - `environment` string — The environment the workflow was copied to.
  - `workflow` WorkflowV3 — V3 read representation of a workflow version.
    - `id` string, required — Unique identifier of the workflow.
    - `name` string, required — Unique name of the workflow within the environment.
    - `versionNum` integer, required — Version number of this workflow version.
    - `displayName` string — Human-readable display name.
    - `emailAddress` string — Inbound email address associated with the workflow, if any.
    - `tags` string[] — Tags associated with the workflow.
    - `mainNodeName` string, required — Name of the entry-point call-site node.
    - `nodes` WorkflowNodeResponse[], required — All call-site nodes in this workflow version's DAG.
      - `name` string, required — Name of this call site, unique within the workflow version.
      - `function` FunctionVersionIdentifier, required
        - `id` string — Unique identifier of function. Provide either id or name, not both.
        - `name` string — Name of function. Must be UNIQUE on a per-environment basis. Provide either id or name, not both.
        - `versionNum` integer — Version number of function.
      - `metadata` object — Opaque free-form JSON object attached to this node on create/update. Returned verbatim; never interpreted by the server.
    - `edges` WorkflowEdgeResponse[], required — All directed edges in this workflow version's DAG.
      - `sourceNodeName` string, required — Name of the source node.
      - `destinationName` string — Labelled outlet on the source node, if any.
      - `destinationNodeName` string, required — Name of the destination node.
      - `metadata` object — Opaque free-form JSON object attached to this edge on create/update. Returned verbatim; never interpreted by the server.
    - `connectors` WorkflowConnector[], required — Connectors currently attached to this workflow. For version-scoped reads (`/versions/{n}`) this is always empty — connectors are current-state and not part of version history.
      - `connectorID` string, required — Unique connector API ID.
      - `name` string, required — Human-friendly connector name.
      - `type` 'paragon', required — Discriminator for a workflow connector. V3 supports `paragon` only.
      - `paragon` ParagonConnectorConfig — Paragon-integration configuration on a workflow connector.
        - `integration` string, required — Paragon integration key (e.g. "googledrive").
        - `configuration` object, required — Opaque per-integration configuration (e.g. `{"folderId": "..."}`).
        - `syncID` string, required — Paragon sync ID managed by the server. Read-only.
    - `createdAt` string, date-time, required — The date and time the workflow was created.
    - `updatedAt` string, date-time, required — The date and time the workflow was last updated.
    - `audit` WorkflowAudit
      - `workflowCreatedBy` UserActionSummary
        - `userActionID` string, required — Unique identifier of the user action.
        - `userID` string — User's ID. Present for user-initiated actions.
        - `userEmail` string — User's email address. Present for user-initiated actions.
        - `apiKeyName` string — API key name. Present for API key-initiated actions.
        - `emailAddress` string — Email address. Present for email-initiated actions.
        - `createdAt` string, date-time, required — The date and time the action was created.
      - `workflowLastUpdatedBy` UserActionSummary
        - `userActionID` string, required — Unique identifier of the user action.
        - `userID` string — User's ID. Present for user-initiated actions.
        - `userEmail` string — User's email address. Present for user-initiated actions.
        - `apiKeyName` string — API key name. Present for API key-initiated actions.
        - `emailAddress` string — Email address. Present for email-initiated actions.
        - `createdAt` string, date-time, required — The date and time the action was created.
      - `versionCreatedBy` UserActionSummary
        - `userActionID` string, required — Unique identifier of the user action.
        - `userID` string — User's ID. Present for user-initiated actions.
        - `userEmail` string — User's email address. Present for user-initiated actions.
        - `apiKeyName` string — API key name. Present for API key-initiated actions.
        - `emailAddress` string — Email address. Present for email-initiated actions.
        - `createdAt` string, date-time, required — The date and time the action was created.
    - `restricted` boolean, required — Whether this workflow is hidden from other members of the account in the bem web app. When true, only account owners and admins and explicitly granted users see the workflow and its calls, outputs, and errors in the app. This is a UI-visibility control: API keys are not scoped to workflows, so an environment API key still reads a restricted workflow and its data.
  - `copiedFunctions` CopiedFunctionInfo[] — Functions that were copied when copying to a different environment. Empty when copying within the same environment.
    - `sourceFunctionName` string, required — Name of the source function that was copied.
    - `sourceFunctionID` string, required — ID of the source function that was copied.
    - `sourceVersionNum` integer, required — Version number of the source function that was copied.
    - `targetFunctionName` string, required — Name of the newly created function in the target environment.
    - `targetFunctionID` string, required — ID of the newly created function in the target environment.
    - `targetVersionNum` integer, required — Version number of the newly created function in the target environment.
  - `error` string — Error message if the workflow copy failed.

## Other responses

- `400` — The server could not understand the request due to invalid syntax.
- `404` — The server cannot find the requested resource.

---

[API](https://skmtc.dev/bem-team/apis/bem-api.md) · [All operations](https://skmtc.dev/bem-team/apis/bem-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/bem-team/bem-api/revisions/a6e4624117c6/schema)
