New Search API - Query users & leads by any combination of fields

Hi all,

We’ve released to early access a new API that makes it easier than ever to pull the exact customer data you want — when you want it. The new Search API lets you:

  • Query users and leads filtered by any field, including custom attributes
  • Use nested AND / OR logical operators
  • Search by Contains, Starts with, Ends with, etc.

Plus, you can find users and leads in a single response, using the new Customer API.

This is now available in Unstable API version and we’re looking forward to hearing your feedback.

Expected breaking changes before it becomes a release candidate, changes planned for mid August:

  1. We use contact in role to keep it consistent with the old APIs, but when the new Customer API is released it will be renamed to lead to follow the same naming than our UI.
  2. We use anonymous boolean to describe a lead, which will be deprecated since we have role already.
  3. We use App_id to identify the customer workspace, given app has different meanings we’re slowly renaming it across all our APIs (last change was introduced to Canvas Kit).

Example
Top 10 active leads in Salesforce in Energy & Clean Tech sectors.

// POST JSON Request 
{
    "query": {
        "operator": "AND",
        "value": [{
            "field": "custom_attributes.salesforce_object_type",
            "operator": "=",
            "value": "Lead"
        }, {
            "field": "updated_at",
            "operator": ">",
            "value": 1560436658
        },        
        {
        	"operator": "OR",
            "value": [{
	            "field": "tags",
	            "operator": "=",
	            "value": "Energy"
            }, {
	            "field": "tags",
	            "operator": "=",
	            "value": "Clean Energy"
            }]
        }
        ]
    },
	"sort": {
		"field": "custom_attributes.lead_score",
	    "order": "descending"
	},
	"pagination": {
	    "per_page": 10
	}  
}

Docs: