---
title: "Developer guide to get employee leave information from GreytHR"
url: "https://getknit.dev/blog/developer-guide-to-get-employee-leave-information-from-greythr/"
date: "2025-09-24T12:18:46+00:00"
modified: "2026-02-02T11:34:50+00:00"
type: "post"
---

# Developer guide to get employee leave information from GreytHR

[Blog](https://getknit.dev/blog) / [Tutorials](https://getknit.dev/blogs/tutorials/) / Developer guide to get employee leave information from GreytHR [Tutorials](https://getknit.dev/blogs/tutorials/) · September 24, 2025 · Updated February 2, 2026 

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

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

3 min read

 

 

 [](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fgetknit.dev%2Fblog%2Fdeveloper-guide-to-get-employee-leave-information-from-greythr%2F) [](https://twitter.com/intent/tweet?url=https%3A%2F%2Fgetknit.dev%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/)

‍

Building a GreytHR integration?

Knit gives you two ways to build it. Pick the one that fits.

- [GreytHR on Unified API](https://getknit.dev/integration/greythr/)
    
    Your customers want GreytHR and the other HRIS tools they use. Build one integration and get normalised read and write data with real-time webhooks.
    
    [Try free](https://dashboard.getknit.dev/signup)
- [GreytHR MCP server](https://getknit.dev/mcp-servers/greythr-mcp-server/)
    
    Your AI agent needs to read and act in your customers' GreytHR. Use a pre-built, hosted MCP server instead of writing integration code.
    
    [Try free](https://mcphub.getknit.dev/)

Knit's Unified API connects to 190+ apps across HRIS, ATS, CRM, accounting and more.

Knit never stores your end users' data and is SOC 2, GDPR and ISO 27001 compliant: [How Knit handles security](/security/) · [Security Center](https://compliance.getknit.dev/)

Not sure which fits? [Talk to a human](/book-demo/)

 

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

Changing integration landscape, one organization at a time‍

 

 

 

 

 

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

  ![Developer guide to get employee data from GreytHR API](https://storage.googleapis.com/knit-website-media/2026/08/blog-banner-yellow-scaled-640x400.png) [Tutorials](https://getknit.dev/blogs/tutorials/) 

### [Developer guide to get employee data from GreytHR API](https://getknit.dev/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.

 September 24, 2025 · 3 min read 

 

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

### [Greythr API Directory](https://getknit.dev/blog/greythr-api-directory-9rnbmr/)

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

 November 26, 2024 · 9 min read 

 

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

### [greytHR API Guide](https://getknit.dev/blog/greythr-api-guide/)

All you need to know about integrating with greythr API.

 February 26, 2024 · 10 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)
