> 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/orders/push/save-a-delivery-note-against-a-purchase-order.md).

# Save a Delivery Note Against a Purchase Order

Records a supplier's **delivery note** – the goods a supplier is sending against one or more **purchase orders** that are already in Logic ERP – so that the goods can later be received and billed against that delivery note. You send the supplier, the delivery note's own details and, per purchase order, the items and quantities being delivered.

> **Known issue – the licence check can refuse every request.** Unless your Logic ERP licence includes this endpoint, every request is refused before it reaches the code that saves delivery notes: the answer is `"Status": false`, `Message` holds only a short internal code instead of a reason, `request_ID` is empty and nothing is saved. In that case create delivery notes in Logic ERP. To receive goods against a purchase order through the API, use [Save a Purchase Voucher Against a Purchase Order](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/orders/push/save-a-purchase-voucher-against-a-purchase-order.md). The rest of this page describes what the endpoint does once the licence check lets it through.

To read delivery notes, use [Get Delivery Notes](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/orders/pull/get-delivery-notes.md).

### **Endpoint**

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

The address is spelt `Againts` – send it exactly like this.

The response envelope, branches, dates, queueing 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).

### **Request fields**

Field names are not case-sensitive.

| Field                                                    | Type               | Meaning                                                                                                                                                                                                                                                                    |
| -------------------------------------------------------- | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `PartyUserCode`                                          | text               | **Required.** The supplier, by the party code shown in Logic ERP (`User_Code` in [Get Party Master](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/masters/pull/get-party-master.md)). A code that is not found is refused. |
| `Supplier_Code`                                          | number             | Not used – the supplier is taken from `PartyUserCode`. Leave it out.                                                                                                                                                                                                       |
| `Branch_Code`                                            | number             | The branch, as explained in How Every API Call Works. The delivery note is saved in it, and orders sent by `PO_Prefix` / `PO_Number` are looked for in it.                                                                                                                 |
| `BranchShortName`                                        | text               | The branch's short name, used when `Branch_Code` is `0`.                                                                                                                                                                                                                   |
| `DNO_PreFix`                                             | text               | Prefix of the delivery note number. Left out: `APIDN`.                                                                                                                                                                                                                     |
| `DNO_Number`                                             | number             | The delivery note number. `0` = the next number for the prefix and branch.                                                                                                                                                                                                 |
| `DNO_Date`                                               | date               | The delivery note date, `yyyy-MM-dd`. Left out, or not a date: today.                                                                                                                                                                                                      |
| `Delivery_Date`                                          | date               | The expected delivery date, `yyyy-MM-dd`. Left out, or not a date: today.                                                                                                                                                                                                  |
| `Invoice_No`, `Invoice_Date`                             | text, date         | The supplier's invoice number and date. A date left out, or not a date: today.                                                                                                                                                                                             |
| `Challan_No`, `Challan_Date`, `Challan_Value`            | text, date, number | The supplier's challan number, date and value.                                                                                                                                                                                                                             |
| `Discount_Amt`                                           | number             | Discount amount.                                                                                                                                                                                                                                                           |
| `Payment_Amount`, `Payment_Due_Date`, `Payment_Due_Days` | number, date, text | Payment amount, due date and due days.                                                                                                                                                                                                                                     |
| `Prod_Req_Date`                                          | date               | Production requirement date, `yyyy-MM-dd`. Left out, or not a date: today.                                                                                                                                                                                                 |
| `Remarks_1` to `Remarks_5`                               | text               | Remarks 1 to 5.                                                                                                                                                                                                                                                            |
| `ListPO`                                                 | list               | One entry per purchase order the goods are delivered against – see below.                                                                                                                                                                                                  |
| `DisplayError`                                           | text               | `"1"` = when the request fails, `Message` holds the full technical detail. Use only while testing.                                                                                                                                                                         |

**`ListPO` – one entry per purchase order**

| Field                    | Type         | Meaning                                                                                                                                                                                                                                                                                                              |
| ------------------------ | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `PO_DocCode`             | number       | Logic ERP's internal number of the purchase order (`Vouch_Code` in [Get Purchase Orders](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/orders/pull/get-purchase-orders.md)). The order must be of the supplier `PartyUserCode` and must not be waiting for approval. |
| `PO_Prefix`, `PO_Number` | text, number | The order's prefix and number, used to find the order in the branch when `PO_DocCode` is `0`.                                                                                                                                                                                                                        |
| `ListPOItem`             | list         | The items delivered – see below.                                                                                                                                                                                                                                                                                     |

