> 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-sale-order.md).

# Save a Sale Order

Creates a **sale order** in Logic ERP from your shop, website or marketplace: the customer account, the items and quantities, and optionally rates, discounts, delivery dates, billing and shipping addresses, a retail customer and an advance the customer has paid. Logic ERP gives the order its number in the **order prefix** you send, works out **GST and other taxes** for the order's tax region, fills in rates from its price list where you send none, and records any advance as a receipt against the order. The answer tells you the order number and Logic ERP's internal number of the order, which you need to cancel it later with [Cancel a Sale Order](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/orders/push/cancel-a-sale-order.md).

### **Endpoint**

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

Also accepted: `https://your-server/api/SaveSaleOrderAsync`. It takes the same request, runs the same save and gives the same answer; despite its name it does not answer early. The only difference: when request queueing is switched on for your API site, `SaveSaleOrder` queues orders branch by branch, while `SaveSaleOrderAsync` puts the orders of all branches in one queue.

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

Send one order per request. Field names are matched without regard to upper/lower case. Fields not listed below are ignored. Do not send `null` for `ListItems`, `AdvanceEntry`, `LogicUser_Code` or `AddlItemCode`: send `""` (or `[]`, `{}`) or leave the field out. Otherwise the request fails with a technical error.

### **Two save routines**

Logic ERP has two routines that can save this endpoint. A setting of your API site decides which one runs. Your Logic ERP support team can tell you which one your site uses.

* **The standard routine** is used unless your site is switched to the newer one. Everything on this page up to the section *If your API site uses the newer save routine* describes it.
* **The newer routine** fills in Logic ERP's sale order screen for you, so the screen's own checks and defaults apply. The fields are the same, but several behave differently. See the section at the end.

The site settings delivered with the API switch this endpoint to the newer routine, so do not assume the standard one – ask.

You can usually tell them apart by a failed answer: the standard routine starts `Message` with `Warning Message :` (unless technical detail is switched on, see `DisplayError`), the newer routine gives the reason without it.

### **Request fields**

