MuleSoft  Integration With Marketo – Part-1 (Using Rest API’s) 

Author: Ashish Singh Chauhan

Marketo, Inc. is an American software company, headquartered in San Mateo, California. Marketo develops and sells marketing automation software for account-based marketing and other marketing services and products including SEO and content creation

Marketo is Software-as-a-Service (SaaS)-based marketing automation software owned by Adobe and built to help organizations automate and measure marketing engagement, tasks and workflows.

Based in San Mateo, Calif Marketo software aims to allow B2B and B2C marketers target qualified leads, produce lead-to-revenue opportunities and execute automated, personalized marketing campaigns across multiple digital channels. 


Marketo exposes a REST API which allows for remote execution of many of the system’s capabilities. These APIs generally fall into two broad categories: Lead Database, and Asset.  Lead Database APIs allow for retrieval of, and interaction with Marketo person records and associated object types such as Opportunities and Companies.  Asset APIs allow interaction with marketing collateral and workflow-related records.

There are a lot of API’s and endpoints which are provided by Marketo. For explore them much you can visit following links->

1) Lead database –

2) Asset –

For our integrations we are mainly concerned with following endpoints →

1) Token – {{base_url}}/identity/oauth/token – GET

2) Leads – {{base_url}}/rest/v1/leads.json – POST & GET (both)

3) Activities – {{base_url}}/rest/v1/activities/external.json – POST

Prerequisites for Integration in Mule

1) The base_url (Marketo domain) must be provided by Clients.

2) The custom object name for Activity(if required) must also be provided.

3) All the API’s which are required for integrations must be put in properties files.

4) During integration keep in mind the following limitations of Marketo API’s

  • Daily Quota: Subscriptions are allocated 50,000 API calls per day (which resets daily at 12:00AM CST).  You can increase your daily quota through your account manager.
  • Rate Limit: API access per instance limited to 100 calls per 20 seconds.
  • Concurrency Limit:  Maximum of 10 concurrent API calls.

5) For generating the Token the client credentials( client id and client secret) must be present.

Integration in Mule

Step 1 -> Generate the Authorization token because it is required to access Marketo.

URL – {{base_url}}/identity/oauth/token

Set this url and query parameters in variables of transform message and pass them in Http Request.

You will get a token like this →

Step 2 → Attach this token with “Bearer” into the Headers section for future requests.

Step 3 -> Now we want to insert Lead(user) records into Marketo. Map the Lead’s data from incoming payload to the acceptable payload format of Marketo.

Note → 1) The fields of Marketo vary according to the client Marketo Lead type and his requirements.

2) The lookup field must be provided by them.

Step 4 → Set the url, method and headers in a variable and pass them in the Http Request component. This mapping is passed as the payload section of Requester.

Url – {{base_url}}/rest/v1/leads.json

Method – Post

Headers – Consisting of Authorization token.

Map the response of Http Request according to the requirement.

Note → MemberId and email in this transform message is already saved earlier to make a more meaningful response. PersonId is created from Marketo for every successful record insertion.

You will finally get a response like ->

The status indicates the following ->

Created → If record do not exist and a new record is created in Marketo.

Updated → If a record exists then it will get updated in Marketo.

Skipped → If the record has errors then it will get skipped.

Step 5 → Next step is to insert Activities corresponding to the Leads(Users) which you inserted in the previous step. The Activity fields are specified by client.

For Activities first fetch all the Leads(Users) available in Marketo.

Url – {{base_url}}/rest/v1/leads.json

Method – GET

Query Params – Pass the above mapping in query params.

Step 6 → After getting the Leads(Users) Id,Do the mapping for Activities in Marketo acceptable format.

Step 7 → Set the URL, Method, Headers in a variable for pass it to Request.

Url – {{base_url}}/rest/v1/activities/external.json

Method – Post

Pass the mapping in the payload section of Http Request.

Map the response of Http Request in a more meaningful way according to the requirement.

You will get the response like ->

NOTE → 1) The PersonId is Lead id to which activity is inserted.

2) Activity Id is generated from the Marketo side.

3) The status from Marketo is mapped to marketoStatus.

a) added – Activity record is added.

b) In case of error the error is arised.

Your Marketo will look like this →

Lead(User) data →

Activity data →

The Lead(User) Data is visible in →

Marketo →> Database → All People → People

The Activities are visible in → 

People → Click on Id of any record → Activity Log

We use cookies on this site to enhance your user experience. For a complete overview of how we use cookies, please see our privacy policy.