Introduction
This article is a part of a series of articles covering the Ashby API in depth, and covers the specific use case of using the Ashby API to Get candidate data from Ashby API.
You can find all the other use cases we have covered for the Ashby API along with a comprehensive deep dive on its various aspects like authentication, rate limits etc here.
Get Candidate Data from Ashby API
Introduction
To retrieve candidate data using the Ashby API, you can utilize the candidate.info
endpoint. This endpoint allows you to fetch detailed information about a candidate by their unique ID or an external mapping ID. Below is a step-by-step guide on how to use this API with Python code snippets.
Step-by-Step Guide
Step 1: Set Up Your Environment
Ensure you have Python installed along with the requests
library. You can install the library using pip:
pip install requests
Step 2: Fetch Candidate Data
Use the following Python code to make a POST request to the candidate.info
endpoint:
import requests
import json
# Define the API endpoint
url = 'https://api.ashbyhq.com/candidate.info'
# Set up the headers
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
# Define the request body with the candidate ID
data = {
'id': 'f9e52a51-a075-4116-a7b8-484deba69004' # Replace with the actual candidate ID
}
# Make the POST request
response = requests.post(url, headers=headers, data=json.dumps(data))
# Check if the request was successful
if response.status_code == 200:
candidate_data = response.json()
print('Candidate Data:', candidate_data)
else:
print('Failed to retrieve candidate data:', response.status_code, response.text)
Step 3: Handle the Response
If the request is successful, the response will contain detailed information about the candidate, including their name, email addresses, phone numbers, social links, tags, and more. You can process this data as needed for your application.
Knit for Ashby API Integration
For quick and seamless access to Ashby API, Knit API offers a convenient Unified API solution. By integrating with Knit just once, you can go live with multiple ATS integrations in one go. Knit takes care of all the authentication, authorization, and ongoing integration maintenance, this approach not only saves time but also ensures a smooth and reliable connection to your Ashby API.