> For the complete documentation index, see [llms.txt](https://kb.logicerp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/purchase/push/save-gr-details-for-purchase-vouchers.md).

# Save GR Details for Purchase Vouchers

Records the **transport (GR) details** of goods received on one or more **purchase vouchers** – the transporter's consignment note (GR, also called LR – lorry receipt) under which the supplier's goods arrived. One request creates one **GR document** in Logic ERP – a numbered list of the purchase vouchers received together – and writes the transport details onto **each voucher**: transporter, GR number and date, vehicle, weight, cases, delivery place and times. This is what the **Enter G.R. Details - Purchase** screen (Purchase menu) does. The details then show on the voucher in [Get Purchase Vouchers](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/purchase/pull/get-purchase-vouchers.md) (`Gr_Number`, `Gr_Date`, `Transport_Name`, `Weight`, `Cases`).

For purchase returns use [Save GR Details for Purchase Returns](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/purchase/push/save-gr-details-for-purchase-returns.md); for sale invoices, [Save GR Details for Sale Invoices](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/sale/push/save-gr-details-for-sale-invoices.md). There is no endpoint to edit a purchase GR document.

### **Endpoint**

| Name          | Detail                                               |
| ------------- | ---------------------------------------------------- |
| Address       | `https://your-server/api/SaveGREntryAgainstPurchase` |
| Method        | `POST`                                               |
| Authorization | Basic Auth                                           |

The response and the common messages are explained in [How Every API Call Works](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/how-every-api-call-works.md).

Field names are matched without regard to upper/lower case; fields not listed below are ignored. Note the spelling `Transpoter_Name`.

### **Request fields**

| Field                                                                                                                                                                     | Type   | Required       | Default | Meaning                                                                                                                                                                                                                                     |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | -------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Doc_Prefix`                                                                                                                                                              | text   | **Yes**        | –       | Prefix of the GR document, for example `"PGR"`. Stored in capitals. The document number is the next free number for this prefix in the branch (shared with GR documents for purchase returns and purchase challans) – you cannot choose it. |
| `Doc_Date`                                                                                                                                                                | date   | No             | today   | Date of the GR document, `yyyy-MM-dd`. A value that is not a date is replaced by today's date.                                                                                                                                              |
| `Remarks`                                                                                                                                                                 | text   | No             | empty   | Remarks of the GR document.                                                                                                                                                                                                                 |
| `BranchCode`                                                                                                                                                              | number | One of the two | `0`     | The branch of the vouchers (`Branch_Code` in [Get Branch Info](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/masters/pull/get-branch-info.md)).                                             |
| `BranchShortName`                                                                                                                                                         | text   | One of the two | empty   | The branch short name, used when `BranchCode` is `0`.                                                                                                                                                                                       |
| `ListBills`                                                                                                                                                               | list   | **Yes**        | –       | The purchase vouchers received under this GR, one entry each. See the table below. Send at least one.                                                                                                                                       |
| `Ext_Doc_No`, `Doc_Remarks_1`, `Doc_Remarks_2`, `Pickup_Date`, `Pickup_Delv_Date`, `Pickup_Stage`, `Estimated_Delv_Days`, `Non_Delv_Reason`, `Non_Delv_Date`, `EditEntry` | –      | No             | –       | **Ignored.**                                                                                                                                                                                                                                |
| `DisplayError`                                                                                                                                                            | text   | No             | `"0"`   | `"1"` = `Message` carries the full technical detail when the save fails.                                                                                                                                                                    |

**`ListBills`**

| Field                                                                                                                                                                                                          | Type         | Required                                | Default                   | Meaning                                                                                                                                                                                                                                            |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | --------------------------------------- | ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `BillNo`                                                                                                                                                                                                       | text         | **Yes**, or `GRN_Prefix` + `GRN_Number` | –                         | The supplier's bill number as entered on the purchase voucher (`Bill_No` in Get Purchase Vouchers). It must match exactly one purchase voucher in the branch and the current financial year. Not used when `GRN_Prefix` and `GRN_Number` are sent. |
| `GRN_Prefix`, `GRN_Number`                                                                                                                                                                                     | text, number | No                                      | –                         | The voucher's GRN prefix and number (`GRN_Prefix`, `GRN_Number` in Get Purchase Vouchers). When both are sent, the voucher is found by them instead of `BillNo` – use them when a bill number repeats.                                             |
| `GR_Number_1`                                                                                                                                                                                                  | text         | No                                      | keeps the voucher's value | The GR / LR number given by the transporter.                                                                                                                                                                                                       |
| `GR_Date_1`                                                                                                                                                                                                    | date         | No                                      | keeps the voucher's value | Date of `GR_Number_1`, `yyyy-MM-dd`. Saved only when `GR_Number_1` is also sent.                                                                                                                                                                   |
| `Transpoter_Name`                                                                                                                                                                                              | text         | No                                      | keeps the voucher's value | Transporter, exactly as named in Logic ERP's transport list. It must exist.                                                                                                                                                                        |
| `Agent_Name`                                                                                                                                                                                                   | text         | No                                      | keeps the voucher's value | Agent (broker) of the voucher, exactly as named in Logic ERP. It must exist.                                                                                                                                                                       |
| `Vehicle_No`                                                                                                                                                                                                   | text         | No                                      | keeps the voucher's value | Vehicle number. A new value is also added to Logic ERP's list of purchase vehicle numbers.                                                                                                                                                         |
| `Transport_Mode`                                                                                                                                                                                               | text         | No                                      | keeps the voucher's value | Mode of transport, for example `"ROAD"`. A new value is also added to Logic ERP's list of purchase transport modes.                                                                                                                                |
| `Weight`, `Cases`, `Pvt_Mark`                                                                                                                                                                                  | text         | No                                      | keep the voucher's value  | Weight, number of cases or packages, and private mark.                                                                                                                                                                                             |
| `Challan_No`, `Challan_Date`                                                                                                                                                                                   | text, date   | No                                      | keep the voucher's value  | The transporter's challan number and date. The date is saved only with a number.                                                                                                                                                                   |
| `Issue_Time`, `Removal_Time`                                                                                                                                                                                   | text         | No                                      | keep the voucher's value  | Times, for example `"11:30 AM"`. A value that is not a time is refused. When the voucher has no issue time yet, the time the voucher was created is used.                                                                                          |
| `Delivery_At`, `Delivery_Add1`, `Delivery_Add2`                                                                                                                                                                | text         | No                                      | keep the voucher's value  | Delivery place and address lines.                                                                                                                                                                                                                  |
| `Doc_Remarks`                                                                                                                                                                                                  | text         | No                                      | empty                     | Remark for this voucher inside the GR document.                                                                                                                                                                                                    |
| `ShippingLabel`, `TrackingUrl`                                                                                                                                                                                 | text         | No                                      | –                         | **Do not send** – they are saved for sale GR entries only, and a value is refused.                                                                                                                                                                 |
| `GR_Number_2`, `GR_Date_2`, `Packing_Box_Length`, `Packing_Box_Width`, `Packing_Box_Height`, `Packing_Box_Net_Weight`, `BillSeries`, `BillNumber`, `NewBillNo`, `BillDate`, `Remarks1`, `Remarks2`, `Remarks3` | –            | No                                      | –                         | **Ignored** for purchase vouchers.                                                                                                                                                                                                                 |

### **Rules Logic ERP applies**

* **Which vouchers.** Each `BillNo` must match exactly **one** purchase voucher in the branch and the **current financial year** (the year containing today's date on the server, whatever `Doc_Date` says). Purchase challans and returns are not searched. If any voucher is not found, nothing is saved.
* **One GR per voucher.** A voucher already listed in another purchase GR document cannot be added again; nothing is saved and the message lists those vouchers by GRN prefix and number.
* **What is saved.** A GR document is created with `Doc_Prefix`, the next number, `Doc_Date`, `Remarks` and the list of vouchers. On each voucher the transport details are written. A field you leave empty keeps the value the voucher already has.
* **Agent.** The agent you send becomes the agent of the voucher and of its accounting entries.
* **Order and e-way bill.** The purchase order number is filled in from the order the voucher was made against, when the voucher has none. An e-way bill already linked to the voucher is kept. No way bill (air waybill) number is assigned.
* **All or nothing.** The GR document and all voucher updates are saved together; if one voucher fails, nothing is saved.
* Each voucher gets an audit-trail entry.

### **Example request**

```json
{
  "Doc_Prefix": "PGR",
  "Doc_Date": "2026-10-28",
  "Remarks": "Received from Surat",
  "BranchCode": 2,
  "ListBills": [
    {
      "BillNo": "SR-4471",
      "GR_Number_1": "SRT77120",
      "GR_Date_1": "2026-10-26",
      "Transpoter_Name": "SHREE GANESH ROADLINES",
      "Agent_Name": "AMIT KUMAR",
      "Vehicle_No": "GJ05CX4410",
      "Transport_Mode": "ROAD",
      "Cases": "4",
      "Weight": "58 KG",
      "Delivery_At": "LUDHIANA"
    }
  ]
}
```

### **Test it**

Send a request to the Logic ERP **sandbox** (a test company) from this page: open the block below, enter the sandbox user name and password (ask your Logic ERP support team), change the request if you like, and press **Test it**. This really saves in the sandbox, so use test values like the example. The example's voucher already belongs to a GR document, so sending it unchanged is refused; use a voucher of your own.

## Save GR Details for Purchase Vouchers

> Records the transport (GR) details of goods received on one or more purchase vouchers – the transporter's consignment note (GR, also called LR – lorry receipt) under which the supplier's goods arrived. One request creates one GR document in Logic ERP – a numbered list of the purchase vouchers received together – and writes the transport details onto each voucher: transporter, GR number and date, vehicle, weight, cases, delivery place and times. This is what the Enter G.R. Details - Purchase screen (Purchase menu) does. The details then show on the voucher in Get Purchase Vouchers (\`Gr\_Number\`, \`Gr\_Date\`, \`Transport\_Name\`, \`Weight\`, \`Cases\`).

```json
{"openapi":"3.0.3","info":{"title":"Logic ERP API","version":"1.0"},"tags":[{"name":"Purchase - Push"}],"servers":[{"url":"https://demo.logicerp.com/api","description":"Logic ERP sandbox (test company)"}],"security":[{"basicAuth":[]}],"components":{"securitySchemes":{"basicAuth":{"type":"http","scheme":"basic","description":"The user name and password of your API site."}}},"paths":{"/SaveGREntryAgainstPurchase":{"post":{"tags":["Purchase - Push"],"operationId":"SaveGREntryAgainstPurchase","summary":"Save GR Details for Purchase Vouchers","description":"Records the transport (GR) details of goods received on one or more purchase vouchers – the transporter's consignment note (GR, also called LR – lorry receipt) under which the supplier's goods arrived. One request creates one GR document in Logic ERP – a numbered list of the purchase vouchers received together – and writes the transport details onto each voucher: transporter, GR number and date, vehicle, weight, cases, delivery place and times. This is what the Enter G.R. Details - Purchase screen (Purchase menu) does. The details then show on the voucher in Get Purchase Vouchers (`Gr_Number`, `Gr_Date`, `Transport_Name`, `Weight`, `Cases`).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"Doc_Prefix":{"type":"string","description":"Prefix of the GR document, for example `\"PGR\"`. Stored in capitals. The document number is the next free number for this prefix in the branch (shared with GR documents for purchase returns and purchase challans) – you cannot choose it."},"Doc_Date":{"type":"string","description":"Date of the GR document, `yyyy-MM-dd`. A value that is not a date is replaced by today's date."},"Remarks":{"type":"string","description":"Remarks of the GR document."},"BranchCode":{"type":"integer","description":"The branch of the vouchers (`Branch_Code` in Get Branch Info)."},"ListBills":{"type":"array","items":{"type":"object","properties":{"BillNo":{"type":"string","description":"The supplier's bill number as entered on the purchase voucher (`Bill_No` in Get Purchase Vouchers). It must match exactly one purchase voucher in the branch and the current financial year. Not used when `GRN_Prefix` and `GRN_Number` are sent."},"GR_Number_1":{"type":"string","description":"The GR / LR number given by the transporter."},"GR_Date_1":{"type":"string","description":"Date of `GR_Number_1`, `yyyy-MM-dd`. Saved only when `GR_Number_1` is also sent."},"Transport_Mode":{"type":"string","description":"Mode of transport, for example `\"ROAD\"`. A new value is also added to Logic ERP's list of purchase transport modes."},"Cases":{"type":"string","description":"Weight, number of cases or packages, and private mark."},"Doc_Remarks":{"type":"string","description":"Remark for this voucher inside the GR document."}}},"description":"The purchase vouchers received under this GR, one entry each. See the table below. Send at least one."}}}}}},"responses":{"200":{"description":"Always HTTP 200. Check Status and Message.","content":{"application/json":{"schema":{"type":"object","properties":{"LastSavedDocNo":{"type":"string","description":"The GR document number: prefix and number joined by a hyphen, for example `\"PGR-12\"`."},"Status":{"type":"boolean","description":"`true` when the GR document was saved."},"Message":{"type":"string","description":"`\"Success\"` when saved; otherwise the reason."},"LastSavedCode":{"type":"integer","description":"Logic ERP's internal number of the GR document."},"request_ID":{"type":"string","description":"The ID of this request – quote it to support."}}}}}},"401":{"description":"No login was sent."}}}}}}
```

### **Response**

| Field            | Type         | Meaning                                                                               |
| ---------------- | ------------ | ------------------------------------------------------------------------------------- |
| `Status`         | true / false | `true` when the GR document was saved.                                                |
| `Message`        | text         | `"Success"` when saved; otherwise the reason.                                         |
| `LastSavedCode`  | number       | Logic ERP's internal number of the GR document.                                       |
| `LastSavedDocNo` | text         | The GR document number: prefix and number joined by a hyphen, for example `"PGR-12"`. |
| `request_ID`     | text         | The ID of this request – quote it to support.                                         |

### **Example response**

```json
{
  "LastSavedDocNo": "PGR-12",
  "Status": true,
  "Message": "Success",
  "LastSavedCode": 233,
  "request_ID": "5c8e1a2f-7b3d-4e60-9a14-2d6f0b8c3e71"
}
```

### **Messages you may see**

| Message                                                           | Meaning                                                                                                                                                                                           | What to do                                       |
| ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ |
| `Invalid Doc_Prefix....`                                          | `Doc_Prefix` is empty.                                                                                                                                                                            | Send a prefix.                                   |
| `Unable to Retrive Bill No.…-… BranchCode : …`                    | A voucher was not found, or `BillNo` matches several vouchers, in the branch and current financial year. The message shows the GRN prefix and number you sent (`-0` when you sent only `BillNo`). | Check the bill number and branch.                |
| `Invalid Issue_Time : …`, `Invalid Removal_Time : …`              | The value sent is not a time.                                                                                                                                                                     | Send a time such as `11:30 AM`, or leave it out. |
| `Unable to found Transpoter Name : …`                             | No transporter with that name.                                                                                                                                                                    | Use the name exactly as in Logic ERP.            |
| `Unable to found Agent : …`                                       | No agent with that name.                                                                                                                                                                          | Use the name exactly as in Logic ERP.            |
| `… Bills belongs to another Document. Cannot Retrived...`         | The listed vouchers (GRN prefix and number) are already in another purchase GR document.                                                                                                          | Leave them out.                                  |
| `ShippingLabel / TrackingUrl are saved only for sale GR entries.` | `ShippingLabel` or `TrackingUrl` was sent.                                                                                                                                                        | Leave both out.                                  |
| `An item with the same key has already been added.`               | The same voucher appears twice in `ListBills`.                                                                                                                                                    | List each voucher once.                          |
| A message containing `Branch_Short_Name : … not exists.`          | `BranchShortName` does not exist.                                                                                                                                                                 | Check the short name.                            |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/purchase/push/save-gr-details-for-purchase-vouchers.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
