> 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.

# Add Po GRN

POST https://heimdall.eka.io/apis/external/grn/addPoGrn
Content-Type: application/json

### Add Po GRN

This API endpoint allows you to add a new Purchase Order Goods Receipt Note (GRN).

### Request body

| Param     | Required  | Type   | Description                                                   |
| --------- | --------- | ------ | ------------------------------------------------------------- |
| orderId   | Mandatory | String | The ID of the order.                                          |
| data      | Mandatory | Object | An object containing the following sub-parameters.            |
| items     | Mandatory | Array  | An array of objects containing details of the items received. |
| qtty      | Mandatory | Number | The quantity of the item received.                            |
| id        | Mandatory | Number | The ID of the item.                                           |
| productId | Mandatory | String | The ID of the product received.                               |
| files     | Optional  | Array  | An array of files related to the GRN.                         |
| grn No    | Optional  | String | GRN Number                                                    |

Example Request Body:

```json
{
    "orderId": "",
    "data": {
        "items": [
            {
                "qtty": 0,
                "id": 0,
                "productId": ""
            }
        ],
        "files": []
    }
}

```

### Response

* success (boolean): Indicates if the GRN creation was successful.
* grnId (string): The ID of the created GRN.
* message (string): A message confirming the successful creation of the GRN.

Example Response:

```json
{
    "success": true,
    "grnId": "GRN-INDIAN-00340",
    "message": "GRN created successfully"
}

```

Reference: https://open-api-docs.dice.tech/dice-standardized-ap-is-v-2-copy/grn/add-po-grn

## Servers

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

## Request

### 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

### Body (application/json)

- `orderId` (string, required)
- `data` (object, required)
  - `items` (list of object, required)
    - `qtty` (integer, required)
    - `id` (integer, required)
    - `productId` (string, required)
  - `files` (list of any, required)
- `grn_no` (string, required)

## Response

### 200

OK

- `success` (boolean, required)
- `grnId` (string, required)
- `message` (string, required)

## Examples

**Request**

```json
{
  "orderId": "PO-INDIAN-00421",
  "data": {
    "items": [
      {
        "qtty": 10,
        "id": 133292,
        "productId": "mac"
      }
    ],
    "files": []
  },
  "grn_no": ""
}
```

**Response**

```json
{
  "success": true,
  "grnId": "GRN-INDIAN-00340",
  "message": "GRN created successfully"
}
```

**SDK Code**

```python GRN_Add Po GRN_example
import requests

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

payload = {
    "orderId": "PO-INDIAN-00421",
    "data": {
        "items": [
            {
                "qtty": 10,
                "id": 133292,
                "productId": "mac"
            }
        ],
        "files": []
    },
    "grn_no": ""
}
headers = {
    "DICE-APP-ID": "{{Company Code}}",
    "X-CLIENT-ID": "{{API Client ID}}",
    "X-CLIENT-SECRET": "{{API Client Secret}}",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript GRN_Add Po GRN_example
const url = 'https://heimdall.eka.io/apis/external/grn/addPoGrn';
const options = {
  method: 'POST',
  headers: {
    'DICE-APP-ID': '{{Company Code}}',
    'X-CLIENT-ID': '{{API Client ID}}',
    'X-CLIENT-SECRET': '{{API Client Secret}}',
    'Content-Type': 'application/json'
  },
  body: '{"orderId":"PO-INDIAN-00421","data":{"items":[{"qtty":10,"id":133292,"productId":"mac"}],"files":[]},"grn_no":""}'
};

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

```go GRN_Add Po GRN_example
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"orderId\": \"PO-INDIAN-00421\",\n  \"data\": {\n    \"items\": [\n      {\n        \"qtty\": 10,\n        \"id\": 133292,\n        \"productId\": \"mac\"\n      }\n    ],\n    \"files\": []\n  },\n  \"grn_no\": \"\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	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}}")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

```ruby GRN_Add Po GRN_example
require 'uri'
require 'net/http'

url = URI("https://heimdall.eka.io/apis/external/grn/addPoGrn")

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

request = Net::HTTP::Post.new(url)
request["DICE-APP-ID"] = '{{Company Code}}'
request["X-CLIENT-ID"] = '{{API Client ID}}'
request["X-CLIENT-SECRET"] = '{{API Client Secret}}'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"orderId\": \"PO-INDIAN-00421\",\n  \"data\": {\n    \"items\": [\n      {\n        \"qtty\": 10,\n        \"id\": 133292,\n        \"productId\": \"mac\"\n      }\n    ],\n    \"files\": []\n  },\n  \"grn_no\": \"\"\n}"

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

```java GRN_Add Po GRN_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://heimdall.eka.io/apis/external/grn/addPoGrn")
  .header("DICE-APP-ID", "{{Company Code}}")
  .header("X-CLIENT-ID", "{{API Client ID}}")
  .header("X-CLIENT-SECRET", "{{API Client Secret}}")
  .header("Content-Type", "application/json")
  .body("{\n  \"orderId\": \"PO-INDIAN-00421\",\n  \"data\": {\n    \"items\": [\n      {\n        \"qtty\": 10,\n        \"id\": 133292,\n        \"productId\": \"mac\"\n      }\n    ],\n    \"files\": []\n  },\n  \"grn_no\": \"\"\n}")
  .asString();
```

```php GRN_Add Po GRN_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://heimdall.eka.io/apis/external/grn/addPoGrn', [
  'body' => '{
  "orderId": "PO-INDIAN-00421",
  "data": {
    "items": [
      {
        "qtty": 10,
        "id": 133292,
        "productId": "mac"
      }
    ],
    "files": []
  },
  "grn_no": ""
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'DICE-APP-ID' => '{{Company Code}}',
    'X-CLIENT-ID' => '{{API Client ID}}',
    'X-CLIENT-SECRET' => '{{API Client Secret}}',
  ],
]);

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

```csharp GRN_Add Po GRN_example
using RestSharp;

var client = new RestClient("https://heimdall.eka.io/apis/external/grn/addPoGrn");
var request = new RestRequest(Method.POST);
request.AddHeader("DICE-APP-ID", "{{Company Code}}");
request.AddHeader("X-CLIENT-ID", "{{API Client ID}}");
request.AddHeader("X-CLIENT-SECRET", "{{API Client Secret}}");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"orderId\": \"PO-INDIAN-00421\",\n  \"data\": {\n    \"items\": [\n      {\n        \"qtty\": 10,\n        \"id\": 133292,\n        \"productId\": \"mac\"\n      }\n    ],\n    \"files\": []\n  },\n  \"grn_no\": \"\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift GRN_Add Po GRN_example
import Foundation

let headers = [
  "DICE-APP-ID": "{{Company Code}}",
  "X-CLIENT-ID": "{{API Client ID}}",
  "X-CLIENT-SECRET": "{{API Client Secret}}",
  "Content-Type": "application/json"
]
let parameters = [
  "orderId": "PO-INDIAN-00421",
  "data": [
    "items": [
      [
        "qtty": 10,
        "id": 133292,
        "productId": "mac"
      ]
    ],
    "files": []
  ],
  "grn_no": ""
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://heimdall.eka.io/apis/external/grn/addPoGrn")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```