Learn more about Marketo Import Integration.

You can create and use a connector to write Treasure Data job results directly to your Marketo account records. The TD query job results add users to Marketo Target lists.

For sample workflows of exporting to Marketo, view Treasure Boxes.


  • Basic knowledge of Treasure Data, including the TD Toolbelt.

  • A Marketo Account with API access enabled (done via Marketo Console).

Create a New Connection

Go to Integrations Hub > Catalog and search. Select Marketo.

The dialog opens.

Complete the new connection information, providing your Marketo credential. Refer to the Appendix for information on where to find your credential information.

  • Marketo Account ID (required): This is your Marketo Service/Munchkin ID.

  • Marketo Client ID (required): This is service specific client id.

  • Marketo Client Secret (required): This is service specific client secret.

You can give a name to your newly created connection and select Done.

Configure to Output Results to Marketo Connection

Check the Output results at top of your query editor and select your Marketo connection.

There are several parameter fields to complete:

  • Marketo Target List ID : ID of the list where the new leads are imported into.

    • Important note: The list must be from an existing list, otherwise the new leads will go into the main Marketo database

  • Headers for importing data: Specify headers here or in the result output query as column alias

  • Marketo Partition Name: Name of the partition the new leads will belong to (optional)

  • Lookup Field: The value in this field is bound to this data set and can be used to lookup or de-dup the data set

  • Retry limit (optional, default 6): Number of retries before the connector stops trying to connect and send data out

  • Initial intervals in milliseconds between retries (optional, default 10000): Interval to retry if a recoverable error happens (in millisecond).

  • Maximum intervals in milliseconds between retries (optional, default to 32000) : Maximum time in milliseconds between retrying attempts.

A sample configuration:

Where the list ID can be found on Marketo Console:

Write the Query to Populate a Leads List

On TD Console, run the following query with Output results into a connection of Marketo. The query does not match any real users and is for demonstration purposes only. (See the Appendix for more details of column naming):

  td_global_id as tdglobalid,
    ('b1b065f5-1222-4a14-b151-379d49ec39e3', 'John', 'Doe', 'name+test1@treasure-data.com', 'Marketo Dummy Lead - DO NOT USE'),
    ('x1b065f5-1222-4a14-b151-379d49ec39e3', 'Janes', 'Doe', 'name+test2@treasure-data.com', 'Marketo Dummy Lead - DO NOT USE'),
    ('p1b065f5-1222-4a14-b151-379d49ec39e3', 'Tony', 'Doe', 'name+test3@treasure-data.com', 'Marketo Dummy Lead - DO NOT USE'),
    ('o1b065f5-1222-4a14-b151-379d49ec39e3', 'Bill', 'Adam', 'name+test4@treasure-data.com', 'Marketo Dummy Lead - DO NOT USE'),
  ('t1b065f5-1222-4a14-b151-379d49ec39e3', 'Dan', 'Steve', 'name+test5@treasure-data.com', 'Marketo Dummy Lead - DO NOT USE')
) tbl

The demo query requires no source table (for the ease of testing out this feature), but you still must choose your database, so pick “sample_datasets” or any other arbitrary table.

If you don’t want to specify the data headers in the configuration, you can use aliases in your query to rename columns of your query result, for example:

SELECT an_email_column AS EMAIL,
another_phone_column AS PHONE
FROM your_table;

to create new dataset with headers of EMAIL,PHONE

  • Note: column name is case-insensitive, for example, you can use either of email or EMAIL.

The query should complete in a few seconds. After that, check the Marketo Console for your new leads:


Marketo Leads Data

Output result data must follow Marketo data specifications.

For example, when the field is set up as Integer, the data Treasure Data sends to Marketo must be convertible to int ( 1001aa will not be a valid integer)

Munchkin Account Information

Access to your API-enabled account is required before you can upload the Marketo list. The Munchkin Account ID can be retrieved from the Marketo Admin page.

Steps to enable and create a new account for API access

  1. Create an API Only User.

  2. Create an API Only User Role.

  3. Enable the Advanced List Import Permission on a Role.

  4. Create a Custom Service for Use with ReST API.

  5. Check Endpoint for Rest API on “Web Service” menu where you can find a client id and a client secret for using API.

Some Useful Information About Preparing Data for Marketo Leads