> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://open-api-docs.dice.tech/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://open-api-docs.dice.tech/_mcp/server.

# Fetch GRNs API

GET https://heimdall.eka.io/apis/external/grn/getGrns

### Fetch GRNs API

This API is to get all GRNs existing in Dice.

| **Params**  | **Required** | **Description**                                                                                                                                                           |
| ----------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| start\_date | Mandatory    | Date filter, from which date the GRNs needs to be fetched.    Format - **dd-MM-yyyy**                                                                                     |
| end\_date   | Mandatory    | Date filter, till which date the GRNs need to be fetched.    Format - **dd-MM-yyyy**                                                                                      |
| offset      | Mandatory    | Page Number                                                                                                                                                               |
| pageSize    | Optional     | Number of vendor to be fetched in a single page. Value cannot be greater than 5000.    If not provided along with the request then default value will be 1000 considered. |

Reference: https://open-api-docs.dice.tech/dice-standardized-ap-is-v-2-copy/grn/fetch-gr-ns-api

## Servers

- `https://heimdall.eka.io` (https://heimdall.eka.io, default)
- `https://heimdall.eka.ioapis` (https://heimdall.eka.ioapis)

## Request

### Query parameters

- `offset` (integer, optional) — Offset starts from 0 (Page Number), values can be 0, 1, 2
- `pageSize` (integer, optional) — optinal parameter, default is 1000
- `start_date` (string, optional) — Date should be in dd-MM-yyyy format and it runs on CreatedAt
- `end_date` (string, optional) — Date should be in dd-MM-yyyy format and it runs on CreatedAt

### Headers

- `DICE-APP-ID` (string, optional) — Company Code of client
- `X-CLIENT-ID` (string, optional) — API Client ID
- `X-CLIENT-SECRET` (string, optional) — API Client Secret

## Response

### 200

OK

- `grns` (list of object, required)
  - `id` (integer, required)
  - `grnId` (string, required)
  - `invoiceId` (string, required)
  - `invoiceAmount` (integer, required)
  - `currency` (string, required)
  - `partial` (boolean, required)
  - `date` (integer, required)
  - `amend` (boolean, required)
  - `grn` (boolean, required)
  - `documents` (list of any, required)
  - `values` (list of any, required)
  - `items` (list of object, required)
    - `id` (integer, required)
    - `productId` (integer, required)
    - `qtty` (integer, required)
    - `productName` (string, required)
    - `rejectedQty` (integer, required)
    - `address` (string, required)
- `total` (integer, required)
- `currentPage` (integer, required)
- `totalPages` (integer, required)

## Examples

**Response**

```json
{
  "grns": [
    {
      "id": 7703,
      "grnId": "GRN-INDIAN-00059",
      "invoiceId": "VI-INDIAN-000000402",
      "invoiceAmount": 13200,
      "currency": "INR",
      "partial": true,
      "date": 1685618806694,
      "amend": false,
      "grn": false,
      "documents": [],
      "values": [],
      "items": [
        {
          "id": 89658,
          "productId": 37468,
          "qtty": 2,
          "productName": "Macbook",
          "rejectedQty": 0,
          "address": "Mumbai"
        },
        {
          "id": 89659,
          "productId": 37470,
          "qtty": 2,
          "productName": "Keyboard",
          "rejectedQty": 0,
          "address": "Mumbai"
        },
        {
          "id": 89660,
          "productId": 37469,
          "qtty": 3,
          "productName": "Mouse",
          "rejectedQty": 0,
          "address": "Mumbai"
        }
      ]
    },
    {
      "id": 7704,
      "grnId": "GRN-INDIAN-00060",
      "invoiceId": "VI-INDIAN-000000404",
      "invoiceAmount": 1,
      "currency": "INR",
      "partial": true,
      "date": 1685618957158,
      "amend": false,
      "grn": false,
      "documents": [],
      "values": [],
      "items": [
        {
          "id": 89656,
          "productId": 29286,
          "qtty": 3,
          "productName": "testt",
          "rejectedQty": 0,
          "address": "Dice Original Office"
        },
        {
          "id": 89657,
          "productId": 37221,
          "qtty": 3,
          "productName": "test009",
          "rejectedQty": 0,
          "address": "Dice Original Office"
        }
      ]
    },
    {
      "id": 8064,
      "grnId": "GRN-INDIAN-00061",
      "invoiceId": "VI-INDIAN-000000405",
      "invoiceAmount": 4520,
      "currency": "INR",
      "partial": false,
      "date": 1686127711965,
      "amend": false,
      "grn": false,
      "documents": [],
      "values": [],
      "items": [
        {
          "id": 90021,
          "productId": 37468,
          "qtty": 5000,
          "productName": "Macbook",
          "rejectedQty": 0,
          "address": "Bangalore"
        }
      ]
    },
    {
      "id": 8068,
      "grnId": "GRN-INDIAN-00062",
      "invoiceId": "VI-INDIAN-000000392",
      "invoiceAmount": 1,
      "currency": "INR",
      "partial": false,
      "date": 1686128934089,
      "amend": false,
      "grn": false,
      "documents": [],
      "values": [],
      "items": [
        {
          "id": 87018,
          "productId": 37221,
          "qtty": 49,
          "productName": "test009",
          "rejectedQty": 0,
          "address": "Mumbai"
        }
      ]
    }
  ],
  "total": 5,
  "currentPage": 1,
  "totalPages": 1
}
```

**SDK Code**

```python GRN_Fetch GRNs API_example
import requests

url = "https://heimdall.eka.io/apis/external/grn/getGrns"

querystring = {"end_date":"13-06-2023","offset":"0","pageSize":"1000","start_date":"01-06-2023"}

headers = {
    "DICE-APP-ID": "{{Company Code}}",
    "X-CLIENT-ID": "{{API Client ID}}",
    "X-CLIENT-SECRET": "{{API Client Secret}}"
}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```javascript GRN_Fetch GRNs API_example
const url = 'https://heimdall.eka.io/apis/external/grn/getGrns?end_date=13-06-2023&offset=0&pageSize=1000&start_date=01-06-2023';
const options = {
  method: 'GET',
  headers: {
    'DICE-APP-ID': '{{Company Code}}',
    'X-CLIENT-ID': '{{API Client ID}}',
    'X-CLIENT-SECRET': '{{API Client Secret}}'
  }
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go GRN_Fetch GRNs API_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://heimdall.eka.io/apis/external/grn/getGrns?end_date=13-06-2023&offset=0&pageSize=1000&start_date=01-06-2023"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("DICE-APP-ID", "{{Company Code}}")
	req.Header.Add("X-CLIENT-ID", "{{API Client ID}}")
	req.Header.Add("X-CLIENT-SECRET", "{{API Client Secret}}")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby GRN_Fetch GRNs API_example
require 'uri'
require 'net/http'

url = URI("https://heimdall.eka.io/apis/external/grn/getGrns?end_date=13-06-2023&offset=0&pageSize=1000&start_date=01-06-2023")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["DICE-APP-ID"] = '{{Company Code}}'
request["X-CLIENT-ID"] = '{{API Client ID}}'
request["X-CLIENT-SECRET"] = '{{API Client Secret}}'

response = http.request(request)
puts response.read_body
```

```java GRN_Fetch GRNs API_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://heimdall.eka.io/apis/external/grn/getGrns?end_date=13-06-2023&offset=0&pageSize=1000&start_date=01-06-2023")
  .header("DICE-APP-ID", "{{Company Code}}")
  .header("X-CLIENT-ID", "{{API Client ID}}")
  .header("X-CLIENT-SECRET", "{{API Client Secret}}")
  .asString();
```

```php GRN_Fetch GRNs API_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://heimdall.eka.io/apis/external/grn/getGrns?end_date=13-06-2023&offset=0&pageSize=1000&start_date=01-06-2023', [
  'headers' => [
    'DICE-APP-ID' => '{{Company Code}}',
    'X-CLIENT-ID' => '{{API Client ID}}',
    'X-CLIENT-SECRET' => '{{API Client Secret}}',
  ],
]);

echo $response->getBody();
```

```csharp GRN_Fetch GRNs API_example
using RestSharp;

var client = new RestClient("https://heimdall.eka.io/apis/external/grn/getGrns?end_date=13-06-2023&offset=0&pageSize=1000&start_date=01-06-2023");
var request = new RestRequest(Method.GET);
request.AddHeader("DICE-APP-ID", "{{Company Code}}");
request.AddHeader("X-CLIENT-ID", "{{API Client ID}}");
request.AddHeader("X-CLIENT-SECRET", "{{API Client Secret}}");
IRestResponse response = client.Execute(request);
```

```swift GRN_Fetch GRNs API_example
import Foundation

let headers = [
  "DICE-APP-ID": "{{Company Code}}",
  "X-CLIENT-ID": "{{API Client ID}}",
  "X-CLIENT-SECRET": "{{API Client Secret}}"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://heimdall.eka.io/apis/external/grn/getGrns?end_date=13-06-2023&offset=0&pageSize=1000&start_date=01-06-2023")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```