| Field                                                                                                                                                                                             | Type       | Required                         | Default        | Meaning                                                                                                                                                                                                                                                                                                                           |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | -------------------------------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Branch_Code`                                                                                                                                                                                     | number     | **Yes** (or `Branch_Short_Name`) | `0`            | The branch taking the order (`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)). Order numbers run per branch. With `0` and no short name the order is saved without a real branch. A negative number is refused. |
| `Branch_Short_Name`                                                                                                                                                                               | text       | No                               | empty          | The branch by its short name. Used only when `Branch_Code` is `0`.                                                                                                                                                                                                                                                                |
| `Order_Prefix`                                                                                                                                                                                    | text       | **Yes**                          | –              | The order prefix, for example `"WEB"`. The order is numbered `WEB-1`, `WEB-2` … within the branch. Any text is accepted; only the first 15 characters are kept.                                                                                                                                                                   |
| `Order_Date`                                                                                                                                                                                      | date       | No                               | today          | The order date, `yyyy-MM-dd`. It also decides the financial year.                                                                                                                                                                                                                                                                 |
| `Party_User_Code`                                                                                                                                                                                 | text       | **Yes**                          | –              | The **customer account**: its user code in Logic ERP, as 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 supplier account is also accepted.                                                                              |
| `Party_Order_No`                                                                                                                                                                                  | text       | Depends on the configuration     | empty          | Your own order number (up to 100 characters). Stored on the order and returned as `Order_No`. When the sale order configuration demands it, it is required and must not already be used for the same customer in the branch (see the rules).                                                                                      |
| `Party_Order_Date`                                                                                                                                                                                | date       | No                               | –              | The date of your order.                                                                                                                                                                                                                                                                                                           |
| `External_Order_ID`                                                                                                                                                                               | text       | No                               | empty          | Another reference of yours, stored on the order.                                                                                                                                                                                                                                                                                  |
| `Remarks`                                                                                                                                                                                         | text       | No                               | empty          | Remarks for the order.                                                                                                                                                                                                                                                                                                            |
| `Tax_Region`                                                                                                                                                                                      | text       | No                               | the customer's | The tax region by its exact name in Logic ERP, for example `"Local"`. See the rules for how the tax region is chosen.                                                                                                                                                                                                             |
| `Payment_Method`                                                                                                                                                                                  | text       | No                               | empty          | `"COD"` (exactly, in capitals) marks the order as cash on delivery. Any other value – also `"cod"` – or none marks it as not cash on delivery.                                                                                                                                                                                    |
| `Delivery_Date`                                                                                                                                                                                   | date       | No                               | –              | The delivery date of the order. Also used as the "deliver not before" date, and as the delivery date of each line that has none.                                                                                                                                                                                                  |
| `Delivery_Time`                                                                                                                                                                                   | text       | No                               | –              | The delivery time, for example `"16:30"`. Used only together with a valid `Delivery_Date`.                                                                                                                                                                                                                                        |
| `Exfactory_Date`                                                                                                                                                                                  | date       | No                               | –              | The ex-factory date of each line that has none.                                                                                                                                                                                                                                                                                   |
| `Agent_Name`                                                                                                                                                                                      | text       | No                               | empty          | The agent, by the exact agent name in Logic ERP. `"(NIL)"` or empty = no agent. **The customer's default agent is not used**: leave it out and the order has no agent.                                                                                                                                                            |
| `Company_Name`                                                                                                                                                                                    | text       | No                               | empty          | A company (brand) by its exact name in Logic ERP. `"(NIL)"` = none.                                                                                                                                                                                                                                                               |
| `Transport_Name`                                                                                                                                                                                  | text       | No                               | empty          | The transporter by its exact name in Logic ERP. `"(NIL)"` = none.                                                                                                                                                                                                                                                                 |
| `Order_Type`                                                                                                                                                                                      | text       | No                               | empty          | An order type set up in Logic ERP, by its exact name. `"(NIL)"` = none.                                                                                                                                                                                                                                                           |
| `Indirect_Customer_User_Code`                                                                                                                                                                     | text       | No                               | empty          | The user code of an indirect customer (a customer or supplier account, or an account marked as also a customer).                                                                                                                                                                                                                  |
| `Indirect_Order_No`, `Indirect_Order_Date`                                                                                                                                                        | text, date | No                               | –              | The indirect customer's order number and date.                                                                                                                                                                                                                                                                                    |
| `Branch_Order_Date`                                                                                                                                                                               | date       | No                               | –              | Stored on the order.                                                                                                                                                                                                                                                                                                              |
| `Doc_Through`                                                                                                                                                                                     | text       | No                               | empty          | Stored on the order. `"B2B"` makes the order a business order: `RCU_GST_No` is then required (see the rules).                                                                                                                                                                                                                     |
| `Delv_Vessel_Fight_No`                                                                                                                                                                            | text       | No                               | empty          | Vessel or flight number of the delivery.                                                                                                                                                                                                                                                                                          |
| `Total_Other_Val_1` … `Total_Other_Val_7`                                                                                                                                                         | number     | No                               | `0`            | The order's other values 1 to 7, as set up in the sale order configuration (for example freight).                                                                                                                                                                                                                                 |
| `RCU_Mem_Prefix`, `RCU_Mem_Number`, `RCU_Mobile_No`, `RCU_Email`, `RCU_First_Name`, `RCU_Last_Name`, `RCU_City`, `RCU_State`, `RCU_Country`, `RCU_PinCode`, `RCU_GST_No`                          | text       | No                               | empty          | The **retail customer** (end customer) of the order: membership series and number, mobile, e-mail, name, city, state, country, PIN code and GST number. See *Retail customer* in the rules.                                                                                                                                       |
| `Billing_Address1`, `Billing_Address2`, `Billing_City`, `Billing_State`, `Billing_Country`, `Billing_PinCode`, `Billing_MobileNo`, `Billing_EmailID`, `Billing_ContactPerson`, `Billing_Location` | text       | No                               | empty          | The billing address of the order. See *Addresses* in the rules.                                                                                                                                                                                                                                                                   |
| `Shipping_Address1` … `Shipping_Location`                                                                                                                                                         | text       | No                               | empty          | The shipping address, with the same fields as the billing address.                                                                                                                                                                                                                                                                |
| `Billing_FirstName`, `Billing_MiddleName`, `Billing_LastName`, `Shipping_FirstName`, `Shipping_MiddleName`, `Shipping_LastName`                                                                   | text       | No                               | empty          | Not stored. Filling one of them only makes Logic ERP save an address. Put the name in `…_ContactPerson`.                                                                                                                                                                                                                          |
| `AdvanceEntry`                                                                                                                                                                                    | object     | No                               | –              | An advance the customer has paid. See the table below.                                                                                                                                                                                                                                                                            |
| `ListItems`                                                                                                                                                                                       | list       | **Yes**                          | –              | The order lines. See the table below.                                                                                                                                                                                                                                                                                             |
| `DisplayError`                                                                                                                                                                                    | text       | No                               | `"0"`          | `"1"` = when the save fails, `Message` carries the full technical detail instead of the short reason. When your API site keeps a request log, you get the technical detail even without it.                                                                                                                                       |
| `ValidateOnly`, `ActEntryPartyUserCode`                                                                                                                                                           | –          | –                                | –              | Ignored.                                                                                                                                                                                                                                                                                                                          |