`PartyOrderNo` and `Po_Order_Date` are not read.

**`ListPOItem` – one entry per item delivered**

| Field           | Type   | Meaning                                                                                                                                                                                                                          |
| --------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `LogicUserCode` | text   | The item code shown in Logic ERP (`UserCode` in [Get Item Master](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/masters/pull/get-item-master.md)). Spaces around it are removed. |
| `EANCode`       | text   | The item's additional code (barcode). Used when `LogicUserCode` is empty or not found; with `LogicUserCode` empty, another code of the item is also accepted. One of `LogicUserCode` and `EANCode` is required.                  |
| `Quantity`      | number | The quantity delivered.                                                                                                                                                                                                          |
| `LotNumber`     | text   | Optional. When sent, only order lines with this lot number are used for the item.                                                                                                                                                |

`UserCode` and `ItemCode` are not read: a line that sends only them is refused with `LogicUserCode Or EAN Code Cannot Blank!!`.

### **Rules Logic ERP applies**

* **Supplier.** Without `PartyUserCode` the request is refused with `Please Define Party User Codes to Continue...`; a code that is not found is refused with `Invalid Party Name ...`. `Supplier_Code` is not used.
* **Orders.** Each `ListPO` entry is found by `PO_DocCode`, or by `PO_Prefix` and `PO_Number` in the branch. An order sent by prefix and number that is not found is refused with `Purchase Order … not found...`; an order of another supplier – and a `PO_DocCode` that does not exist – with `Purchase Order … does not belong to party …...`; and an order still waiting for approval with `Purchase Order … is pending for approval. Cannot create Delivery Note...`.
* **Items.** An item code that is not found is refused with `Invalid LogicUserCode / EANCode : …`.
* **Quantities.** Each item's `Quantity` is spread over the order's lines of that item (of that lot, when `LotNumber` is sent) that still have a quantity pending for delivery notes, each line taking at most what is pending on it. An order listed twice shares what is pending between its entries. A quantity that is more than is pending – or an item that is not on the order – is refused with `Item Code : … : quantity … is not pending on Purchase Order …...`.
* **No configuration needed.** No delivery-note configuration has to be set up for this endpoint.
* **All or nothing.** Every order and item is checked before anything is saved; if one is refused, nothing is saved.

### **Example request**

```json
{
  "PartyUserCode": "S0412",
  "Branch_Code": 2,
  "DNO_PreFix": "DN",
  "DNO_Number": 0,
  "DNO_Date": "2026-10-30",
  "Delivery_Date": "2026-11-02",
  "Invoice_No": "INV/26-27/3108",
  "Invoice_Date": "2026-10-30",
  "Remarks_1": "Dispatched by road",
  "ListPO": [
    {
      "PO_DocCode": 1186,
      "ListPOItem": [
        { "LogicUserCode": "KRT3301", "Quantity": 24 },
        { "LogicUserCode": "JNS4410", "Quantity": 10 }
      ]
    }
  ]
}
```

### **Response**

| Field            | Type         | Meaning                                                                                         |
| ---------------- | ------------ | ----------------------------------------------------------------------------------------------- |
| `Status`         | true / false | `true` when the delivery note was saved.                                                        |
| `Message`        | text         | `Success` when saved; otherwise the reason.                                                     |
| `LastSavedCode`  | number       | Logic ERP's internal number of the new delivery note; `0` when not saved.                       |
| `LastSavedDocNo` | text         | The delivery note's prefix and number, for example `DN-58`.                                     |
| `request_ID`     | text         | The ID of this request – quote it to support. Empty when the licence check refuses the request. |

### **Example response**

```json
{
  "LastSavedDocNo": "DN-58",
  "Status": true,
  "Message": "Success",
  "LastSavedCode": 110,
  "request_ID": "5a2d8c41-7e3b-4f90-b6a1-0c9e4d2f7b18"
}
```


---

# 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/orders/push/save-a-delivery-note-against-a-purchase-order.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.
