Documentation Center

List Marketo leads

Use the externalItems GraphQL query get a list of Marketo leads (MarketoLead as the entity type) that match on a specified search string. This example illustrates a request to retrieve leads based on a matching the ID and token values, which in this case includes the Marketo "Munchkin," the Marketo JavaScript tracking code.

Example request

{
  externalItems(
    namespace: "mkt",
    filter: {
      type: "MarketoLead"
      searchText: "id:654-EUC-687&token:_mch-localhost-1631785014232-80414"
    }
  ) {
    edges {
      node {
        ... on MarketoLead {
          identity {
            id
            structureType
            type
          }
          firstName
          lastName
          email
          createdAt
          updatedAt
          programMembership
          smartCampaignMembership
          staticListMembership
          additionalFields {
            name
            value
          }
        }
      }
    }
  }
}

Example response

{
    "data": {
        "externalItems": {
            "edges": [
                {
                    "node": {
                        "identity": {
                            "id": "57",
                            "structureType": "Leaf",
                            "type": "MarketoLead"
                        },
                        "firstName": "John",
                        "lastName": "Doe",
                        "email": "jdoe@random.com",
                        "createdAt": "2021-08-16T15:51:47Z",
                        "updatedAt": "2021-10-26T11:30:45Z",
                        "programMembership": ["Acadian Forms"],
                        "smartCampaignMembership": [
                            "Run Action Add to List 2022-01-17 07:37:16 am",
                            "Run Action Add to Engagement Program 2021-10-13 11:58:56 pm",
                            "Run Action Add to List 2021-10-12 04:59:48 am"
                        ],
                        "staticListMembership": ["Tridion Group List"],
                        "additionalFields": [
                            {
                                "name": "anonymousIP",
                                "value": "89.24.100.182"
                            },
                            {
                                "name": "inferredCity",
                                "value": "Berlin"
                            },
                            {
                                "name": "leadPerson",
                                "value": "57"
                            },
                            {
                                "name": "leadRole",
                                "value": null
                            },
                            {
                                "name": "cookies",
                                "value": "_mch-localhost-1631785014232-80414,_mch-win-cr12votfo5o-1635247701966-35501"
                            }
                        ]
                    }
                }
            ]
        }
    }
}