> ## Documentation Index
> Fetch the complete documentation index at: https://developers.redo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# duplicateMarketingAutomation

> Copy an automation into a new automation that is off: its steps, and a new copy of each email or SMS template, Recover config and Commerce Agent strategy they use. Turn the copy on with `updateMarketingAutomation`. Returns null if no owned automation matches the id.

**Required scopes:** [`marketing_automations_write`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-marketing_automations_write)

**Store must have one of:** `EMAIL_SMS`, `HSA`, `ORDER_TRACKING`, `RETURNS`, `TNPL`, `REVIEWS`

## Arguments

**id** `ID!` *required*

The automation's `id`, or its `legacyId` from an earlier version of the Redo API.

**name** `String`

The copy's name. Defaults to the original's name followed by " (Copy)".

## Returns

**duplicateMarketingAutomation** `[MarketingAutomation](/docs/api-reference/v3/reference/marketing/marketing-automation)`

A marketing automation: a flow that sends email or SMS to customers when a trigger fires. It can also be one of Redo's default return-tracking automations (`origin: DEFAULT`), which the store sees while returns are on and it has no automation of its own for the same trigger.

**fields**

**analytics** `[MarketingAutomationAnalytics!](/docs/api-reference/v3/reference/marketing/marketing-automation-analytics)` *required*

Analytics for this marketing automation, grouped by what is being measured.

**fields**

**messaging** `[MarketingAutomationMessagingAnalytics!](/docs/api-reference/v3/reference/marketing/marketing-automation-messaging-analytics)` *required*

Email and SMS performance: what was sent, how it was engaged with, and the orders and revenue attributed to it. Covers messages sent by the automation's own send steps, Commerce Agent steps included. Each order is credited to the last marketing or Commerce Agent message before it, so a later message from outside the automation takes the credit.

**Requires:** [`marketing_automations_analytics_read`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-marketing_automations_analytics_read)

**fields**

**Arguments**

**attributionWindowDays** `Int`

Deprecated. How many days after a message an order still counts toward it, 1-30, in place of the store's own windows. **(Deprecated)**

**audience** `[MarketingAudience](/docs/api-reference/v3/reference/marketing/marketing-audience)`

Report only messages to this audience, and the orders and revenue credited to them. Omit it for both. Credit is assigned across both audiences first, so the two add up to the unsplit figures. `delivered`, `failures` and `unsubscribes` aren't recorded per audience: deliveries and failures count toward `SUBSCRIBERS`, and `unsubscribes` reports the whole send's. Rates divided by `delivered` are therefore not comparable between the two audiences.

**endDate** `[Date!](/docs/api-reference/v3/reference/common/date)` *required*

Last day to report on, inclusive, in the store's timezone. The range may span at most 400 days.

**startDate** `[Date!](/docs/api-reference/v3/reference/common/date)` *required*

First day to report on, inclusive, in the store's timezone. Must be on or before `endDate`, and the range may span at most 400 days.

**Fields**

**series** `[\[MessageAnalyticsPoint!\]!](/docs/api-reference/v3/reference/marketing/message-analytics-point)` *required*

One entry per day with activity, oldest first. Quiet days are omitted rather than reported as zero.

**totals** `[MessageAnalyticsTotals!](/docs/api-reference/v3/reference/marketing/message-analytics-totals)` *required*

Totals across the whole range. A marketing automation with no activity reports zero counts and null rates.

**steps** `[\[MarketingAutomationStepAnalytics!\]](/docs/api-reference/v3/reference/marketing/marketing-automation-step-analytics)`

Per-step performance: what each step sent, how shoppers engaged and replied, and the orders and revenue credited to it. Credit is the same as `messaging`'s, split by the step whose message won, so don't add the two together; credit to a message with no step isn't listed here. Lists only steps with activity in the range.

**Requires:** [`marketing_automations_analytics_read`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-marketing_automations_analytics_read)

**fields**

**Arguments**

**attributionWindowDays** `Int`

Deprecated. How many days after a message an order still counts toward it, 1-30, in place of the store's own windows. **(Deprecated)**

**audience** `[MarketingAudience](/docs/api-reference/v3/reference/marketing/marketing-audience)`

