---
title: "Get employee details from BreatheHR  API"
description: "Technical guide on BreatheHR API to Get employee details from BreatheHR  API"
source_url: "https://www.getknit.dev/blog/get-employee-details-from-breathehr--api-RQQ4J0"
page_type: "blog"
---

_This is an educational blog post from Knit's blog: “Get employee details from BreatheHR  API”._

# Get employee details from BreatheHR API

## Introduction

This article is a part of a series of articles covering the BreatheHR API in depth, and covers the specific use case of using the BreatheHR API to Get employee details from BreatheHR API.  
You can find all the other use cases we have covered for the BreatheHR API along with a comprehensive deep dive on its various aspects like authentication, rate limits etc [here.](https://www.getknit.dev/blog/breatheHR-guide)

### Overview

The BreatheHR API allows you to retrieve detailed information about employees. This section will guide you through the process of obtaining the first name, last name, and date of joining for all employees using the BreatheHR API.

### API Endpoints

*   **Get All Employees:** `GET /v1/employees`
*   **Get Employee by ID:** `GET /v1/employees/{id}`

#### 1\. Fetch All Employees

First, you need to fetch the list of all employees using the `GET /v1/employees` endpoint.

```
import requests

url = "https://api.breathehr.com/v1/employees"
headers = {
    "Authorization": "Bearer YOUR_ACCESS_TOKEN",
}
params = {
    "page": 1,
    "per_page": 100
}

response = requests.get(url, headers=headers, params=params)
employees = response.json()
```

#### 2\. Extract Required Details

Next, extract the first name, last name, and date of joining from the response.

```
employee_details = []
for employee in employees:
    details = {
        "first_name": employee.get("first_name"),
        "last_name": employee.get("last_name"),
        "join_date": employee.get("join_date")
    }
    employee_details.append(details)

print(employee_details)
```

#### 3\. Handle Pagination (if necessary)

If there are more employees than can be returned in a single response, handle pagination by iterating through the pages.

```
employee_details = []
page = 1
while True:
    params["page"] = page
    response = requests.get(url, headers=headers, params=params)
    employees = response.json()
    if not employees:
        break
    for employee in employees:
        details = {
            "first_name": employee.get("first_name"),
            "last_name": employee.get("last_name"),
            "join_date": employee.get("join_date")
        }
        employee_details.append(details)
    page += 1

print(employee_details)
```

## Knit for BreatheHR API Integration

For quick and seamless access to [BreatheHR](https://www.getknit.dev/integration/breathe-hr) API, Knit API offers a convenient solution. By integrating with Knit just once, you can streamline the entire process. 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 [BreatheHR](https://www.getknit.dev/integration/breathe-hr) API.


## Related pages

- [How Knit works](https://md.getknit.dev/how-knit-works)
- [Unified API product](https://md.getknit.dev/products/unified-api)