### **Request fields – ListItems**

| Field                             | Type   | Required                      | Default     | Meaning                                                                                                                                                                               |
| --------------------------------- | ------ | ----------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `LogicUser_Code`                  | text   | **Yes** (or `AddlItemCode`)   | empty       | The item's code in Logic ERP, as in [Get Item Master](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/masters/pull/get-item-master.md). |
| `AddlItemCode`                    | text   | **Yes** (or `LogicUser_Code`) | empty       | The item's additional code (for example its EAN barcode). Used when `LogicUser_Code` is empty or not found.                                                                           |
| `Order_Qty`                       | number | **Yes**                       | –           | Quantity ordered. Must be above `0`.                                                                                                                                                  |
| `Rate`                            | number | No                            | price list  | Rate per unit in ₹. `0` or left out = the rate Logic ERP takes from the price list or item rates set in the sale order configuration.                                                 |
| `Mrp`                             | number | No                            | item's MRP  | The MRP. Used only when above `0`; otherwise the MRP of the item in Logic ERP.                                                                                                        |
| `CD_P`                            | number | No                            | `0`         | Cash discount %.                                                                                                                                                                      |
| `TD_P`                            | number | No                            | `0`         | Trade discount %.                                                                                                                                                                     |
| `SPCD_P`                          | number | No                            | `0`         | Special discount %.                                                                                                                                                                   |
| `CD_Rs`                           | number | No                            | `0`         | Cash discount amount in ₹ for the line.                                                                                                                                               |
| `Scheme_Item`                     | number | No                            | `0`         | Scheme amount in ₹ for the line.                                                                                                                                                      |
| `Adjust_Item`                     | number | No                            | `0`         | Adjustment amount in ₹ for the line.                                                                                                                                                  |
| `Tax_Amount`                      | number | No                            | `0`         | Despite its name, a **tax rate in %**. Used only when Logic ERP finds no tax for the item in the order's tax region; otherwise Logic ERP's own tax rate is used.                      |
| `Remarks`                         | text   | No                            | empty       | Remarks for the line.                                                                                                                                                                 |
| `User_Column_1` … `User_Column_5` | text   | No                            | empty       | Your own values for the line (up to 50 characters each). `User_Column_2` can later be used to cancel this line.                                                                       |
| `Item_Order_ID`                   | text   | No                            | empty       | Your own ID of the line (up to 50 characters). Use it to cancel the line later.                                                                                                       |
| `Exfactory_Date`, `Delivery_Date` | date   | No                            | the order's | The line's ex-factory and delivery dates.                                                                                                                                             |
| `Lot_Number`                      | text   | No                            | empty       | A lot number stored on the line (up to 25 characters).                                                                                                                                |

`ItemDetCode` is not accepted in the request.

### **Request fields – AdvanceEntry**

