---
title: "Copy a Flows based on the specified Flow Ids"
method: POST
path: "/flows/copy_many"
tags: ["flows"]
---

# Copy a Flows based on the specified Flow Ids

`POST /flows/copy_many`

You need `workspaces.flow.edit` permission and belong to workspace containing source flow to access this resource
Flows can be copied only to another workspace, if you copy many flows at once you can not copy them in to existing flows


Flow is copied into draft of new/existing flow. So to make flow to work draft should be published manually. That is done to avoid disruptions of already running flow (flow is not stopped or changed in any other way except draft), and because most likely flow copy will require additional configuration.
Flow can be copied in any workspace and contract, of course if user has enough privileges to read original flow and has enough privileges to edit flow in destination workspace.
Platform forbids to copy flow if flow components can not be used in destination context (e.g. component visibility is restricted to team, and you are copying flow in another contract)

**Notices:**
 1. The topic (`data.attributes[topic_id]`) must be accessible to the flow in the destination workspace, otherwise it will not be copied.
 2. It's forbidden to use the `data.attributes[topic_id]` parameter if flow does not contain at least one step with Pub/Sub component.
 3. It's forbidden to use the `data.attributes[topic_id]` parameter if your flow uses more than one Pub/Sub topic in different steps. You can copy the flow if your flow has several Pub/Sub steps that uses only one topic.
 4. In case when the `data.attributes[topic_id]` parameter is absent from your call, topics ID will be removed from a copy if it's not accessible and left intact if the topic is available in destination context.
 5. In case if one of the flows has more then one topic but only one was provided, has no topics and one was provided, some components are hidden from destination workspace, or quota was exuded the flow will be put to errored array along with the reason of rejection

Please note the following facts about credentials, secrets, topics and agents used in flow:
 - All these entities are not copied along with the flow if they are not accessible in the destination context.
 - Naturally, if the flow is copied into the same workspace, these entities will be accessible to the flow draft.
 - Topic can be replaced during copy. Read details about `data.attributes.topic_id` parameter.

## Request body

- object
  - `data` object, required
    - `type` 'flow-copy-many', required
    - `attributes` object[], required
      - `name` string — Makes possible to customize name of the draft (and flow when new flow is created)
      - `flow_id` string, required — Id of flow that will be coped to another workspace
      - `topic_id` string — Required only if flow contains Pub-Sub components. Only one topic reference allowed
    - `relationships` object, required
      - `dest_workspace` object, required
        - `data` object, required
          - `id` string, required — Destination workspace identifier can not be the same as current workspace identifier
          - `type` 'workspace', required

## Response `201`

Created

- object
  - `data` object, required
    - `coped` object[], required
      - `id` string, required
      - `type` 'flow', required
      - `links` object, required
        - `self` string, required
      - `attributes` object, required
        - `default_mapper_type` 'jsonata', required
        - `type` 'ordinary' | 'long_running', required — You need `workspaces.flow.toggleRealtime` permission to set `long_running` value
        - `nodes_config` object
          - `step_id` object — The Id of flow step. Format: step_1, step_2, step_n
            - `log_level` 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal' — Log level of component running in this step
            - `replicas` integer — This parameter configures the maximum container replicas, that can be run simultaneously
            - `passthrough` object
              - …
            - `consume_raw_data` boolean — This parameter configures the parsing behaviour in the webhook step. In case it is true, webhook step receives input message in raw structure.
            - `prefetch` integer — This parameter configures the maximum amount of messages, that the step can process simultaneously
            - `disable_dynamic_flow_control` boolean — This parameter configures disabling publisher confirms in sailor. Supports only for components with sailor-jvm version above 3.3.5 and sailor-nodejs version above 2.6.10
            - `persistent_messages` boolean — This parameter configures messages persistence in sailor. Supports only for components with JVM sailor version above 3.4.0 and NodeJS sailor above 2.7.0
        - `created_at` string, date-time, required
        - `last_modified` string, date-time, required
        - `name` string, required — Name of your Flow
        - `description` string, nullable — Flow description
        - `cron` string, nullable, required
        - `variables` object — Flow Variables
        - `shut_down_timeout` integer — *Flow Shutdown Timeout* The maximum time, in minutes, that a flow will wait after processing the last message before terminating. If new messages are received during this time, the flow will continue processing them.
        - `graph` object, required — Flow graph representing component connections
          - `nodes` union[], required
            - union
              - …
          - `edges` object[], required
            - `id` string, required
            - `target` string, required
            - `source` string, required
            - `config` object, required
              - …
        - `api_version` string, required
        - `current_status` 'inactive', required
        - `status` 'inactive', required
        - `stats_enabled` boolean — *Flow Stats Toggle* By default each step of a flow generates stats about input/output messages and errors. You can see them on the Executions and Dashboard pages. To disable input/output message stats you can set flow's `attributes.stats_enabled` flag to `false`.
        - `updated_at` string, date-time
      - `relationships` object, required
        - `user` object, required
          - `data` object, required
            - `id` string, required — User ID
            - `type` 'user', required
          - `links` object, required
            - `self` string, required
        - `workspace` object, required
          - `data` object, required
            - `id` string, required — Workspace ID
            - `type` 'workspace', required
          - `links` object, required
            - `self` string, required
        - `versions` object, required
          - `links` object, required
            - `related` string, required
        - `latest_version` object, required
          - `data` object, required
            - `id` string, required — Flow-version ID
            - `type` 'flow-version', required
          - `links` object, required
            - `self` string, required
            - `related` string, required
    - `errored` object[], required
      - `id` string
      - `error` object
        - `title` 'InvisibleComponentsError' | 'InconsistentTopicError' | 'NoPubSubError' | 'NoQuotaError'
        - `message` string
        - `source` object
  - `meta` object, required

## Other responses

- `401` — Unauthorized
- `403` — Forbidden

---

[API](https://skmtc.net/elastic/apis/elastic-io-rest-api-documentation-v2.md) · [All operations](https://skmtc.net/elastic/apis/elastic-io-rest-api-documentation-v2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/elastic/elastic-io-rest-api-documentation-v2/revisions/411f9f98c01e/schema)