Report only messages to this audience, and the orders and revenue credited to them. Omit it for both. Credit is assigned across both audiences first, so the two add up to the unsplit figures. `delivered`, `failures` and `unsubscribes` aren't recorded per audience: deliveries and failures count toward `SUBSCRIBERS`, and `unsubscribes` reports the whole send's. Rates divided by `delivered` are therefore not comparable between the two audiences.

**endDate** `[Date!](/docs/api-reference/v3/reference/common/date)` *required*

Last day to report on, inclusive, in the store's timezone. The range may span at most 400 days.

**startDate** `[Date!](/docs/api-reference/v3/reference/common/date)` *required*

First day to report on, inclusive, in the store's timezone. Must be on or before `endDate`, and the range may span at most 400 days.

**Fields**

**conversations** `Int!` *required*

Commerce Agent conversations whose first message from the step was sent in the range. Zero for steps that send a template.

**deliveries** `Int!` *required*

Messages the provider confirmed were delivered.

**orders** `Float!` *required*

Orders credited to the step. Fractional when the store splits credit across messages.

**recipients** `Int!` *required*

Distinct customers the step sent to.

**repliedConversations** `Int!` *required*

Of `conversations`, the ones the shopper replied to before the range ended.

**replyRate** `Float`

`repliedConversations / conversations`. Null when the step opened no conversations.

**revenue** `[Money!](/docs/api-reference/v3/reference/common/money)` *required*

Revenue credited to the step, in the store's currency.

**sends** `Int!` *required*

Messages the step handed to the delivery provider.

**step** `[MarketingAutomationStep](/docs/api-reference/v3/reference/marketing/marketing-automation-step)`

The step these analytics cover. Null when the step has since been removed from the automation.

**uniqueClicks** `Int!` *required*

Messages clicked at least once.

**category** `[MarketingAutomationCategory!](/docs/api-reference/v3/reference/marketing/marketing-automation-category)` *required*

Which trigger family this marketing automation belongs to.

**channels** `[\[MarketingAutomationChannel!\]!](/docs/api-reference/v3/reference/marketing/marketing-automation-channel)` *required*

The channels this automation's steps send on, in the order the automations page shows them. Empty when it has no send step.

**createdAt** `[DateTime!](/docs/api-reference/v3/reference/common/date-time)` *required*

When the automation was created.

**description** `String`

The merchant's description of what this automation does.

**enabled** `Boolean!` *required*

Whether the automation is currently running.

**id** `ID!` *required*

The id of this automation.

**legacyId** `String!` *required*

The automation's legacy Mongo ObjectId (24-char hex) from before the CockroachDB migration.

**name** `String!` *required*

The merchant-facing name of the automation.

**origin** `[MarketingAutomationOrigin!](/docs/api-reference/v3/reference/marketing/marketing-automation-origin)` *required*

Whether this is one of Redo's default automations or the store's own.

**publishedAt** `[DateTime](/docs/api-reference/v3/reference/common/date-time)`

When the current version was published. Null while it has only ever been a draft.

**replacesDefault** `Boolean!` *required*

True when this is the store's own return-tracking automation for a trigger Redo has a default for. While it exists the default is hidden; deleting it brings the default back. Always false while returns are off.

**steps** `[\[MarketingAutomationStep!\]!](/docs/api-reference/v3/reference/marketing/marketing-automation-step)` *required*

The nodes that make up this automation, including graph edges as step ids. A type this API version does not model field-by-field is returned as MarketingAutomationUnknownStep.

**stepsJson** `[\[JSON!\]!](/docs/api-reference/v3/reference/common/json)` *required*

`steps` with every field selected, as JSON: one element per step, with `__typename`. Null and invalid stored steps are \[]. Webhook header values and OAuth client secrets are omitted. Edits go through operations.

**updatedAt** `[DateTime!](/docs/api-reference/v3/reference/common/date-time)` *required*

When the automation was last updated.

## Example

```graphql theme={null}
mutation {
  duplicateMarketingAutomation(id: "...", name: "...") {
    category
    channels
    createdAt
    description
    enabled
    id
    legacyId
    name
    # ...
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.