Bulk Import

Marketo provides interfaces for insertion of large sets of person and person related data, called Bulk Import. Currently, interfaces are offered for two object types:

Leads (Persons)

Custom Objects

Bulk import is performed by creating a job, and then waiting for the job to complete reading a file. These jobs are executed asynchronously, and can be polled to retrieve the status of the import. Files are uploaded using HTTP multipart/form-data per RFC 2399.

Authentication

The bulk import APIs use the same OAuth 2.0 authentication method as other Marketo REST APIs. This requires a valid access token to be embedded either as the query-string parameter “access_token={AccessToken}”, or as an HTTP header “Authorization: Bearer {AccessToken}”.

Limits

Max Concurrent Import Jobs: 2

Max Queued Import Jobs (inclusive of currently importing jobs): 10

Max Size of Import File: 10 MB

Permissions

Bulk Import uses the same permissions model as the Marketo REST API, and does not require any additional special permissions in order to use, though specific permissions are required for each set of endpoints.

Creating a Job

Marketo’s bulk import APIs use the concept of a job for executing data import. Let’s look at creating a simple lead import job.

Request

1

POST/bulk/v1/leads.json?format=csv

Body

1

2

3

4

5

6

7

8

------WebKitFormBoundaryBQACkJZyaiIAXogC

Content-Disposition:form-data;name="file";filename="leads.csv"

FirstName,LastName,Email,Company

Able,Baker,ablebaker@marketo.com,Marketo

Charlie,Dog,charliedog@marketo.com,Marketo

Easy,Fox,easyfox@marketo.com,Marketo

------WebKitFormBoundaryBQACkJZyaiIAXogC--

This request will construct a job that will import values contained in the CSV file named “leads.csv” with the column headers “FirstName”, “LastName”, “Email”, “Company”.

Response

1

2

3

4

5

6

7

8

9

10

11

{

"requestId":"d01f#15d672f8560",

"result":[

{

"batchId":3404,

"importId":"3404",

"status":"Queued"

}

],

"success":true

}

When we submit the job it will return a batchId, which we can then use to check its status.

Common Parameters

Each job creation endpoint shares some common parameters for configuring the file format, field names, and filter of a bulk extract job. Each subtype of extract job may have additional parameters:

Parameter

Data Type

Notes

format

String

Determines the file format of the imported data with options for comma-separated values, tab-separated values, and semi-colon-separated values. Accepts one of: CSV, SSV, TSV. The format defaults to CSV.

file

String

Data is specified through multipart form-data in the file.

Polling Job Status

Determining the status of the job is simple.

Request

1

GET/bulk/v1/leads/batch/3404.json

Response

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

{

"requestId":"1f63#15d6738fd15",

"result":[

{

"batchId":3404,

"importId":"3404",

"status":"Complete",

"numOfLeadsProcessed":3,

"numOfRowsFailed":0,

"numOfRowsWithWarning":0,

"message":"Import succeeded, 3 records imported (3 members)"

}

],

"success":true

}

The inner “status” will indicate the progress of the job, and may be one of the following values: Queued, Importing, Complete, Failed. In this case our job has completed, so we can stop polling.

Latest Blog Posts

Keep up with what's new in the developer world

Important Change to Activity Records in Marketo APIs March 1, 2017 Note: This post will be updated to reflect changes made to activity records returned by the API due to migration to new infrastructure.
With the rollout of Marketo’s next-generation Activity Service beginning in Septmeber, we will be unable to enforce the uniqueness or presence of the integer “id” field in activities, data value changes, or lead deletion ... Read More >

Internet of Things for Marketers with IFTTT and Zapier June 20, 2017 The Internet of Things (IoT) is the inter-networking of connected devices, appliances, wearables, vehicles, etc. with embedded electronics, software, sensors, and network connectivity that enable these objects to collect and exchange data with cloud information systems. These technologies are growing and trending so fast that they will impact how we live, how we work and ... Read More >

Spring 2017 Updates June 16, 2017 In the Spring 2017 release, we are adding the ability to bulk extract lead and activity object data asynchronously, and to manipulate named account lists. See the full list of updates below.
Lead Database APIs
Bulk Extract of Leads
New endpoints to support extraction of leads in bulk. Specify record selection criteria using a variety of options. Details can ... Read More >