> ## 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.

# marketingAutomation

> Fetch a single marketing automation by its id. Ids from earlier versions of the Redo API are also accepted.

**Required scopes:** [`marketing_automations_read`](/docs/api-reference/v3/reference/scopes#scope-marketing_automations_read)

## Arguments

<ResponseField name="id" type="ID!" required>
  The marketing automation's `id`, or its `legacyId` from an earlier version of the Redo API.
</ResponseField>

## Returns

<ResponseField name="marketingAutomation" type={<a href="/docs/api-reference/v3/reference/marketing/marketing-automation">MarketingAutomation</a>}>
  A marketing automation: a flow that sends email or SMS to customers when a trigger fires.

  <Expandable title="fields" lazyRender>
    <ResponseField name="analytics" type={<a href="/docs/api-reference/v3/reference/marketing/marketing-automation-analytics">MarketingAutomationAnalytics!</a>} required>
      Analytics for this marketing automation, grouped by what is being measured.

      <Expandable title="fields" lazyRender>
        <ResponseField name="messaging" type={<a href="/docs/api-reference/v3/reference/marketing/marketing-automation-messaging-analytics">MarketingAutomationMessagingAnalytics!</a>} required>
          Email and SMS performance, read from the analytics warehouse: 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; Recover conversations are measured separately and are not included here.

          **Requires:** [`marketing_automations_analytics_read`](/docs/api-reference/v3/reference/scopes#scope-marketing_automations_analytics_read)

          <Expandable title="fields" lazyRender>
            **Arguments**

            <ResponseField name="attributionWindowDays" type="Int">
              How many days after a message an order still counts toward it, 1-30.
            </ResponseField>

            <ResponseField name="endDate" type={<a href="/docs/api-reference/v3/reference/common/date">Date!</a>} required>
              Last day to report on, inclusive, in the store's timezone. The range may span at most 400 days.
            </ResponseField>

            <ResponseField name="startDate" type={<a href="/docs/api-reference/v3/reference/common/date">Date!</a>} 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.
            </ResponseField>

            **Fields**

            <ResponseField name="series" type={<a href="/docs/api-reference/v3/reference/marketing/message-analytics-point">[MessageAnalyticsPoint!]!</a>} required>
              One entry per day with activity, oldest first. Quiet days are omitted rather than reported as zero.
            </ResponseField>

            <ResponseField name="totals" type={<a href="/docs/api-reference/v3/reference/marketing/message-analytics-totals">MessageAnalyticsTotals!</a>} required>
              Totals across the whole range. A marketing automation with no activity reports zero counts and null rates.
            </ResponseField>
          </Expandable>
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="category" type={<a href="/docs/api-reference/v3/reference/marketing/marketing-automation-category">MarketingAutomationCategory!</a>} required>
      Which trigger family this marketing automation belongs to.
    </ResponseField>

    <ResponseField name="createdAt" type={<a href="/docs/api-reference/v3/reference/common/date-time">DateTime!</a>} required>
      When the automation was created.
    </ResponseField>

    <ResponseField name="description" type="String">
      The merchant's description of what this automation does.
    </ResponseField>

    <ResponseField name="enabled" type="Boolean!" required>
      Whether the automation is currently running.
    </ResponseField>

    <ResponseField name="id" type="ID!" required>
      The id of this automation.
    </ResponseField>

    <ResponseField name="legacyId" type="String!" required>
      The automation's legacy Mongo ObjectId (24-char hex) from before the CockroachDB migration.
    </ResponseField>

    <ResponseField name="name" type="String!" required>
      The merchant-facing name of the automation.
    </ResponseField>

    <ResponseField name="publishedAt" type={<a href="/docs/api-reference/v3/reference/common/date-time">DateTime</a>}>
      When the current version was published. Null while it has only ever been a draft.
    </ResponseField>

    <ResponseField name="steps" type={<a href="/docs/api-reference/v3/reference/marketing/marketing-automation-step">[MarketingAutomationStep!]!</a>} 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.
    </ResponseField>

    <ResponseField name="stepsJson" type={<a href="/docs/api-reference/v3/reference/common/json">[JSON!]!</a>} 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.
    </ResponseField>

    <ResponseField name="updatedAt" type={<a href="/docs/api-reference/v3/reference/common/date-time">DateTime!</a>} required>
      When the automation was last updated.
    </ResponseField>
  </Expandable>
</ResponseField>

## Example

```graphql theme={null}
query {
  marketingAutomation(id: "...") {
    category
    createdAt
    description
    enabled
    id
    legacyId
    name
    publishedAt
    # ...
  }
}
```


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