Introduction
This article is part of an in-depth series on the Breathe HR API and focuses on a specific, high-utility use case: fetching employee leave data. Leave data is a core HR signal and is often required for payroll processing, workforce analytics, compliance reporting, and downstream integrations with finance or planning systems.
If you are looking for a broader understanding of the Breathe HR API, including authentication, rate limits, and other supported use cases, you can refer to the comprehensive guide linked earlier in this series. This post stays focused on leave data retrieval and how to do it correctly and reliably.
Prerequisites
Before you begin, ensure the following are in place:
- Active access to the Breathe HR API with a valid API key
- A Python environment with required libraries installed (such as
requests) - Basic familiarity with making authenticated HTTP requests
API Endpoints
Get Leave Data for All Employees
Use the following endpoint to retrieve leave requests across all employees:
GET https://api.breathehr.com/v1/leave_requests
Optional query parameters:
start_date: Returns leave requests starting on or after the specified dateend_date: Returns leave requests starting on or before the specified dateexclude_cancelled_requests: Excludes cancelled leave requests from the responsepage: Specifies the page of results to fetchper_page: Controls the number of records returned per page
Get Leave Data for a Specific Employee
To retrieve leave data for a single employee, use:
GET https://api.breathehr.com/v1/employees/{id}/leave_requests
Replace {id} with the employee’s unique identifier.
Optional query parameter:
exclude_cancelled_requests: Excludes cancelled leave requests
Python Code Snippets
Retrieve Leave Data for All Employees
import requests
api_key = 'YOUR_API_KEY'
headers = {'Authorization': f'Bearer {api_key}'}
response = requests.get(
'https://api.breathehr.com/v1/leave_requests',
headers=headers
)
leave_data = response.json()
print(leave_data)
Retrieve Leave Data for a Specific Employee
import requests
employee_id = 'EMPLOYEE_ID'
api_key = 'YOUR_API_KEY'
headers = {'Authorization': f'Bearer {api_key}'}
response = requests.get(
f'https://api.breathehr.com/v1/employees/{employee_id}/leave_requests',
headers=headers
)
leave_data = response.json()
print(leave_data)
Common Pitfalls
- Sending requests over HTTP instead of HTTPS, which can result in rejected or insecure calls
- Missing or incorrectly formatted API keys in the request headers
- Ignoring API rate limits, leading to throttling or temporary access blocks
- Failing to implement pagination when working with large volumes of leave records
- Not validating or handling error responses returned by the API
- Using invalid or outdated employee IDs in employee-specific requests
- Forgetting to explicitly exclude cancelled leave requests when required for reporting or payroll logic
Frequently Asked Questions
- How do I obtain an API key?
API keys are issued by Breathe HR. Contact their support team to request access. - What are the API rate limits?
Rate limits are defined by Breathe HR and can vary. Refer to their official API documentation for the latest limits. - Can leave requests be filtered by department?
Yes, department-level filtering is supported using thedepartment_idquery parameter where applicable. - How should pagination be handled?
Use thepageandper_pageparameters to iterate through large result sets in a controlled manner. - What response format does the API return?
All responses are returned in JSON format. - Is it possible to exclude cancelled leave requests?
Yes, setexclude_cancelled_requeststo avoid receiving cancelled records. - Is a sandbox or test environment available?
Availability of a sandbox environment depends on your Breathe HR plan. Confirm this directly with their support team.
Knit for Breathe HR API Integration
If your goal is to minimize integration effort and long-term maintenance, Knit provides a streamlined alternative. By integrating with Knit once, you gain consistent access to the Breathe HR API without managing authentication flows, token refreshes, or ongoing API changes yourself.
This approach reduces engineering overhead, improves reliability, and allows teams to focus on using leave data rather than maintaining the integration layer.
.png)


.png)
.webp)
.png)
