Service endpoint¶
https://api.targetsmart.com/person/record
Overview¶
This service can be used to search TargetSmart’s voting age population Voterbase database.
Request parameters¶
| Key | Required | Optional | Default | Permitted Values |
|---|---|---|---|---|
first_name |
✓ | One or more alpha characters. | ||
last_name |
✓ | One or more alpha characters. | ||
street_number |
✓ | One or more alphanumeric characters. | ||
street_name |
✓ | One or more alphanumeric characters. | ||
street_address |
✓ | Full street address if parts are not included | ||
city |
✓ | One or more alpha characters. | ||
state |
✓ | 2 character U.S. state code (e.g. NY) |
||
zip_code |
✓ | 5 digit U.S. zip code | ||
phone |
✓ | 10 digit U.S. phone number | ||
email |
✓ | A valid email address | ||
profile_id |
✓ | Profile identifier for accessing different configuration profiles |
Optional Parameters¶
All requests must contain one or more optional parameters. For best match probability, the recommendation is to include a phone or email, or at least a last name along with some combination of at least 2 address fields.
Address¶
For address requests include either an unparsed street_address (without city, state, zip) or street_number and street_name.
profile_id¶
profile_id is an optional profile identifier that enables access to different configuration profiles using the same API key. Users can log in to the website and find the profile ID and the associated configuration for each profile in the User API Keys section. If no profile_id is passed in the request, the default profile will be used to process the API request.
JSON response¶
Search responses are JSON objects with the following key:
result: A JSON object with a set of preconfigured fields if a match was found, otherwise an empty object. The fields that are returned are configured on a per-client basis. Consult our support staff for available fields, data dictionary, etc.confidence: The match confidence score.
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/record",
params={
"first_name": "BOB",
"last_name": "EXAMPLE",
"state": "OH",
"phone": "1112223333",
},
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({
first_name: "BOB",
last_name: "EXAMPLE",
state: "OH",
phone: "1112223333",
});
fetch("https://api.targetsmart.com/person/record?" + 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/record?first_name=BOB&last_name=EXAMPLE&state=OH&phone=1112223333")
echo $result