Authentication

Authentication

There are three ways to authenticate requests:

In URL

import requests

# Set your API key
API_KEY = "YOUR API KEY"

# Set the Person Enrichment API URL, including the API key
PDL_URL = "https://api.peopledatalabs.com/v5/person/enrich?api_key={}".format(API_KEY)

# Pass the URL to the Person Enrichment API
json_response = requests.get(PDL_URL).json()
curl -X GET \
  'https://api.peopledatalabs.com/v5/person/enrich?api_key=xxxx'

In Header

import requests

# Set your API key
API_KEY = "YOUR API KEY"

# Set the Person Enrichment API URL
PDL_URL = "https://api.peopledatalabs.com/v5/person/enrich"

# Set the headers
HEADERS = {
    "X-Api-Key": API_KEY
}

# Pass the URL and the headers to the Person Enrichment API
json_response = requests.get(PDL_URL,  headers=HEADERS).json()
curl -X GET \
  'https://api.peopledatalabs.com/v5/person/enrich' \ 
  -H 'X-Api-Key: xxxx'

In SDKs

# See https://github.com/peopledatalabs/peopledatalabs-python
from peopledatalabs import PDLPY

# Create a client, specifying your API key
CLIENT = PDLPY(
    api_key="YOUR API KEY",
)

# Create a parameters JSON object
PARAMS = {
    "company": ["Hallspot", "People Data Labs"],
  	"email": ["[email protected]"]
}

# Pass the parameters object to the Person Enrichment API
response = CLIENT.person.enrichment(**PARAMS)

# Print the API response
print(response.text)
// See https://github.com/peopledatalabs/peopledatalabs-js
import PDLJS from 'peopledatalabs';

// Create a client, specifying your API key
const PDLJSClient = new PDLJS({ apiKey: "YOUR API KEY" });

// Create a parameters JSON object
const params = {
    company: "Hallspot",
    company: "People Data Labs",
    email: "[email protected]"
}

// Pass the parameters object to the Person Enrichment API
PDLJSClient.person.enrichment(params).then((response) => {
    // Print the API response in JSON format
    console.log(response);
}).catch((error) => {
    console.log(error);
});
# See https://github.com/peopledatalabs/peopledatalabs-ruby
require 'peopledatalabs'

# Set your API key
Peopledatalabs.api_key = 'YOUR API KEY'

# Create a parameters JSON object
PARAMS = {
    "company": ["Hallspot", "People Data Labs"],
  	"email": ["[email protected]"]
}

# Pass the parameters object to the Person Enrichment API
response = Peopledatalabs::Enrichment.person(params: PARAMS)

# Print the API response
puts response
package main

import (
    "fmt"
    "context"
)

// See https://github.com/peopledatalabs/peopledatalabs-go
import (
    pdl "github.com/peopledatalabs/peopledatalabs-go"
    pdlmodel "github.com/peopledatalabs/peopledatalabs-go/model"
)

func main() {
    // Set your API key
    apiKey := "YOUR API KEY"
    // Set API key as environmental variable
    // apiKey := os.Getenv("API_KEY")

    // Create a client, specifying your API key
    client := pdl.New(apiKey)
    
    // Create a parameters JSON object
    params := pdlmodel.EnrichPersonParams {
        PersonParams: pdlmodel.PersonParams {
            Company: []string{"Hallspot", "People Data Labs"},
            Email: []string{"[email protected]"},
        },
    }

    // Pass the parameters object to the Person Enrichment API
    response, err := client.Person.Enrich(context.Background(), params)
    
    // Print the API response
    if err == nil {
        fmt.Println(response)
    }  
}

Requests with an invalid API Key will return a 401 Error.

If you need any assistance, or if you would like to either request a new API key or delete your existing key, please contact your account manager or reach out to us at [email protected]