Skip to main content

Examples

We’ve provided code samples in Python, cURL, Ruby, Go and JavaScript. If you aren’t comfortable working in any of these languages, feel free to use this handy tool to convert code from cURL to the language of your choice.
Heads Up! Credit UsagePerson Search API calls cost the number of total search results returned.If you are making a search that could have a large number of results, make sure to use the size parameter to set the maximum number of results and cap your credit usage.
We want your feedback!Do you see a bug? Is there an example you’d like to see that’s not listed here?Head over to the public roadmap and submit a bug ticket or a feature request and receive automatic notifications as your bug is resolved or your request is implemented.

Basic Usage

“I want to make a query and save the results to a file.”

Using POST Requests

“I want to use POST requests instead of GET requests so that I can make queries with a lot of parameters.”
Difference Between GET and POST RequestsSee this article for a comparison of the differences between GET and POST requests. The biggest difference is that POST requests don’t have any limits on the amount of data that you can pass in the request.

Searching Specific Datasets

“I want to run a simple query against PDL’s Phone Dataset.”
Maintaining Backwards CompatibilityWe introduced the dataset parameter with the July 2021 release, in which we also changed the default dataset from all to resume. For users that want to maintain the same performance in their queries as prior to this change, set the dataset parameter to all in the example below.

Excluding Datasets

“I want to run a simple query against all PDL datasets except the email and phone datasets.”

Bulk Retrieval

“I want to pull all current employees at Amazon and save their profiles to a CSV file.”
High Credit Usage Code BelowThe code example below illustrates retrieving all the employee profiles in a large company and is meant primarily for demonstrating the use of the scroll_token parameter when requesting large amounts of records. As a result, this code is mostly illustrative in purpose. It can further expend a lot of credits and doesn’t have any error handling. The MAX_NUM_RECORDS_LIMIT parameter in the example sets the maximum number of profiles that we will retrieve (and the maximum number of credits that you will expend), so please set it accordingly when testing this example.

Sales Prospecting

“I want to email engineering leaders at stripe.com, plaid.com, xignite.com and square.com, so that I can reach out to them about my product.”

Recruiting

“I have a client looking for marketing managers and dishwashers in Oregon but NOT in portland (don’t ask why). They want to reach out to them on LinkedIn, so they asked that each candidate have a LinkedIn URL. I want as many people as PDL can give me matching this criteria.”

Ads

“I want to sell yachts to rich people through ads on Facebook.”

Customer Insights

“I want information about my biggest customer (Zenefits.)”

Advanced Examples

“I want to find X number of people at each company in my list.”