---
title: "Developer guide to get employee leave information from GreytHR"
url: "http://35.223.47.52/blog/developer-guide-to-get-employee-leave-information-from-greythr/"
date: "2026-08-13T12:59:05+00:00"
modified: "2026-08-23T10:24:08+00:00"
type: "post"
---

# Developer guide to get employee leave information from GreytHR

[Blog](http://35.223.47.52/blog) / [Tutorials](http://35.223.47.52/blogs/tutorials/) / Developer guide to get employee leave information from GreytHR [Tutorials](http://35.223.47.52/blogs/tutorials/) · August 13, 2026 

Developer guide to get employee leave information from GreytHR
==============================================================

 ![](https://storage.googleapis.com/knit-website-media/2026/08/64c34ca1e0546a9d333bb35a_Kunal-3-150x150.png)Kunal Mishra

3 min read

 

 

 [](https://www.linkedin.com/sharing/share-offsite/?url=http%3A%2F%2F35.223.47.52%2Fblog%2Fdeveloper-guide-to-get-employee-leave-information-from-greythr%2F) [](https://twitter.com/intent/tweet?url=http%3A%2F%2F35.223.47.52%2Fblog%2Fdeveloper-guide-to-get-employee-leave-information-from-greythr%2F&text=Developer%20guide%20to%20get%20employee%20leave%20information%20from%20GreytHR)  

 

 

 

  Table of Contents - [Introduction](#)
- [Get Employee Leave Information from GreytHR API](#)
- [Prerequisites](#)
- [API Endpoints](#)
- [Step-by-Step Guide](#)
- [Common Pitfalls](#)
- [Frequently Asked Questions](#)
- [Knit for GreytHR API Integration](#)
 
  Introduction
------------

This article is a part of a series of articles covering the GreytHR API in depth, and covers the specific use case of using the GreytHR API to get employee leave information.

You can find all the other use cases we have covered for the GreytHR API along with a comprehensive deep dive on its various aspects like authentication, rate limits etc [here](/blog/greythr-api-directory-9rnbmr/).

Get Employee Leave Information from GreytHR API
-----------------------------------------------

### Prerequisites

- Access to GreytHR API with valid credentials.
- API access token.
- Company domain registered with GreytHR.

### API Endpoints

- Get Employee Leave Balance for a Year:
    `https://api.greythr.com/leave/v2/employee/{employee-id}/years/{{Year}}/balance`
- Get Leave Balance Details for All Employees:
    `https://api.greythr.com/leave/v2/employee/years/{{Year}}/balance`
- Get Leave Transactions Details for All Employees:
    `https://api.greythr.com/leave/v2/employee/transactions?start={{StartDate}}&end={{EndDate}}`

### Step-by-Step Guide

#### Step 1: Set Up Headers

```
headers = {
    "ACCESS-TOKEN": "YourAccessToken",
    "x-greythr-domain": "Yourcompany.greythr.com"
}
```

#### Step 2: Get Employee Leave Balance for a Year

```
import requests

employee_id = "11"
year = "2020"

url = f"https://api.greythr.com/leave/v2/employee/{employee_id}/years/{year}/balance"

response = requests.get(url, headers=headers)
leave_balance = response.json()

print(leave_balance)
```

#### Step 3: Get Leave Balance Details for All Employees

```
import requests

year = "2021"

url = f"https://api.greythr.com/leave/v2/employee/years/{year}/balance"

response = requests.get(url, headers=headers)
all_leave_balances = response.json()

print(all_leave_balances)
```

#### Step 4: Get Leave Transactions Details for All Employees

```
import requests

start_date = "2020-06-01"
end_date = "2020-06-30"

url = f"https://api.greythr.com/leave/v2/employee/transactions?start={start_date}&end={end_date}"

response = requests.get(url, headers=headers)
leave_transactions = response.json()

print(leave_transactions)
```

### Common Pitfalls

- Incorrect API endpoint URLs.
- Invalid or expired access tokens.
- Wrong company domain in headers.
- Missing required request parameters.
- Handling large datasets without implementing pagination.

### Frequently Asked Questions

**1. What does the access token look like?**
The access token is a unique string provided by GreytHR during authentication. Always keep it secure and refresh it as required.

**2. How should I handle pagination in large responses?**
GreytHR includes pagination details in responses. Use these parameters to iterate through pages and fetch the complete dataset without missing records.

**3. Can I filter leave transactions by leave type?**
The API doesn’t currently allow filtering by leave type at the endpoint level. You’ll need to fetch all transactions and then filter them client-side.

**4. What should I check if I get a 401 Unauthorized error?**
This usually indicates an invalid or expired token. Recheck your token, regenerate if needed, and ensure your request headers are correctly set.

**5. Are there limits on how many requests I can make?**
Yes. GreytHR enforces rate limits on API usage. Refer to their documentation or contact support to confirm the exact limits for your plan.

Knit for GreytHR API Integration
--------------------------------

For quick and seamless access to [GreytHR API](/integration/greythr/), 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 [GreytHR API.](/integration/greythr/)

‍

---

**Ready to build this integration?**
Explore Knit’s [GreytHR integration](/integration/greythr/) or read more about our [Unified HRIS API](/integration-categories/unified-hris-api/).

 

 ![](https://storage.googleapis.com/knit-website-media/2026/08/64c34ca1e0546a9d333bb35a_Kunal-3-150x150.png)Written by Kunal Mishra

Changing integration landscape, one organization at a time‍

 

 

 

 

 

   Keep Reading
------------

  ![](https://storage.googleapis.com/knit-website-media/2026/08/blog-banner-yellow-scaled-640x400.png) [API Directory](http://35.223.47.52/blogs/api-directory/) 

### [greytHR API Guide](http://35.223.47.52/blog/greythr-api-guide/)

All you need to know about integrating with greythr API.

 August 13, 2026 · 10 min read 

 

   ![](https://storage.googleapis.com/knit-website-media/2026/08/blog-banner-green-640x400.png) [API Directory](http://35.223.47.52/blogs/api-directory/) 

### [Greythr API Directory](http://35.223.47.52/blog/greythr-api-directory-9rnbmr/)

Learn about the common Greythr API data models and API end points in this comprehensive Greythr API directory

 August 13, 2026 · 9 min read 

 

   ![](https://storage.googleapis.com/knit-website-media/2026/08/blog-banner-yellow-scaled-640x400.png) [Tutorials](http://35.223.47.52/blogs/tutorials/) 

### [Developer guide to get employee data from GreytHR API](http://35.223.47.52/blog/developer-guide-to-get-employee-data-from-greythr-api/)

Get employee data from GreytHR API. Python examples, FAQs, and how Knit automates authentication for smooth, scalable HR integrations.

 August 13, 2026 · 3 min read 

 

  

 

  \#1 in Ease of Integrations
---------------------------

![4.9 out of 5 stars](/wp-content/themes/knit/assets/images/g2/g2-star-rating.svg)

4.9 out of 5 stars on G2

![G2 Leader, Spring 2026](/wp-content/themes/knit/assets/images/g2/g2-leader.svg)![G2 Fastest Implementation, Spring 2026](/wp-content/themes/knit/assets/images/g2/g2-fastest-implementation.svg)![G2 High Performer, Spring 2026](/wp-content/themes/knit/assets/images/g2/g2-high-performer.svg)![G2 Best Est. ROI, Spring 2026](/wp-content/themes/knit/assets/images/g2/g2-best-roi.svg)

 

  Put Integrations on Autopilot. Talk to Experts.
-----------------------------------------------

Knit is loved by customers across the globe due to our seamless product and white glove support. You'll love us too!

 [Talk to a Human](/book-demo)
