There are two primary ways to pass parameters in an API request:

  1. Set the parameters directly in the URL of the API request.
  2. Set the parameters through a parameters JSON object.

We recommend that you pass parameters through a JSON object, though you may also pass parameters in the URL if you'd like. Anything that we find in a JSON object will take precedence over parameters that we find in the URL. Here is an example of our Person Enrichment API for reference:

In URL

import requests

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

# Set the Person Enrichment API URL, including the parameters
PDL_URL = "https://api.peopledatalabs.com/v5/person/enrich?api_key=%s&[email protected]&company=Hallspot&company=People Data Labs" % API_KEY

# Print the API response in JSON format
json_response = requests.get(PDL_URL).json()

In a JSON Object

# 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
json_response = CLIENT.person.enrichment(**PARAMS).json()

# Print the API response in JSON format
print(json_response)
// 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((jsonResponse) => {
    // Print the API response in JSON format
    console.log(jsonResponse);
}).catch((error) => {
    console.log(error);
});
require 'json'

# 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
json_response = JSON.dump(Peopledatalabs::Enrichment.person(params: PARAMS))

# Print the API response in JSON format
puts json_response
package main

import (
    "fmt"
    "encoding/json"
    "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)
    
    // Check for successful response
    if err == nil {
        // Convert the API response to JSON
        jsonResponse, jsonErr := json.Marshal(response)
        // Print the API response
        if (jsonErr == nil) {
            fmt.Println(string(jsonResponse))
        }
    }  
}
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"

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

# Pass the parameters object to the Person Enrichment API
json_response = requests.get(PDL_URL,  params=PARAMS).json()

# Print the API response in JSON format
print(json_response)

Did this page help you?