| Field              | Type   | Required | Default | Meaning                                                |
| ------------------ | ------ | -------- | ------- | ------------------------------------------------------ |
| `CashAmount`       | number | No       | `0`     | Advance received in cash, in ₹.                        |
| `CreditCardAmount` | number | No       | `0`     | Advance received by card, in ₹.                        |
| `CreditCardNo`     | text   | No       | –       | The card number or reference for the card advance.     |
| `ChequeAmount`     | number | No       | `0`     | Advance received by cheque, in ₹.                      |
| `ChequeNo`         | text   | No       | –       | Cheque number.                                         |
| `ChequeDate`       | date   | No       | –       | Cheque date, `yyyy-MM-dd`.                             |
| `CreditNoteAmount` | number | No       | `0`     | Amount adjusted from the customer's credit note, in ₹. |

### **Rules Logic ERP applies**

**Before anything is saved**

* Your API site must have a **default sale order configuration** chosen in its API settings; it decides numbering checks, rates, discounts, taxes and advances. Without it, every request fails with *Default Sale Order Configuration Not Selected!!*.
* The customer is found by `Party_User_Code` among **customer and supplier accounts**. Lookups by name (`Agent_Name`, `Company_Name`, `Transport_Name`, `Order_Type`, `Tax_Region`) need the exact name as stored in Logic ERP.
* Each line's item is looked up by `LogicUser_Code`; if that is empty or not found, by `AddlItemCode`; with only `AddlItemCode`, also among the item's extra barcodes. An item that is not found stops the whole request.
* The order date may not be later than today, unless your API user is allowed post-dated sale orders. It may not be in a period that is locked for entry, or on or before the lock date for changes.
* All of the following happen together, or none of them: a failure part-way undoes the order, its addresses, the retail customer and the advance entries.

**Numbering and the answer**

* The order number is the prefix, a hyphen and the next free number for that prefix in the branch, for example `WEB-205`. It is returned in `LastSavedDocNo`.
* Your API site can be set to skip lines whose `LogicUser_Code` is `"-1"`. When no line is left, the request fails with *No Item Found...*.

**Your order number**

* When the sale order configuration requires a party order number, `Party_Order_No` must be filled, and an order of the **same customer in the same branch** with the same `Party_Order_No` must not exist (cancelled orders included). A repeated order is refused with *Party Order No. already exists for same Customer.Please Check*, `ErrorCode` `"210008"` and **`LastSavedCode` set to the internal number of the order that already exists**, so a retry after a time-out can find its first order.
* When the configuration does not require it, the same `Party_Order_No` can be saved again.

**Rates, discounts and taxes**

* Lines with `Rate` `0` get the rate from the price list or item rates chosen in the sale order configuration.
* The **tax region** is `Tax_Region` when sent. Otherwise it is the region linked to the customer for this branch, else the customer's own region, else the default region of the sale order configuration. Taxes are worked out item by item for that region.
* When the configuration says so, a line whose rate is equal to or above its MRP is refused with *Rate cannot be equal or greater than MRP Of Item : …*.
* Discounts, other values and totals are worked out the way the sale order configuration defines.
* A `Tax_Region` name that does not exist in Logic ERP is refused with *Invalid Tax Region : …* and nothing is saved. Send the exact name, or leave the field out.

**Retail customer**

* When any `RCU_…` field other than `RCU_GST_No` is filled, the order is linked to a retail customer. You must then send `RCU_Mobile_No`, `RCU_First_Name` and a membership series (`RCU_Mem_Prefix`, unless your API site sets a fixed series, which then replaces yours). When Logic ERP identifies customers by e-mail, `RCU_Email` is also required.
* With `RCU_Mem_Number` above `0`, the customer is looked up by series and number; otherwise by mobile number. When not found, a **new retail customer is created** from the `RCU_…` fields and `Billing_Address1` / `Billing_Address2`; names and places are stored in capitals.
* `RCU_State` may be the state's name or short name; when it matches a state in Logic ERP, the country is taken from that state.
* With `"Doc_Through": "B2B"`, `RCU_GST_No` is required, and the retail customer is also given a customer account in Logic ERP (created when it has none), which becomes the order's indirect customer.

**Addresses**

