> ## Documentation Index
> Fetch the complete documentation index at: https://docs.peopledatalabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Examples - Skill Enrichment API

> ❗️ The Skill Enrichment API is now fully removed
>
> This endpoint was removed in our April 2025 (v30.0) Release and is no longer available. This page is retained for historical documentation purposes.
>
> For more information, please see our [April 2025 Release Notes (v30.0)](https://docs.peopledatalabs.com/changelog/april-2025-release-notes-v300).

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](https://curl.trillworks.com/) to convert code from cURL to the language of your choice.

<Callout icon="💡" theme="default">
  ### 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](https://peopledatalabs.canny.io/bugs) or a [feature request](https://peopledatalabs.canny.io/feature-requests) and receive automatic notifications as your bug is resolved or your request is implemented.
</Callout>

## Basic Usage

*"I want to look up information for a skill that I have."*

```python Python3 SDK
# 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
QUERY_STRING = {"skill": "pyspark"}

# Pass the parameters object to the Skill Enrichment API
response = CLIENT.skill(**QUERY_STRING)

# Print the API response
print(response.text)
```

```shell cURL
curl -X GET -G \
  'https://api.peopledatalabs.com/v5/skill/enrich' \
  -H 'X-Api-Key: YOUR API KEY' \
  --data-urlencode 'skill=pyspark'
```

```javascript
// 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 queryString = {skill: "pyspark"}

// Pass the parameters object to the Skill API
PDLJSClient.skill(queryString).then((data) => {
    // Print the API response
    console.log(data);
}).catch((error) => {
    console.log(error);
});
```

```ruby
# See https://github.com/peopledatalabs/peopledatalabs-ruby
require 'peopledatalabs'

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

# Pass parameters to the Skill API
response = Peopledatalabs::Skill.retrieve("skill": "pyspark")

# Print the API response
puts response
```

```go
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
    queryString := pdlmodel.SkillBaseParams{Skill: "pyspark"}
    
    params := pdlmodel.SkillParams{
        SkillBaseParams: queryString,
    }
    
    // Pass the parameters object to the Skill API
    response, err := client.Skill(context.Background(), params)
    // Check for successful response
    if err == nil {
        // Print the API response
        fmt.Println(response)
    }  
}
```

```python Python3
import requests

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

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

# Create a parameters JSON object
QUERY_STRING = {"skill": "pyspark"}

# Set headers
HEADERS = {
    'accept': "application/json",
    'content-type': "application/json",
    'x-api-key': API_KEY
}

# Pass the parameters object to the Skill Enrichment API
response = requests.request("GET", PDL_URL, headers=HEADERS, params=QUERY_STRING)

# Print the API response
print(response.text)
```

## Person Searching Using Skill Data

*"I want to search for people with similar skills."*

```python Python3 SDK (Elasticsearch)
import json

# 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",
)

# Set the maximum number of people to search
MAX_NUM_PEOPLE = 100

# The skill you want to enrich
SKILL = "ai"
# Create a parameters JSON object
QUERY_STRING = {"skill": SKILL}

# Pass the parameters object to the Skill Enrichment API
response = CLIENT.skill(**QUERY_STRING)

# Check for successful response
if response.status_code == 200:
  # Store enriched skill
  enriched_skill = response.json()
  # Build list of skills
  skills = enriched_skill["data"]["similar_skills"]
  skills.insert(0, SKILL)
else:
  enriched_skill = {}
  print(f"Skill Enrichment Error for [{SKILL}]: {response.text}")
                                                      
# Person Search matches
employee_matches = {}

# Check for enriched skill
if enriched_skill:
  # Create an Elasticsearch query
  ES_QUERY = {
  	"query": {
    	"bool": {
        	"must": [
            	{"term": {"location_region": "utah"}},
            	{"terms": {"skills": skills}},
      		]
    	}
  	}
  }

  # Create a parameters JSON object
  PARAMS = {
  	'query': ES_QUERY,
  	'size': MAX_NUM_PEOPLE
  }
  
  # Pass the parameters object to the Person Search API
  response = CLIENT.person.search(**PARAMS).json()

  # Check for successful response
  if response["status"] == 200:
    # Store matches
  	employee_matches = response["data"]
  else:
  	employee_matches = {}
  	print(f"Person Search Error for [{SKILL}]: {response}")

  print(f"Found {len(employee_matches)} employee profiles for {SKILL}.")
```

```python Python3 SDK (SQL)
import json

# 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",
)

# Set the maximum number of people to search
MAX_NUM_PEOPLE = 100

# The skill you want to enrich
SKILL = "ai"
# Create a parameters JSON object
QUERY_STRING = {"skill": SKILL}

# Pass the parameters object to the Skill Enrichment API
response = CLIENT.skill(**QUERY_STRING)

# Check for successful response
if response.status_code == 200:
  # Store enriched skill
  enriched_skill = response.json()
  # Build list of skills
  skills = enriched_skill["data"]["similar_skills"]
  skills.insert(0, SKILL)
  skills_string_rep = ", ".join(
    (f"'{skl}'" for skl in skills)
  )
else:
  enriched_skill = {}
  print(f"Skill Enrichment Error for [{SKILL}]: {response.text}")
                                                      
# Person Search matches
employee_matches = {}

# Check for enriched skill
if enriched_skill:
  # Create an SQL query
  SQL_QUERY = f"""
  SELECT * FROM person
  WHERE location_region='utah'
  AND skills IN ({skills_string_rep});
  """

  # Create a parameters JSON object
  PARAMS = {
  	'sql': SQL_QUERY,
  	'size': MAX_NUM_PEOPLE
  }
  
  # Pass the parameters object to the Person Search API
  response = CLIENT.person.search(**PARAMS).json()

  # Check for successful response
  if response["status"] == 200:
    # Store matches
  	employee_matches = response["data"]
  else:
  	employee_matches = {}
  	print(f"Person Search Error for [{SKILL}]: {response}")

  print(f"Found {len(employee_matches)} employee profiles for {SKILL}.")
```

```javascript JavaScript (Elasticsearch)
// 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" });

// Set the maximum number of people to search
const maxNumPeople = 100;

// The skill you want to enrich
const skill = "ai";
// Create a parameters JSON object
const queryString = {skill: skill};

// Pass the parameters object to the Skill API
PDLJSClient.skill(queryString).then((data) => {
    // Store enriched skill
    var enrichedSkill = data;
    // Build list of skills
    var skills = enrichedSkill["data"]["similar_skills"];
    skills.splice(0, 0, skill);
    
    // Create an Elasticsearch query
    const esQuery = {
        "query": {
            "bool": {
                "must": [
                    {"term": {"location_region": "utah"}},
                    {"terms": {"skills": skills}}
      		    ]
    	   }
        }
    }

    // Create a parameters JSON object
    const params = {
        searchQuery: esQuery,
        size: maxNumPeople
    }

    // Pass the parameters object to the Person Search API
    PDLJSClient.person.search.elastic(params).then((data) => {
        // Store matches
        var employeeMatches = data["data"];       
        console.log(`Found ${employeeMatches.length} employee profiles for ${skill}.`); 
    }).catch((error) => {
        console.log(`Person Search Error for [${skill}]:`, error);
    });
       
}).catch((error) => {
    console.log(`Skill Enrichment Error for [${skill}]:`, error);
});
```

```javascript JavaScript (SQL)
// 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" });

// Set the maximum number of people to search
const maxNumPeople = 100;

// The skill you want to enrich
const skill = "ai";
// Create a parameters JSON object
const queryString = {skill: skill};

// Pass the parameters object to the Skill API
PDLJSClient.skill(queryString).then((data) => {
    // Store enriched skill
    var enrichedSkill = data;
    // Build list of skills
    var skills = enrichedSkill["data"]["similar_skills"];
    skills.splice(0, 0, skill);
    var skillsStringRep = "'" + skills.join("', '") + "'";
    
    // Create an SQL query
    const sqlQuery = `SELECT * FROM person 
                        WHERE location_region='utah'
                        AND skills IN (${skillsStringRep});`

    // Create a parameters JSON object
    const params = {
        searchQuery: sqlQuery,
        size: maxNumPeople
    }

    // Pass the parameters object to the Person Search API
    PDLJSClient.person.search.sql(params).then((data) => {
        // Store matches
        var employeeMatches = data["data"];       
        console.log(`Found ${employeeMatches.length} employee profiles for ${skill}.`); 
    }).catch((error) => {
        console.log(`Person Search Error for [${skill}]:`, error);
    });
       
}).catch((error) => {
    console.log(`Skill Enrichment Error for [${skill}]:`, error);
});
```

```ruby Ruby (Elasticsearch)
# See https://github.com/peopledatalabs/peopledatalabs-ruby
require 'peopledatalabs'

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

# Set the maximum number of people to search
MAX_NUM_PEOPLE = 100

# The skill you want to enrich
SKILL = "ai"

# Pass parameters to the Skill API
response = Peopledatalabs::Skill.retrieve("skill":SKILL)

# Check for successful response
if response['status'] == 200
  # Store enriched skill
  enriched_skill = response
  # Build list of skills
  skills = enriched_skill['data']['similar_skills']
  skills.insert(0, SKILL)
else
  enriched_skill = {}
  puts "Skill Enrichment Error for [#{SKILL}]: #{response}"
end

# Person Search matches
employee_matches = {}

# Check for enriched job title
if !enriched_skill.nil?
  # Create an Elasticsearch query
  ES_QUERY = {
  	"query": {
    	"bool": {
        	"must": [
            	{"term": {"location_region": "utah"}},
            	{"terms": {"skills": skills}}
      		]
    	}
  	}
  }

  # Pass parameters to the Person Search API
  response = Peopledatalabs::Search.person(searchType: 'elastic', query: ES_QUERY, size: MAX_NUM_PEOPLE)

  # Check for successful response
  if response['status'] == 200
    # Store matches
  	employee_matches = response['data']
  else
  	employee_matches = {}
  	puts "Person Search Error for [#{SKILL}]: #{response}"
  end

  puts "Found #{employee_matches.length()} employee profiles for #{SKILL}."
end
```

```ruby Ruby (SQL)
# See https://github.com/peopledatalabs/peopledatalabs-ruby
require 'peopledatalabs'

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

# Set the maximum number of people to search
MAX_NUM_PEOPLE = 100

# The skill you want to enrich
SKILL = "ai"

# Pass parameters to the Skill API
response = Peopledatalabs::Skill.retrieve("skill":SKILL)

# Check for successful response
if response['status'] == 200
  # Store enriched skill
  enriched_skill = response
  # Build list of skills
  skills = enriched_skill['data']['similar_skills']
  skills.insert(0, SKILL)
  skills_string_rep = "'" + skills.join("','") + "'"
else
  enriched_skill = {}
  puts "Skill Enrichment Error for [#{SKILL}]: #{response}"
end

# Person Search matches
employee_matches = {}

# Check for enriched job title
if !enriched_skill.nil?
  # Create an SQL query
  SQL_QUERY = """
    SELECT * FROM person
    WHERE location_region='utah'
    AND skills IN (#{skills_string_rep});
   """

  # Pass parameters to the Person Search API
  response = Peopledatalabs::Search.person(searchType: 'sql', query: SQL_QUERY, size: MAX_NUM_PEOPLE)

  # Check for successful response
  if response['status'] == 200
    # Store matches
  	employee_matches = response['data']
  else
  	employee_matches = {}
  	puts "Person Search Error for [#{SKILL}]: #{response}"
  end

  puts "Found #{employee_matches.length()} employee profiles for #{SKILL}."
end
```

```go Go (Elasticsearch)
package main

import (
    "fmt"
    "encoding/json"
    "reflect"
    "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)
    
    // Set the maximum number of people to search
    const maxNumPeople = 100
    
    // The skill you want to enrich
    skill := "ai"
    
    var skills []string
    
    // Create a parameters JSON object
    queryString := pdlmodel.SkillBaseParams{Skill: skill}
    
    params := pdlmodel.SkillParams{
        SkillBaseParams: queryString,
    }
    
    // Pass the parameters object to the Skill API
    response, err := client.Skill(context.Background(), params)
    
    var enrichedSkill map[string][]string

    // Check for successful response
    if err == nil {
        // Convert the API response to JSON
        jsonResponse, jsonErr := json.Marshal(response.Data)
        if jsonErr == nil {
            // Store enriched skill
            json.Unmarshal(jsonResponse, &enrichedSkill)
            // Build list of skills
            skills = enrichedSkill["similar_skills"]
            skills = append(skills, skill)
        }
    } else {
        fmt.Printf("Skill Enrichment Error for [%s]:\n\t", skill)
        fmt.Println(err)
   	}
    
    // Person Search matches
    var employeeMatches []pdlmodel.Person

    // Check for enriched job title
    if !reflect.DeepEqual(enrichedSkill, pdlmodel.SkillResponse{}) {
        // Create an Elasticsearch query
        elasticSearchQuery := map[string]interface{} {
            "query": map[string]interface{} {
                "bool": map[string]interface{} {
                    "must": []map[string]interface{} {
                        {"term": map[string]interface{}{"location_region": "utah"}},
                        {"terms": map[string]interface{}{"skills": skills}},
                   },
                },
            },
        }
    
        // Create a parameters JSON object
        params := pdlmodel.SearchParams {
            BaseParams: pdlmodel.BaseParams {
                Size: maxNumPeople,
            },
            SearchBaseParams: pdlmodel.SearchBaseParams {
                Query: elasticSearchQuery,
            },
        }

        // Pass the parameters object to the Person Search API
        response, err := client.Person.Search(context.Background(), params)

        // Check for successful response
        if err == nil {
            // Store matches
            employeeMatches = response.Data
            fmt.Printf("Found %d employee profiles for %s.\n", len(employeeMatches), skill)
        } else {
            fmt.Printf("Person Search Error for [%s]:\n\t", skill)
            fmt.Println(err)
        }
    }
}
```

```go Go (SQL)
package main

import (
    "fmt"
    "encoding/json"
    "strings"
    "reflect"
    "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)
    
    // Set the maximum number of people to search
    const maxNumPeople = 100
    
    // The skill you want to enrich
    skill := "ai"
    
    var skills []string
    
    // Create a parameters JSON object
    queryString := pdlmodel.SkillBaseParams{Skill: skill}
    
    params := pdlmodel.SkillParams{
        SkillBaseParams: queryString,
    }
    
    // Pass the parameters object to the Skill API
    response, err := client.Skill(context.Background(), params)
    
    var enrichedSkill map[string][]string
    var skillsStringRep string

    // Check for successful response
    if err == nil {
        // Convert the API response to JSON
        jsonResponse, jsonErr := json.Marshal(response.Data)
        if jsonErr == nil {
            // Store enriched skill
            json.Unmarshal(jsonResponse, &enrichedSkill)
            // Build list of skills
            skills = enrichedSkill["similar_skills"]
            skills = append(skills, skill)
            skillsStringRep = "'" + strings.Join(skills[:], "','") + "'"
        }
    } else {
        fmt.Printf("Skill Enrichment Error for [%s]:\n\t", skill)
        fmt.Println(err)
   	}
    
    // Person Search matches
    var employeeMatches []pdlmodel.Person

    // Check for enriched job title
    if !reflect.DeepEqual(enrichedSkill, pdlmodel.SkillResponse{}) {
        // Create an SQL query
        sqlQuery := "SELECT * FROM person" +
                    " WHERE location_region='utah'" +
                    " AND skills IN (" + skillsStringRep + ");"
   
        // Create a parameters JSON object
        params := pdlmodel.SearchParams {
            BaseParams: pdlmodel.BaseParams {
                Size: maxNumPeople,
            },
            SearchBaseParams: pdlmodel.SearchBaseParams {
                SQL: sqlQuery,
            },
        }

        // Pass the parameters object to the Person Search API
        response, err := client.Person.Search(context.Background(), params)

        // Check for successful response
        if err == nil {
            // Store matches
            employeeMatches = response.Data
            fmt.Printf("Found %d employee profiles for %s.\n", len(employeeMatches), skill)
        } else {
            fmt.Printf("Person Search Error for [%s]:\n\t", skill)
            fmt.Println(err)
        }
    }
}
```

```python Python3 (Elasticsearch)
import requests, json

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

# Set the Skill Enrichment API URL
PDL_SKILL_ENRICH_URL = "https://api.peopledatalabs.com/v5/skill/enrich"
# Set the Person Search API URL
PDL_PERSON_SEARCH_URL = "https://api.peopledatalabs.com/v5/person/search"

# Set the maximum number of people to search
MAX_NUM_PEOPLE = 100

# The skill you want to enrich
SKILL = "ai"
# Create a parameters JSON object
QUERY_STRING = {"skill": SKILL}

# Set headers
HEADERS = {
  'accept': "application/json",
  'content-type': "application/json",
  'x-api-key': API_KEY
}

# Pass the parameters object to the Skill Enrichment API
response = requests.request("GET", PDL_SKILL_ENRICH_URL, 
                            headers=HEADERS, params=QUERY_STRING)

# Check for successful response
if response.status_code == 200:
  # Store enriched skill
  enriched_skill = response.json()
  # Build list of skills
  skills = enriched_skill["data"]["similar_skills"]
  skills.insert(0, SKILL)
else:
  enriched_job_title = {}
  print(f"Skill Enrichment Error for [{SKILL}]: {response.text}")
                                                      
# Person Search matches
employee_matches = {}

# Check for enriched skill
if enriched_skill:
  # Create an Elasticsearch query
  ES_QUERY = {
  	"query": {
    	"bool": {
        	"must": [
            	{"term": {"location_region": "utah"}},
            	{"terms": {"skills": skills}},
      		]
    	}
  	}
  }

  # Create a parameters JSON object
  PARAMS = {
  	'query': json.dumps(ES_QUERY),
  	'size': MAX_NUM_PEOPLE
  }

  # Pass the parameters object to the Person Search API
  response = requests.get(PDL_PERSON_SEARCH_URL, headers=HEADERS, params=PARAMS)

  # Check for successful response
  if response.status_code == 200:
    # Store matches
  	employee_matches = response.json()["data"]
  else:
  	employee_matches = {}
  	print(f"Person Search Error for [{SKILL}]: {response.text}")

  print(f"Found {len(employee_matches)} employee profiles for {SKILL}.")
```

```python Python3 (SQL)
import requests, json

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

# Set the Skill Enrichment API URL
PDL_SKILL_ENRICH_URL = "https://api.peopledatalabs.com/v5/skill/enrich"
# Set the Person Search API URL
PDL_PERSON_SEARCH_URL = "https://api.peopledatalabs.com/v5/person/search"

# Set the maximum number of people to search
MAX_NUM_PEOPLE = 100

# The skill you want to enrich
SKILL = "ai"
# Create a parameters JSON object
QUERY_STRING = {"skill": SKILL}

# Set headers
HEADERS = {
  'accept': "application/json",
  'content-type': "application/json",
  'x-api-key': API_KEY
}

# Pass the parameters object to the Skill Enrichment API
response = requests.request("GET", PDL_SKILL_ENRICH_URL, 
                            headers=HEADERS, params=QUERY_STRING)

# Check for successful response
if response.status_code == 200:
  # Store enriched skill
  enriched_skill = response.json()
  # Build list of skills
  skills = enriched_skill["data"]["similar_skills"]
  skills.insert(0, SKILL)
  skills_string_rep = ", ".join(
    (f"'{skl}'" for skl in skills)
  )

else:
  enriched_job_title = {}
  print(f"Skill Enrichment Error for [{SKILL}]: {response.text}")
                                                      
# Person Search matches
employee_matches = {}

# Check for enriched skill
if enriched_skill:
  # Create an SQL query
  SQL_QUERY = f"""
  SELECT * FROM person
  WHERE location_region='utah'
  AND skills IN ({skills_string_rep});
  """
    
  # Create a parameters JSON object
  PARAMS = {
  	'sql': SQL_QUERY,
  	'size': MAX_NUM_PEOPLE
  }

  # Pass the parameters object to the Person Search API
  response = requests.get(PDL_PERSON_SEARCH_URL, headers=HEADERS, params=PARAMS)

  # Check for successful response
  if response.status_code == 200:
    # Store matches
  	employee_matches = response.json()["data"]
  else:
  	employee_matches = {}
  	print(f"Person Search Error for [{SKILL}]: {response.text}")

  print(f"Found {len(employee_matches)} employee profiles for {SKILL}.")
```