Service endpoint¶
https://api.targetsmart.com/person/email-search
Overview¶
This service can be used to enrich a list of emails with TargetSmart data. The service provides high performance for single record lookups and batch requests. A common use-case is to match an address book for enrichment with TargetSmart data. The corresponding JSON response includes the TargetSmart data field values from our platform database. TargetSmart Client Services configures the returned field identifiers for your key. The request is executed synchronously with low latency.
Request Parameters¶
Key | Required | Optional | Default | Permitted Values |
---|---|---|---|---|
emails |
✓ | A comma separated list of up to 200 valid emails | ||
match_type |
✓ | H or I indicating if the email is matched at the individual person level or at the household level |
Additional Parameter Details¶
This service returns fields based on configured person/data-enhance fields.
emails
A comma separated list (no spaces) of valid email addresses.
match_type
Must be a string of H
or I
JSON Response¶
Responses are JSON objects with the following keys:
states_updated
: Voter file update date information represented as a JSON object where keys are two character U.S. state codes and values are dates the state voter file was last updated. The date format is YYYYMMDD.result
: A list of JSON objects mapping field names to data values for each input email
An example response (Note: Your responses will have different data fields based on your configuration):
'result': [
{'vb.voterbase_id': 'CA-123456',
'vb.vf_source_state': 'CA',
'vb.tsmart_first_name': 'Jane',
'vb.tsmart_last_name': 'Doe'},
...
]
Code Examples¶
🔐 Remember to secure your API key
Never expose your API key in plain text or source control accessible by a third party.
#! /usr/bin/env python3
import os
import requests
api_key = os.environ["TS_API_KEY"]
# `point` query
response = requests.get(
"https://api.targetsmart.com/person/email-search",
params={"emails": "bob@example.com,joe@example.com"},
headers={"x-api-key": api_key},
)
response.raise_for_status()
print(response.json())
#! /usr/bin/env node
const fetch = require("node-fetch");
const targetSmartApiKey = process.env.TS_API_KEY;
const queryParams = new URLSearchParams({
emails: "bob@example.com,joe@example.com",
});
fetch(
"https://api.targetsmart.com/person/email-search?" + queryParams.toString(),
{
method: "GET",
headers: {
"x-api-key": targetSmartApiKey,
},
}
)
.then((res) => res.json())
.then((json) => console.log(json));
#! /usr/bin/env bash
result=$(curl -XGET \
-H "x-api-key: $TS_API_KEY" \
"https://api.targetsmart.com/person/email-search?emails=bob%40example.com%2Cjoe%40example.com")
echo $result