* Billing and shipping addresses are **not used when the customer account is GST-registered**; the order is then saved without a separate billing or shipping address.
* An address is saved only when at least one of its fields is filled. Empty parts are filled in: address and mobile `"."`, PIN code `"."`, city `"(NIL)"`.
* When the state matches a state in Logic ERP (by name or short name), the country is taken from that state. A state that is not found needs a country, or the request fails with *Billing address Country name can not be blank...* (or *Shipping …*); the state, and the country if it is new, are then **added to Logic ERP's masters**. A state that already exists under another country is refused.
* An address with no state is saved with state `"NIL"` and country `"IN"`. Send the state.

**Advance**

* A cash, card or cheque amount above `0` is recorded as a **receipt against the order** (cash receipt, or bank receipt for card and cheque), using the receipt set-ups linked to the sale order configuration, in the order's financial year.
* `CreditNoteAmount` is adjusted through a journal entry; the sale order configuration must have a credit note account and a journal set-up, or the request fails with *Default Credit Note A/c not specified... Please Check.* or *JV Configuration not linked for Credit Note... Please Check.*

**After the save**

* When Logic ERP's approval rules require it, the order is saved **awaiting approval**.
* The save runs as the Logic ERP user linked to your API site, so that user's rights and locks apply, and the order is recorded in the audit trail.
* When this endpoint is switched off for your API site, the answer is `Status: true` with `LastSavedCode` `0` and *Warning Message : Request cannot be processed. API Template is marked as In-Active in the configuration.* (or technical text containing it). Nothing was saved. The switch applies to your whole API site, not per branch.

### **Example request**

```json
{
  "Branch_Code": 2,
  "Order_Prefix": "WEB",
  "Order_Date": "2026-10-28",
  "Party_User_Code": "CU0145",
  "Party_Order_No": "SHOP-100482",
  "Party_Order_Date": "2026-10-28",
  "Remarks": "Deliver after 4 pm",
  "Payment_Method": "COD",
  "Delivery_Date": "2026-10-31",
  "RCU_Mem_Prefix": "WEB",
  "RCU_Mobile_No": "9800000123",
  "RCU_First_Name": "Ananya",
  "RCU_Last_Name": "Rao",
  "RCU_City": "Pune",
  "RCU_State": "Maharashtra",
  "RCU_PinCode": "411001",
  "Shipping_Address1": "Flat 12, Lotus Residency",
  "Shipping_Address2": "FC Road",
  "Shipping_City": "Pune",
  "Shipping_State": "Maharashtra",
  "Shipping_PinCode": "411004",
  "Shipping_MobileNo": "9800000123",
  "Shipping_ContactPerson": "Ananya Rao",
  "AdvanceEntry": {
    "CashAmount": 500.0
  },
  "ListItems": [
    {
      "LogicUser_Code": "KUR-BLU-M",
      "Order_Qty": 2,
      "Rate": 899.0,
      "Item_Order_ID": "SHOP-100482-1"
    },
    {
      "AddlItemCode": "8901234567895",
      "Order_Qty": 1,
      "Rate": 0,
      "Item_Order_ID": "SHOP-100482-2"
    }
  ]
}
```

### **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. Each send creates one more test sale order for the sandbox's test customer `APITESTC01`; change `Party_Order_No` each time, because a repeated party order number is refused.

## Save a Sale Order

> Creates a sale order in Logic ERP from your shop, website or marketplace: the customer account, the items and quantities, and optionally rates, discounts, delivery dates, billing and shipping addresses, a retail customer and an advance the customer has paid. Logic ERP gives the order its number in the order prefix you send, works out GST and other taxes for the order's tax region, fills in rates from its price list where you send none, and records any advance as a receipt against the order. The answer tells you the order number and Logic ERP's internal number of the order, which you need to cancel it later with Cancel a Sale Order.

