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

# Marketo Reference

> Build on Marketo without limits. Sync all your Marketo data to your Postgres database in real-time. Query your Leads, Campaigns, and Activities with SQL or your ORM. Get all API events in a hosted Kafka cluster. And `insert`, `update`, or `delete` Marketo records in both Marketo and your database simultaneously.

> [!WARNING]
>
> **Pardon the mess**
>
> You are viewing docs related to an older version of Sequin. We're in the process of updating our provider-specific guides and will be done in a few weeks (May 2024). [Please click here](https://sequin.io/docs/) to view the latest version of the docs.
>
> If you're interested in Marketo and want to learn more about what's changing, [send us a note](mailto:support@sequin.io).

## Supported objects[](#supported-objects "Direct link to Supported objects")

| Collection Name | Read | Write |
| - | - | - |
| Activities | ✅ | |
| Authentication | | |
| Campaigns | ✅ | ✅ |
| Channels | ✅ | ✅ |
| Companies | ✅ | ✅ |
| Custom Objects | ✅ | ✅ |
| Email Templates | ✅ | ✅ |
| Emails | ✅ | ✅ |
| Files | ✅ | ✅ |
| Folders | ✅ | ✅ |
| Form Fields | ✅ | ✅ |
| Forms | ✅ | ✅ |
| Landing Page Content | ✅ | ✅ |
| Landing Page Templates | ✅ | ✅ |
| Landing Pages | ✅ | ✅ |
| Leads | ✅ | ✅ |
| Named Account Lists | ✅ | ✅ |
| Named Accounts | ✅ | ✅ |
| Opportunities | ✅ | ✅ |
| Program Members | ✅ | ✅ |
| Programs | ✅ | ✅ |
| Sales Persons | ✅ | ✅ |
| Segments | ✅ | ✅ |
| Smart Campaigns | ✅ | ✅ |
| Smart Lists | ✅ | ✅ |
| Snippets | ✅ | ✅ |
| Static Lists | ✅ | ✅ |
| Tags | ✅ | ✅ |
| Tokens | ✅ | ✅ |
| User Management | ✅ | |

## Setup & installation[](#setup--installation "Direct link to Setup & installation")

Giving Sequin access to Marketo's API requires you to create a Custom Service and API Only User for that service in Marketo. Even if you already have a Marketo API User, it's best to create one that's solely for the Sequin service you'll create. Having a dedicated user for the Sequin integration lets you more easily track changes from Sequin syncs.

### Create Marketo service[](#create-marketo-service "Direct link to Create Marketo service")

Before you can create a Custom Service, you need to create a Marketo role with API Access and a user with that role. None of the default Marketo Roles have API access, so if this is your first API integration in Marketo, you first need to create an API access role.

#### Create Marketo API access role[](#create-marketo-api-access-role "Direct link to Create Marketo API access role")

1. In Marketo, go to **Admin > Users & Roles > Roles** and click **New Role**.
2. Enter a Role Name, for example, "Sequin Integration Role", Description, and give it the permissions your sync type requires:
   * Read-Write Assets
   * Read-Write Campaign
   * Read-Write Company
   * Read-Write Custom Objects
   * Read-Write Object Type
   * Read-Write Account
   * Read-Write Account List
   * Read-Write Opportunity
   * Read-Write Person
3. Click **Create**.

#### Create Marketo API user[](#create-marketo-api-user "Direct link to Create Marketo API user")

After creating a role, you need to create an API-Only user. API-Only users are a special type of user in Marketo, as they are administrated by other users and cannot be used to log in to Marketo.

