Leads

Returns leads matching search criteria

The /search/leads resource is used to find leads using full text search. For example, you can search for fred in texas using:

/search/leads?query=fred+tx

Search Criteria

  • pass in the search text using the query parameter: /search/leads?query=fred
  • the query parameter should be URL encoded
  • searching is case-insensitive: FRED and fred will both match Fred
  • you don't have to enter a complete word - searching will match the beginning of words: /search/leads?query=sam will match sam and samantha
  • queries with multiple words like fred tx will match leads that have both fred AND tx
  • to specify an exact phrase (with spaces), use double quotes - "fred tx" will only match that exact text

The search results can be sorted and paginated. There are two query parameter to control sorting: sort_by and sort_dir. The sort_by parameter takes a field name (see list below) and sort_dir is ascending (asc) or descending (desc). By default, the results are sorted by relevance.

There are two query parameters to control paging: from and limit. The from parameter specifies the starting offset of that page in the search results and the limit parameter specifies how many search results to return. From is zero-based so to get the first 10 results, use from=0&limit=10, the second 10 using from=10&limit=10, etc... The maximum limit is 100 at a time, with an overall maximum of 1,000 search results.

Search Results

The search results has the total number of matching leads and an array of hits, where each hit is a matching Lead Search Result. Each lead search result contains basic information about the lead, the latest event for that lead, and highlighting of the matched text.

Request
query Parameters
query
string

text to search for

sort_by
string

One of the following field names: lead_id, submission_timestamp, first_name, last_name, email, phone_1, phone_2, address_1, city, state, postal_code, reference

Enum: "lead_id" "submission_timestamp" "first_name" "last_name" "email" "phone_1" "phone_2" "address_1" "city" "state" "postal_code" "reference"
sort_dir
string

The sort direction: "asc" or "desc", default is by relevance

Enum: "asc" "desc"
from
integer

The starting offset of leads to return in the matching result set, zero-based

limit
integer

The maximum number of leads to return (maximum is 100, default is 10)

Responses
200

OK

get/search/leads
Request samples
curl -i -X GET \
  'https://app.leadconduit.com/search/leads?query=string&sort_by=lead_id&sort_dir=asc&from=0&limit=0'
Response samples
application/json
[
  • {
    • "address_1": "string",
    • "city": "string",
    • "email": "string",
    • "first_name": "string",
    • "flow_id": "string",
    • "flow_name": "string",
    • "last_name": "string",
    • "lead_id": "string",
    • "phone_1": "string",
    • "phone_2": "string",
    • "postal_code": "string",
    • "reference": "string",
    • "source_id": "string",
    • "source_name": "string",
    • "state": "string",
    • "submission_timestamp": "2019-08-24T14:15:22Z",
    • "highlight": { },
    • "latest_event": {
      • "id": "string",
      • "type": "source",
      • "outcome": "failure",
      • "reason": "NREL failure",
      • "vars": {
        • "vars": { }
        },
      • "module_id": "string",
      • "acceptance_criteria": {
        • "rule_set": {
          • "id": "string",
          • "op": "and",
          • "rules": [
            • {
              • "id": "string",
              • "lhv": "lead.state",
              • "op": "is equal to",
              • "rhv": "TX",
              • "rule_set": { }
              }
            ]
          },
        • "outcome": "string",
        • "reason": "string"
        },
      • "flow_acceptance_criteria": {
        • "rule_set": {
          • "id": "string",
          • "op": "and",
          • "rules": [
            • {
              • "id": "string",
              • "lhv": "lead.state",
              • "op": "is equal to",
              • "rhv": "TX",
              • "rule_set": { }
              }
            ]
          },
        • "outcome": "string",
        • "reason": "string"
        },
      • "pricing": {
        • "override": true,
        • "prices": [
          • {
            • "id": { },
            • "amount": 0,
            • "rule_set": {
              • "id": "string",
              • "op": "and",
              • "rules": [
                • null
                ]
              }
            }
          ]
        },
      • "flow_pricing": {
        • "override": true,
        • "prices": [
          • {
            • "id": { },
            • "amount": 0,
            • "rule_set": {
              • "id": "string",
              • "op": "and",
              • "rules": [
                • null
                ]
              }
            }
          ]
        },
      • "cost": 0,
      • "purchase_price": 0,
      • "recipient_revenue": 0,
      • "step_count": 0,
      • "disabled_step_count": 0,
      • "package_version": "string",
      • "handler_version": "string",
      • "request": { },
      • "response": { },
      • "flow_caps": [
        • {
          • "id": "string",
          • "cap_ids": [
            • "string"
            ],
          • "caps": [
            • { }
            ],
          • "count": 0,
          • "duration": 1,
          • "duration_units": "month",
          • "expires_at": "2020-11-23T11:41:52Z",
          • "failed_count": 0,
          • "flow_id": "string",
          • "maximum": 1200,
          • "name": "Monthly leads from TX",
          • "source_id": "string",
          • "started_at": "2020-11-23T11:41:52Z",
          • "step_id": "string",
          • "time_zone": "America/New_York",
          • "type": "volume",
          • "updated_at": "2020-11-23T11:41:52Z"
          }
        ],
      • "source_caps": [
        • {
          • "id": "string",
          • "cap_ids": [
            • "string"
            ],
          • "caps": [
            • { }
            ],
          • "count": 0,
          • "duration": 1,
          • "duration_units": "month",
          • "expires_at": "2020-11-23T11:41:52Z",
          • "failed_count": 0,
          • "flow_id": "string",
          • "maximum": 1200,
          • "name": "Monthly leads from TX",
          • "source_id": "string",
          • "started_at": "2020-11-23T11:41:52Z",
          • "step_id": "string",
          • "time_zone": "America/New_York",
          • "type": "volume",
          • "updated_at": "2020-11-23T11:41:52Z"
          }
        ],
      • "start_timestamp": 0,
      • "end_timestamp": 0,
      • "firehose": {
        • "credential_id": "string",
        • "bucket": "string",
        • "enabled": true,
        • "prefix": "string"
        },
      • "ms": 0,
      • "wait_ms": 0,
      • "overhead_ms": 0,
      • "lag_ms": 0,
      • "host": "string",
      • "cap_reached": true,
      • "flow_ping_limits": {
        • "id": "string",
        • "name": "string",
        • "maximum": 0,
        • "duration": 0,
        • "duration_units": "string",
        • "time_zone": "string",
        • "created_at": "2019-08-24T14:15:22Z"
        },
      • "source_ping_limits": {
        • "id": "string",
        • "name": "string",
        • "maximum": 0,
        • "duration": 0,
        • "duration_units": "string",
        • "time_zone": "string",
        • "created_at": "2019-08-24T14:15:22Z"
        },
      • "ping_limit_reached": true,
      • "expires_at": "2019-08-24T14:15:22Z"
      }
    }
]