```json
{"openapi":"3.0.3","info":{"title":"Logic ERP API","version":"1.0"},"tags":[{"name":"Orders - 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":{"/SaveSaleOrder":{"post":{"tags":["Orders - Push"],"operationId":"SaveSaleOrder","summary":"Save a Sale Order","description":"Creates a sale order in Logic ERP from your shop, website or marketplace: the customer account, the items and quantities, and optionally rates, discounts, delivery dates, billing and shipping addresses, a retail customer and an advance the customer has paid. Logic ERP gives the order its number in the order prefix you send, works out GST and other taxes for the order's tax region, fills in rates from its price list where you send none, and records any advance as a receipt against the order. The answer tells you the order number and Logic ERP's internal number of the order, which you need to cancel it later with Cancel a Sale Order.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"Branch_Code":{"type":"integer","description":"The branch taking the order (`Branch_Code` in Get Branch Info). Order numbers run per branch. With `0` and no short name the order is saved without a real branch. A negative number is refused."},"Order_Prefix":{"type":"string","description":"The order prefix, for example `\"WEB\"`. The order is numbered `WEB-1`, `WEB-2` … within the branch. Any text is accepted; only the first 15 characters are kept."},"Order_Date":{"type":"string","description":"The order date, `yyyy-MM-dd`. It also decides the financial year."},"Party_User_Code":{"type":"string","description":"The customer account: its user code in Logic ERP, as in Get Party Master. A supplier account is also accepted."},"Party_Order_No":{"type":"string","description":"Your own order number (up to 100 characters). Stored on the order and returned as `Order_No`. When the sale order configuration demands it, it is required and must not already be used for the same customer in the branch (see the rules)."},"Party_Order_Date":{"type":"string","description":"The date of your order."},"Remarks":{"type":"string","description":"Remarks for the order."},"RCU_Mem_Prefix":{"type":"string","description":"The retail customer (end customer) of the order: membership series and number, mobile, e-mail, name, city, state, country, PIN code and GST number. See Retail customer in the rules."},"RCU_Mobile_No":{"type":"string","description":"The retail customer (end customer) of the order: membership series and number, mobile, e-mail, name, city, state, country, PIN code and GST number. See Retail customer in the rules."},"RCU_First_Name":{"type":"string","description":"The retail customer (end customer) of the order: membership series and number, mobile, e-mail, name, city, state, country, PIN code and GST number. See Retail customer in the rules."},"RCU_Last_Name":{"type":"string","description":"The retail customer (end customer) of the order: membership series and number, mobile, e-mail, name, city, state, country, PIN code and GST number. See Retail customer in the rules."},"ListItems":{"type":"array","items":{"type":"object","properties":{"LogicUser_Code":{"type":"string","description":"The item's code in Logic ERP, as in Get Item Master."},"Order_Qty":{"type":"integer","description":"Quantity ordered. Must be above `0`."},"Rate":{"type":"integer","description":"Rate per unit in ₹. `0` or left out = the rate Logic ERP takes from the price list or item rates set in the sale order configuration."},"Item_Order_ID":{"type":"string","description":"Your own ID of the line (up to 50 characters). Use it to cancel the line later."}}},"description":"The order lines. See the table below."}}}}}},"responses":{"200":{"description":"Always HTTP 200. Check Status and Message.","content":{"application/json":{"schema":{"type":"object","properties":{"LastSavedDocNo":{"type":"string","description":"The order number, for example `\"WEB-205\"`. `null` when the save failed."},"Order_No":{"type":"string","description":"Your `Party_Order_No`, returned as sent – not Logic ERP's order number. `null` when the save failed."},"ErrorCode":{"type":"string","description":"A code for some failures: `\"210001\"` customer not found, `\"210002\"` indirect customer not found, `\"210003\"` agent, `\"210004\"` company, `\"210005\"` transporter, `\"210006\"` order type not found, `\"210007\"` quantity missing, `\"210008\"` party order number already used, `\"210009\"` party order number missing, `\"10001\"` item not found. Empty or `null` otherwise."},"Status":{"type":"boolean","description":"`true` when the order was saved. Also `true` when the endpoint is switched off for your API site – then `LastSavedCode` is `0`."},"Message":{"type":"string","description":"Empty when saved. Otherwise `Warning Message : ` followed by the reason, or technical text (see `DisplayError`)."},"LastSavedCode":{"type":"integer","description":"Logic ERP's internal number of the order. Keep it to cancel the order. `0` when the save failed, except for a repeated party order number (see the rules)."},"request_ID":{"type":"string","description":"As described on the common page."}}}}}},"401":{"description":"No login was sent."}}}}}}
```

### **Response**

| Field            | Type         | Meaning                                                                                                                                                                                                                                                                                                                                                              |
| ---------------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Status`         | true / false | `true` when the order was saved. Also `true` when the endpoint is switched off for your API site – then `LastSavedCode` is `0`.                                                                                                                                                                                                                                      |
| `Message`        | text         | Empty when saved. Otherwise `Warning Message :` followed by the reason, or technical text (see `DisplayError`).                                                                                                                                                                                                                                                      |
| `LastSavedCode`  | number       | Logic ERP's internal number of the order. Keep it to cancel the order. `0` when the save failed, except for a repeated party order number (see the rules).                                                                                                                                                                                                           |
| `LastSavedDocNo` | text         | The order number, for example `"WEB-205"`. `null` when the save failed.                                                                                                                                                                                                                                                                                              |
| `Order_No`       | text         | **Your** `Party_Order_No`, returned as sent – not Logic ERP's order number. `null` when the save failed.                                                                                                                                                                                                                                                             |
| `ErrorCode`      | text         | A code for some failures: `"210001"` customer not found, `"210002"` indirect customer not found, `"210003"` agent, `"210004"` company, `"210005"` transporter, `"210006"` order type not found, `"210007"` quantity missing, `"210008"` party order number already used, `"210009"` party order number missing, `"10001"` item not found. Empty or `null` otherwise. |
| `request_ID`     | text         | As described on the common page.                                                                                                                                                                                                                                                                                                                                     |

