Examples - Autocomplete API

Illustrative examples for the Autocomplete API

On this page you'll find a collection of full-running code examples that illustrate various aspects of the functionality of the Autocomplete API.

Code examples here are shown using both Python3 and cURL.

Company Autocomplete Example

Give me 10 suggestions for companies starting with "ama"

import requests, json

API_KEY = # ENTER YOUR API KEY

pdl_url = "https://api.peopledatalabs.com/v5/autocomplete"

params = {
    "api_key": API_KEY,
    "field": "company",
    "text": "ama",
    "pretty": True
}

json_response = requests.get(pdl_url,  params=params).json()
print(json_response)
curl -X GET -G \
  'https://api.peopledatalabs.com/v5/autocomplete'\
  -H 'X-Api-Key: xxxx' \
  --data-urlencode 'field=company'\
  --data-urlencode 'text=ama'

Job Title Autocomplete Example

*Give me 20 suggestions for job titles starting with the prefix "data".

import requests, json

API_KEY = # ENTER YOUR API KEY

pdl_url = "https://api.peopledatalabs.com/v5/autocomplete"

params = {
    "api_key": API_KEY,
    "field": "title",
    "text": "data",
    "size": 20,
    "pretty": True
}

json_response = requests.get(pdl_url,  params=params).json()
print(json_response)
curl -X GET -G \
  'https://api.peopledatalabs.com/v5/autocomplete'\
  -H 'X-Api-Key: xxxx' \
  --data-urlencode 'field=title'\
  --data-urlencode 'text=data'\
  --data-urlencode 'size=20'

Did this page help you?