1. In Marketo, go to **Admin > Users & Roles > Users** and click **Invite New User**.
2. Enter an email address, first name, and last name for the user. (These don't need to be valid.) Click **Next**.
3. Assign the role you created in the prior section, click the API Only checkbox, and click **Next**.
4. The last screen for user creation says "An invitation is not required for API only." Click **Send** to create the API-Only user.

> [!TIP]
>
> Ensure that this user has access to the workspaces and partitions you want to use in Sequin. If you try setting up a Marketo destination with an account that doesn't have the correct permissions, syncs will receive a 603 - Access denied error.

#### Create Marketo custom service[](#create-marketo-custom-service "Direct link to Create Marketo custom service")

Custom Services provide the actual credentials required to authenticate Marketo to Sequin. To provision one, follow these instructions:

1. In Marketo, go to **Admin > LaunchPoint** and select **New Service**.
2. Give your service a descriptive name. From the Service list, select the Custom. Give your service a description, for example, "Sequin Integration" and select the API Only user you previously created, then click **Create**.
3. This adds a new service to your list of LaunchPoint services, and the option to View Details. Click on View Details and save the Client Id and Client Secret for use in Sequin.

You're now ready to provide Sequin access to Marketo.

### Connect Sequin to Marketo[](#connect-sequin-to-marketo "Direct link to Connect Sequin to Marketo")

In Sequin, click **Add sync** and select Marketo. Then, enter the following information:

* Client ID
* Client Secret
* Base URL

> [!NOTE]
>
> To find the Client ID and Secret, navigate to **Admin > LaunchPoint** in your Marketo account and select the service you created for Sequin.

You can find the Base URL in **Admin > Integration > Web Services** under REST API.

## The syncing process[](#the-syncing-process "Direct link to The syncing process")

We first backfill your database with all your Marketo data. The time for the backfill depends on the size of your Marketo account. Unless your Marketo account has over a million records, the backfill should complete in under an hour. Smaller accounts complete in just a few minutes. We'll email you when your backfill is complete and Sequin has loaded all your data into your database.

After the initial backfill, we'll rely on Marketo Data Streams to monitor changes. We backstop Data Streams with an occasional polling process to ensure we don't miss any events. This means changes on Marketo should propagate to your database in just a few seconds.

Learn more about \[our syncing process]/syncs.

## Read and write Marketo data using SQL[](#read-and-write-marketo-data-using-sql "Direct link to Read and write Marketo data using SQL")

You'll connect to your database via [Sequin's Postgres Proxy](https://sequin.io/docs/sql-writes), which lets you read from your synced tables as well as write to them. You can use any SQL client that works with Postgres.

Here's an example of what your Marketo tables might look like in your database:

```sql theme={null}
db7hea89oah3tas=> \dt

                   List of relations
 Schema |           Name            | Type  |  Owner
--------+---------------------------+-------+----------
 public | _sync_cdc                 | table | sequin
 public | lead                      | table | sequin
 public | opportunity               | table | sequin
 public | campaign                  | table | sequin
 public | email                     | table | sequin
 public | activity                  | table | sequin
(6 rows)

```

You'll see all the Marketo objects you selected when setting up your sync are now tables in your database. You'll also see a `_sync_cdc` table which Sequin uses to manage your sync.

Here's what it looks like to query the `campaign` table:

```sql theme={null}
select
    name,
    description,
    status,
    type,
    recurrence,
    is_active
from
    campaign
where
    id = '1001';

```

Which returns a row that looks like:

```sql theme={null}
-[ RECORD 1 ]---+-----------------------------
name         | Process Bounced Emails
description  | System smart campaign for processing bounced email events
status       | Never Run
type         | batch
recurrence   | weekdayOnly
is_active    | false

```

Writing back to Marketo is as simple as writing a SQL query. For example, you can mark a user's email as verified like this:

```sql theme={null}
update lead
set email = my_upadted_email@sequin.io
where user_id = '1005';

```

Sequin will write this change to both Marketo and your database at the same time.

If a write to Marketo fails, Sequin will roll back the write to your database. For example, if you try to update a user's email to an invalid email address, you'll receive a Postgres error:

```sql theme={null}
update user
set email = 'invalid-email'
where user_id = '1005';

ERROR: [Marketo] invalid input syntax for type email: "invalid-email"

```

## Next steps[](#next-steps "Direct link to Next steps")

Your Marketo tables are now available as fully readable and writeable tables in your database. You can query for all your data using SQL, and mutate data thanks to Sequin's Postgres Proxy. To build on this foundation, here are some next steps:

* [Setup your ORM](https://sequin.io/docs/reads) to work with your synced tables.
* Edit the Marketo objects and properties you're syncing at any time.
* Create [views](https://www.postgresql.org/docs/current/tutorial-views.html) on your Marketo data to tailor your schema to your needs.
* Invite your team to your Sequin account and start building!

If you need assistance setting up your sync, just [send us a note](mailto:support@sequin.io). We're around and eager to help.


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