### **Example response**

```json
{
  "LastSavedDocNo": "WEB-205",
  "Order_No": "SHOP-100482",
  "ErrorCode": "",
  "Status": true,
  "Message": "",
  "LastSavedCode": 50231,
  "request_ID": "2b7c9e14-6a0d-4f3e-9b21-7d5a0c8e4f19"
}
```

### **Messages you may see**

Every failure message of the standard routine starts with `Warning Message :` ; the table shows what follows. With `"DisplayError": "1"`, or when your API site keeps a request log, you get technical detail instead – read the first line.

| Message                                                                                                                                                                                                                     | Meaning                                                                                                                | What to do                                                               |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
| `Default Sale Order Configuration Not Selected!!`                                                                                                                                                                           | Your API site has no sale order configuration chosen.                                                                  | Ask your Logic ERP support team.                                         |
| `Invalid Sale Order Configuration Selected...`                                                                                                                                                                              | The chosen configuration no longer exists.                                                                             | Ask your Logic ERP support team.                                         |
| `Invalid Party User Code...`                                                                                                                                                                                                | No customer or supplier account has that user code.                                                                    | Check `Party_User_Code`.                                                 |
| `Sale Order Order_Prefix not Set...`                                                                                                                                                                                        | `Order_Prefix` is empty.                                                                                               | Send a prefix.                                                           |
| `Invalid Indirect Customer User Code Selected...`, `Invalid Agent Name...`, `Invalid Company Name...`, `Invalid Transport Name...`, `Invalid Order Type`                                                                    | The name or code is not in Logic ERP.                                                                                  | Send the exact name, or leave the field out.                             |
| `Invalid Tax Region : …`                                                                                                                                                                                                    | `Tax_Region` is not a tax region in Logic ERP. Nothing was saved.                                                      | Send the exact name, or leave the field out.                             |
| `No financial year covers the date …` (without `Warning Message :` in front, date as day/month/year)                                                                                                                        | `Order_Date` lies outside every financial year set up in Logic ERP. Nothing was saved.                                 | Send a date inside a financial year.                                     |
| `Invalid Branch Code : …. Please Check...`                                                                                                                                                                                  | `Branch_Code` is negative.                                                                                             | Send a branch from Get Branch Info.                                      |
| `LogicUserCode Or EAN Code Cannot Blank!!`                                                                                                                                                                                  | A line has neither item code.                                                                                          | Fill `LogicUser_Code` or `AddlItemCode`.                                 |
| `Invalid LogicUserCode / EANCode : …`                                                                                                                                                                                       | An item was not found.                                                                                                 | Check the item codes.                                                    |
| `Quantity cannot be blank. Logic User Code : …`                                                                                                                                                                             | A line has `Order_Qty` `0` or less.                                                                                    | Send the quantity.                                                       |
| `No Item Found...`                                                                                                                                                                                                          | No line is left to save.                                                                                               | Send at least one line.                                                  |
| `Party Order No. Cannot be blank.Please Check`                                                                                                                                                                              | The configuration requires `Party_Order_No`.                                                                           | Send it.                                                                 |
| `Party Order No. already exists for same Customer.Please Check`                                                                                                                                                             | This customer already has an order with that number in the branch. `LastSavedCode` holds that order's internal number. | Do not send the order again.                                             |
| `Post Dated enteries are not allowed.......`                                                                                                                                                                                | `Order_Date` is later than today.                                                                                      | Send today's date or earlier.                                            |
| `Entry/Modification is locked for this period....`, `Modification rights not available for this date.....`                                                                                                                  | The order date is in a locked period, or on or before the lock date.                                                   | Ask your Logic ERP team.                                                 |
| `Cannot Allow Entry W/O RCU_GST_No. for B2B Order.`                                                                                                                                                                         | `Doc_Through` is `"B2B"` and `RCU_GST_No` is empty.                                                                    | Send the GST number.                                                     |
| `Mobile Number cannot be blank...`, `EMail id cannot be blank...`, `Please Define Mobile No. to Continue...`, `Please Define Customer Membership Series to Continue...`, `Customer First Name not defined...Please Check..` | A retail customer field is filled but the customer is incomplete.                                                      | Complete the `RCU_…` fields, or send none of them.                       |
| `Rate cannot be equal or greater than MRP Of Item : …`                                                                                                                                                                      | The configuration does not allow a rate at or above MRP.                                                               | Check the rate and MRP.                                                  |
| `Billing address Country name can not be blank...`, `Shipping address Country name can not be blank...`                                                                                                                     | The state was not found in Logic ERP and no country was sent.                                                          | Send a known state, or the country.                                      |
| `… already exist against country name-…`                                                                                                                                                                                    | The state you sent belongs to another country in Logic ERP.                                                            | Correct the state or country.                                            |
| `Default Credit Note A/c not specified... Please Check.`, `JV Configuration not linked for Credit Note... Please Check.`                                                                                                    | `CreditNoteAmount` was sent but the configuration is not set up for it.                                                | Ask your Logic ERP team, or leave the amount out.                        |
| `The operation was canceled.`                                                                                                                                                                                               | A step of the save was stopped without a reason. Nothing was saved.                                                    | Repeat with `"DisplayError": "1"`, or ask support with the `request_ID`. |
| `Request cannot be processed. API Template is marked as In-Active in the configuration.` (with `Status: true`)                                                                                                              | The endpoint is switched off for your API site. Nothing was saved.                                                     | Ask your Logic ERP support team.                                         |

