# Marketo Destination Config Reference


> Complete Rudder CLI reference for the Marketo destination config keys, lead matching, custom activity mappings, and secrets.



[Marketo](https://www.rudderstack.com/docs/destinations/streaming-destinations/marketo/) is a marketing automation destination. RudderStack creates and updates Marketo leads from `identify` events, and records `track` events as custom activities on those leads, from its servers.

In a Marketo destination spec:

- `type: marketo`
- `definition_version: 1`

## Sample configuration

```yaml
version: rudder/v1
kind: destination
metadata:
  name: marketo-prod
spec:
  id: marketo-prod
  display_name: Marketo Production
  type: marketo
  definition_version: 1
  enabled: true
  config:
    account_id: 123-ABC-456
    client_id: "{{ .MARKETO_CLIENT_ID }}"
    client_secret: "{{ .MARKETO_CLIENT_SECRET }}"

    track_anonymous_events: false
    create_if_not_exist: true

    rudder_events_mapping:
      - event: Product Clicked
        marketo_activity_id: "100001"
        marketo_primarykey: product_id
    custom_activity_property_map:
      - from: product_name
        to: productName
    lead_trait_mapping:
      - from: leadScore
        to: customLeadScore

    connection_mode:
      web: cloud
      cloud: cloud
    consent_management:
      web:
        - provider: oneTrust
          consents:
            - marketing
```

The above example records `Product Clicked` events as a custom activity and fails every other `track` event — Marketo receives only the events [`rudder_events_mapping`](#rudder_events_mapping) names. Note that `marketo_activity_id` is a quoted string — see [Mappings](#mappings).

## Config keys

`config` accepts only the keys listed below. The [shared config key rules](https://www.rudderstack.com/docs/rudder-cli/destination-types/#config-key-rules) cover unknown keys, defaults, and immutability.

**Info:** Marketo accepts only `identify` and `track` events. RudderStack doesn&#39;t deliver any other event type to it.

### Connection

<div class="rs-ckeys">
<div class="rs-ckey" id="account_id">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">account_id</p>Required</div>
  <p class="rs-ckey__field">
    Type:
    <code>string</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Munchkin account ID of your Marketo instance, such as <code>123-ABC-456</code>. RudderStack calls Marketo&rsquo;s REST API on <code>&lt;account_id&gt;.mktorest.com</code>. The dashboard calls it <strong>Munchkin Account Id</strong>.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>At most 100 characters, and must not contain line breaks.</li>
<li>A <code>{{ path || fallback }}</code> template is accepted in place of a literal.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/marketo/#connection-settings" >Connection settings</a> for where to find the Munchkin account ID.
</div>

</div>

<div class="rs-ckey" id="client_id">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">client_id</p>RequiredSecret</div>
  <p class="rs-ckey__field">
    Type:
    <code>string</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Client ID of the Marketo REST API service RudderStack authenticates as — a custom LaunchPoint service tied to an API-only user.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>At most 100 characters, and must not contain line breaks.</li>
<li>A <code>{{ path || fallback }}</code> template is accepted in place of a literal.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  <p>Supply it as a <code>{{ .VAR }}</code> reference rather than a literal — see <a href="#secrets" >Secrets</a>.</p>
<p>See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/marketo/#how-do-i-obtain-the-marketo-client-id-and-secret" >How do I obtain the Marketo client ID and secret?</a>.</p>

</div>

</div>

<div class="rs-ckey" id="client_secret">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">client_secret</p>RequiredSecret</div>
  <p class="rs-ckey__field">
    Type:
    <code>string</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Client secret of the same REST API service.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>At most 100 characters, and must not contain line breaks.</li>
<li>A <code>{{ path || fallback }}</code> template is accepted in place of a literal.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  Supply it as a <code>{{ .VAR }}</code> reference rather than a literal — see <a href="#secrets" >Secrets</a>.
</div>

</div>

</div>

### Lead matching

RudderStack finds the lead an event belongs to by its `marketoLeadId` external ID when the event carries one. Otherwise, it looks the lead up by the event's email or, when there's no email, by its `userId` — or its `anonymousId` when there's no `userId` — stored in Marketo lead fields with those exact API names.

**Warning:** Create `userId` and `anonymousId` lead fields in Marketo before you send events. RudderStack looks leads up, and creates them, through those fields, so events fail without them.

<div class="rs-ckeys">
<div class="rs-ckey" id="track_anonymous_events">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">track_anonymous_events</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>boolean</code>
  </p><p class="rs-ckey__field">
    Default value:
    <code>false</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Send <code>track</code> events that have no <code>userId</code>. RudderStack then matches the lead by email, or by <code>anonymousId</code>.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>When <code>false</code>, a <code>track</code> event without a <code>userId</code> fails.</li>
<li>The dashboard&rsquo;s note on this setting reads as though turning it on requires a <code>userId</code> on every <code>track</code> event. It&rsquo;s the other way round: turning it on is what lets events without one through.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/marketo/#custom-activity-settings" >Custom Activity Settings</a>.
</div>

</div>

<div class="rs-ckey" id="create_if_not_exist">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">create_if_not_exist</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>boolean</code>
  </p><p class="rs-ckey__field">
    Default value:
    <code>true</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Create a lead when no existing lead matches the event.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>When <code>false</code>, an event without a matching lead fails.</li>
</ul>

</div>

</div>

</div>

### Mappings

The three mapping keys connect your events to Marketo custom activities and lead fields. Create and approve each custom activity in Marketo first — see [How do I create a custom activity in Marketo?](https://www.rudderstack.com/docs/destinations/streaming-destinations/marketo/#how-do-i-create-a-custom-activity-in-marketo).

None of the mapping fields is validated locally, so Rudder CLI accepts a row with a field missing — and every field is a string.

<div class="rs-ckeys">
<div class="rs-ckey" id="rudder_events_mapping">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">rudder_events_mapping</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>array of objects</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Maps <code>track</code> event names to Marketo custom activities. A <code>track</code> event without a row here fails, so Marketo receives only the events you map.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li><code>event</code> — RudderStack event name.</li>
<li><code>marketo_activity_id</code> — ID of the custom activity type, from Marketo&rsquo;s admin settings. A digit string: quote it, since an unquoted number fails validation.</li>
<li><code>marketo_primarykey</code> — event property whose value fills the activity&rsquo;s primary field. An event without a value for it fails.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  <div class="rs-code">
  <div class="rs-code__head">yaml<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">rudder_events_mapping:
  - event: Product Clicked
    marketo_activity_id: &#34;100001&#34;
    marketo_primarykey: product_id</code></pre></div>
</div><p>See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/marketo/#custom-events" >Custom events</a>.</p>
</div>

</div>

<div class="rs-ckey" id="custom_activity_property_map">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">custom_activity_property_map</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>array of objects</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Maps <code>track</code> event properties onto fields of the event&rsquo;s custom activity. The property named by <code>marketo_primarykey</code> fills the primary field and isn&rsquo;t sent through this map.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li><code>from</code> — event property name.</li>
<li><code>to</code> — API name of the custom activity field.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  <div class="rs-code">
  <div class="rs-code__head">yaml<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">custom_activity_property_map:
  - from: product_name
    to: productName</code></pre></div>
</div><p>See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/marketo/#custom-activity-property-map" >Custom activity property map</a>.</p>
</div>

</div>

<div class="rs-ckey" id="lead_trait_mapping">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">lead_trait_mapping</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>array of objects</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Maps <code>identify</code> traits onto Marketo lead fields. RudderStack already maps standard traits, such as <code>email</code>, <code>firstName</code>, and <code>phone</code>, on its own. Use this for custom fields, or to send a trait to a different field.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li><code>from</code> — trait name.</li>
<li><code>to</code> — API name of the lead field.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  <div class="rs-code">
  <div class="rs-code__head">yaml<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">lead_trait_mapping:
  - from: leadScore
    to: customLeadScore</code></pre></div>
</div><p>See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/marketo/#supported-mappings" >Supported mappings</a> for the traits RudderStack maps on its own.</p>
</div>

</div>

</div>

### Per-source keys

Both keys are objects keyed by the local source type — the tokens listed under [Source types](#source-types). A key naming a source type this destination doesn't support fails validation.

<div class="rs-ckeys">
<div class="rs-ckey" id="connection_mode">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">connection_mode</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>object</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Maps each source type you connect to the mode its events reach Marketo in, using the modes in <a href="#source-types" >Source types</a>.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>An entry is required for each source type you connect — see <a href="#connect-a-source" >Connect a source</a>.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  <div class="rs-code">
  <div class="rs-code__head">yaml<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">connection_mode:
  web: cloud
  cloud: cloud</code></pre></div>
</div>
</div>

</div>

<div class="rs-ckey" id="consent_management">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">consent_management</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>object</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Consent provider configuration per source type. The entry shape, accepted providers, and the rules on <code>resolution_strategy</code> and <code>consents</code> are shared across all destination types — see <a href="https://www.rudderstack.com/docs/rudder-cli/destination-types/#consent-management" >Consent management</a>.
</p>

</div>

</div>

## Source types

Marketo accepts events from these source types in the mentioned connection modes:

| Source type | Connection mode |
| :-----| :-----|
| `android` | `cloud` |
| `android_kotlin` | `cloud` |
| `ios` | `cloud` |
| `ios_swift` | `cloud` |
| `web` | `cloud` |
| `unity` | `cloud` |
| `react_native` | `cloud` |
| `flutter` | `cloud` |
| `cordova` | `cloud` |
| `cloud` | `cloud` |
| `warehouse` | `cloud` |

Every source type is `cloud` only — events reach Marketo from RudderStack's servers, never in device mode.

`warehouse` is the token a [Reverse ETL source](https://www.rudderstack.com/docs/sources/reverse-etl/) resolves to. Rudder CLI manages the destination’s `warehouse` entry — if the destination is connected to a Reverse ETL source, set `connection_mode.warehouse: cloud` in its spec, or `apply` removes it.

Rudder CLI can also declare the Reverse ETL connection itself, for the types listed under [Supported destinations](https://www.rudderstack.com/docs/rudder-cli/yaml-retl-connections/#supported-destinations) — see [Manage Reverse ETL Connections using Rudder CLI](https://www.rudderstack.com/docs/rudder-cli/retl-connections/).

**Info:** The dashboard additionally offers Marketo to AMP and Shopify sources. Rudder CLI doesn&#39;t manage those connections, so `amp` and `shopify` are invalid here.

## Connect a source

An event stream connection to this destination is checked against two rules at `validate` time.

**The source's type must be supported.** A source's type resolves to one of the tokens above before the check — a JavaScript source resolves to `web`, and webhook and server-side SDK sources resolve to `cloud`. Every type an event stream source can resolve to is supported here, so this check always passes.

**The destination config must carry a `connection_mode` entry for that source type.** This lives on the destination spec, not on the [connection spec](https://www.rudderstack.com/docs/rudder-cli/yaml-connections/). Without it:

```text
destination 'marketo-prod' config has no 'connection_mode' entry for source type 'web'
```

Marketo needs no additional config keys to connect a source of any type.

## Secrets

`client_id` and `client_secret` are the secret keys. Write each as a `{{ .VAR }}` reference and supply the value at apply time:

```yaml
config:
  client_id: "{{ .MARKETO_CLIENT_ID }}"
  client_secret: "{{ .MARKETO_CLIENT_SECRET }}"
```

```bash
export RUDDER_MARKETO_CLIENT_ID="..."
export RUDDER_MARKETO_CLIENT_SECRET="..."
rudder-cli apply

# or
rudder-cli apply --var-file secrets.vars.yaml
```

Note that:

- `rudder-cli import` writes only the secrets the API returns, as `{{ .VAR }}` references, and leaves the others out. Add any secret key it leaves out, then supply the variables before you apply — see [Secrets](https://www.rudderstack.com/docs/rudder-cli/destination-types/#secrets).

See [How to Use Variable Substitution in Rudder CLI](https://www.rudderstack.com/docs/rudder-cli/variable-substitution/).

## Changes by release

<p>No changes since this type became available.</p>

For changes across every destination type, see [Destination Type Changes by Release](https://www.rudderstack.com/docs/rudder-cli/destination-types/changes/).

## See more

- [Marketo Destination](https://www.rudderstack.com/docs/destinations/streaming-destinations/marketo/) for the API service setup, custom activities, and the traits RudderStack maps on its own
- [Destination Type Reference for Rudder CLI](https://www.rudderstack.com/docs/rudder-cli/destination-types/) for the rules shared across destination types
- [Destination YAML Reference](https://www.rudderstack.com/docs/rudder-cli/yaml-destinations/) for the spec envelope

