syncLead

This function will insert or update a single lead record. When updating an existing lead, the lead can be identified with one of the following keys:

  • Marketo ID
  • Foreign system ID (implemented as foreignSysPersonId)
  • Marketo Cookie (created by Munchkin JS script)
  • Email

If an existing match is found, the call will perform an update. If not, it will insert and create a new lead. Anonymous leads can be updated using the Marketo Cookie ID and will become known upon update.

Except for Email, all of these identifiers are treated as unique keys. The Marketo ID takes precedence over all other keys. If both foreignSysPersonId and the Marketo ID are present in the lead record, then the Marketo ID will take precedence and the foreignSysPersonId will be updated for that lead. If the only foreignSysPersonId is given, then it will be used as a unique identifier. If both foreignSysPersonId and Email are present but the Marketo ID is not present, the foreignSysPersonId will take precedence and the Email will be updated for that lead.

Optionally, a Context Header can be specified to name the target workspace.

When Marketo workspaces are enabled and the header is used, the following rules are applied:

  • If assignment rules are set and a new lead qualifies for any of the configured rules, then new leads are created in the partition defined by the assignment rule.  Otherwise, new leads are created in the primary partition of the named workspace.
  • Leads matched by the Marketo Lead ID, a foreign system ID, or a Marketo Cookie, must exist in the primary partition of the named workspace, otherwise an error will be returned
  • If an existing lead is matched by email, the named workspace is ignored and the lead is updated in its’ current partition

When Marketo workspaces are enabled and the header is NOT used, the following rules are applied:

  • If assignment rules are set and a new lead qualifies for any of the configured rules, then new leads are created in the partition defined by the assignment rule.  Otherwise, new leads are created in the primary partition of the “Default” workspace.
  • Existing leads are updated in their current partition

If Marketo workspaces are NOT enabled, the target workspace MUST be the “Default” workspace. It is not necessary to pass the header.

Request

Field Name

Required/Optional

Description

leadRecord->Id Required – Only when Email or foreignSysPersonId is not present The Marketo Id of the lead record
leadRecord->Email Required – Only when Id or foreignSysPersonId is not present The email address associated with the lead record
leadRecord->foreignSysPersonId Required – Only when Id or Email is not present The foreign system id associated with the lead record
leadRecord->foreignSysType Optional – Only required when foreignSysPersonId is present The type of foreign system. Possible values: CUSTOM, SFDC, NETSUITE
leadRecord->leadAttributeList->attribute->attrName Required The name of the lead attribute you want to update the value of.
leadRecord->leadAttributeList->attribute->attrValue Required The value you want to set to the lead attribute specificed in attrName.
returnLead Required When true will return the complete updated lead record upon update.
marketoCookie Optional The Munchkin javascript cookie

Request XML

Response XML

Sample Code – PHP

Sample Code – Java

Sample Code – Ruby