### **If your API site uses the newer save routine**

The newer routine takes the same request and fills in Logic ERP's sale order screen with it, using the default sale order configuration of your API site. The differences are:

* **`Order_Prefix` must be sent but is not used.** The order is numbered in the prefix the screen offers for the configuration and branch. Read the real number from `LastSavedDocNo`.
* **Retail customer.** The `RCU_…` fields do not find or create a retail customer. A B2B order is not given an account for its retail customer.
* **Failure messages carry the reason** without `Warning Message :` in front; with `"DisplayError": "1"` you get the full technical detail instead. A reason raised inside the sale order screen can still be followed by technical detail – read the first line. `ErrorCode` is always empty. Some messages differ: *Invalid Party / Account...* for an unknown customer, *GST number is required for B2B orders. Please enter the customer's GST number and try again..* for B2B without `RCU_GST_No`.
* **The screen's rules apply** to items, rates and the order date. The screen's question *Want to Save order?* is answered *Yes*; any other message the screen would show stops the request with that text. Always send `Order_Date`.
* **The repeated-party-order-number check** follows the screen; `LastSavedCode` is not set to the existing order.
* When the endpoint is switched off for your API site, the answer is also `Status: true` with `LastSavedCode` `0`, and *Request cannot be processed. API Template is marked as In-Active in the configuration.* (technical text containing it with `"DisplayError": "1"`).


---

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