Save a Purchase Order
Creates a new purchase order in Logic ERP – an order you place on a supplier for goods you want to buy. You send the supplier, the order prefix and the items with their quantities and rates; Logic ERP gives the order the next number for that prefix, works out discounts, taxes and totals with the purchase-order series chosen for your API site, and saves it as pending so that delivery notes and purchase vouchers can later be made against it.
To create a purchase indent (an internal request to buy) instead, use Save a Purchase Indent – it takes the same request. To read purchase orders back, use Get Purchase Orders.
Endpoint
Address
https://your-server/api/SavePurchaseOrder
Method
POST
Authorization
Basic Auth
The response envelope, branches, dates, queueing and the common messages are explained in How Every API Call Works.
Request fields
Field names are not case-sensitive. Names and codes are matched as you send them – spaces in front of them are not removed (only Tax_Region is trimmed). Capital and small letters do not matter.
Branch_Code
number
Yes, in practice
-1
The branch the order is saved in (Branch_Code in Get Branch Info). See the known issue below.
Party_User_code
text
Yes
empty
The supplier, by the party code shown in Logic ERP (User_Code in Get Party Master). A supplier or customer account is accepted.
Order_Prefix
text
Yes
empty
The prefix of the order number, for example PO. The order gets the next free number for this prefix in the branch, and its number is the prefix, a hyphen and that number – for example PO-128.
Order_Date
date
No
today
The order date, yyyy-MM-dd. It also decides the financial year.
Valid_Till_Date
date
No
the order date
The date the order is valid till. A value that cannot be read as a date is ignored.
Delivery_Date
date
No
none
The expected delivery date. See the known issue on Quotation_Date.
Supplier_Order_No
text
No*
empty
The supplier's own order reference. *Required when the purchase-order series has Do not allow duplicate Supp. Order No. for Same Supplier ticked – see Rules.
Quotation_No
text
No
empty
The supplier's quotation number.
Quotation_Date
date
No
none
Not saved as the quotation date – see the known issue below.
Remarks
text
No
empty
Remarks of the order.
Tax_Region
text
No
the supplier's tax region
A tax region by name, exactly as in Logic ERP. Replaces the supplier's tax region for this order. See the known issues below.
Agent_Name
text
No
none
An agent / broker by name, exactly as in Logic ERP. (NIL) means no agent.
Company_Name
text
No
none
A company (brand) by name, exactly as in Logic ERP's company master. (NIL) means none.
Transport_Name
text
No
none
A transporter by name, exactly as in Logic ERP. (NIL) means none.
DepartmentName
text
No
none
A department by name, exactly as in Logic ERP.
Transfer_Party_UserCode
text
No
none
A transfer party, by party code.
Delivery_At, Delivery_Add_1, Delivery_Add_2, Delivery_Add_3
text
No
empty
The delivery place and three address lines.
Total_Other_Val_1 to Total_Other_Val_5
number
No
0
Amounts for "other value" 1 to 5 of the order, in ₹. Used only when the purchase-order series' calculation includes that other value; it is then added or deducted as the series says. 0 lets the series' default apply.
ListItems
list
Yes
empty list
The items ordered – see below.
DisplayError
text
No
"0"
"1" = when the request fails, Message holds the full technical detail. Use only while testing.
ListItems – one entry per order line
LogicUser_Code
text
One of the two
empty
The item code shown in Logic ERP (UserCode in Get Item Master).
AddlItemCode
text
One of the two
empty
The additional item code / barcode (AddlItemCode in Get Item Master). Used when LogicUser_Code is empty. A code from the item's list of extra barcodes is accepted too. Send only one of the two codes – see the known issue below.
Order_Qty
number
Yes
0
Quantity ordered. Must be above 0.
Rate
number
No – but always send it
0
Rate per unit, in ₹. See the known issue below.
SPCD_P
number
No
0
Discount percentage for the line. Used when the series' calculation has an item-wise discount.
Tax_Amount
number
No
0
Despite its name, the tax percentage of the line, for example 12 for 12 %. See Rules and the known issue below.
Remarks
text
No
empty
Remarks of the line.
Lot_Number
text
No
empty
The lot number for the line. Replaced by the order number when the series has Move PO Number to Lot Number ticked.
Lot_QR_Code, Lot_Extra_1, Addl_Lot_Number
text
No
empty
Saved on the lot only when the series is set to generate lots in advance (Generate Lot As is not None). Ignored otherwise.
Ignored fields. Branch_Short_Name (see the known issue below), Total_Other_Val_6, Total_Other_Val_7, and in ListItems: ItemDetCode. Any other field you send is ignored. MRP comes from the item master; there is no free quantity, currency or exchange-rate field.
Rules Logic ERP applies
Series. The order is saved in the purchase-order series chosen as Default Configuration in your API site's settings for LOGIC API PUSH - PURCHASE ORDER. There is no request field for the series. Discounts, taxes, other values and rounding follow that series, as on Logic ERP's purchase-order screen.
Number. The order gets the next number for
Order_Prefixin the branch (highest existing number + 1), so numbers can differ from the series' own numbering. There is no request field for the number.Supplier.
Party_User_codemust be a supplier or customer account. Its tax region is used for the order (see Taxes). The supplier's default agent is not used: the order has an agent only when you sendAgent_Name.Items. Each
ListItemsentry becomes one order line, in the order sent. The same item may appear on several lines. Every item code must exist; one unknown code stops the whole request. MRP is the item's MRP in the item master.Ignore Invalid Item for Request Json. When this API setting is ticked, entries whose
LogicUser_Codeis exactly-1are dropped before anything is checked. Other unknown codes are still refused.Rates. The
Rateyou send is used as it is. When it is0or left out, Logic ERP looks up a rate itself – see the known issue below.Taxes. The order's tax region is the one linked to the supplier for this branch, otherwise the supplier's own tax region, unless you send
Tax_Region. When the series has Retrieve Item Wise Purchase Tax Type Info ticked and its tax is worked out item-wise, Logic ERP finds each item's GST rate for that region and yourTax_Amountis replaced. OtherwiseTax_Amountis used as the line's tax percentage.Date checks. The order date must be in a financial year that is open in Logic ERP. The rights of the Logic ERP user linked to your API site apply: back-dated orders (earlier than the branch's latest purchase order), post-dated orders and locked periods can be refused.
Supplier order number. When the series has Do not allow duplicate Supp. Order No. for Same Supplier ticked,
Supplier_Order_Nomust be sent and must not already exist on a purchase order of this supplier in the branch.Lots. When the series is set to generate lots in advance, a lot is created for each line, numbered with the order number (or with your
Lot_Numberwhen Move PO Number to Lot Number is not ticked).Approval. If your Logic ERP set-up requires new purchase orders to be approved, the order is saved as waiting for approval and the approvers are notified.
Duplicates. There is no duplicate check on the request (apart from the supplier order number above). Sending the same request twice creates two orders – check
Statusbefore you resend.All or nothing. The order and all its lines are saved together. If anything fails, nothing is saved.
Switched off. When this endpoint is switched off in your API site's settings, nothing is saved and the response has
Status: truewith the In-Active sentence inMessage, as described in How Every API Call Works. The switch is read for the whole API site, not per branch.Your Logic ERP licence must include the purchase-order API.
Known issue – always send
Branch_Code.Branch_Short_Nameis not read. WhenBranch_Codeis left out, the order is saved under a placeholder branch instead of a real one and the request does not fail. Send the branch code.
Known issue – a missing
Rateis not the purchase rate. WhenRateis0or left out, the line gets the supplier's rate for the item (the transfer party's, when you sendTransfer_Party_UserCode) if the series has Pick Supplier + Item Wise Rates ticked and such a rate exists; otherwise it gets the item's sale rate (from the item master or from the item's latest lot, depending on the series). Always send the purchase rate.
Known issue –
Tax_Amountis a percentage. The value is used as the line's tax rate, not as a tax amount:Tax_Amount: 180on a ₹1,500 line adds ₹2,700 of tax. Send the tax percentage, or0when the series finds the taxes itself.
Known issue –
Quotation_Dateoverwrites the delivery date. A validQuotation_Dateis saved as the order's delivery date, replacingDelivery_Date, and the order is saved without a quotation date. LeaveQuotation_Dateout when you sendDelivery_Date.
Known issue – an unknown
Tax_Regionis not refused. When the name you send is not found, the order is saved with no tax region, so no taxes can be found for its items. Send the name exactly as in Logic ERP, or leave it out.
Known issue – the default tax region. Without
Tax_Region, the order takes the tax region linked to the supplier for sales in this branch, not the one linked for purchases. When the supplier has a different purchase tax region in this branch, send it inTax_Region.
Known issue – both item codes sent. When an entry has both
LogicUser_CodeandAddlItemCodeand theLogicUser_Codeis wrong, the item is checked by itsAddlItemCodebut the line is then left out of the order without a message. Send only one code per entry.
Example request
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 purchase order of the sandbox's test item APITEST0001; change Supplier_Order_No each time.
Creates a new purchase order in Logic ERP – an order you place on a supplier for goods you want to buy. You send the supplier, the order prefix and the items with their quantities and rates; Logic ERP gives the order the next number for that prefix, works out discounts, taxes and totals with the purchase-order series chosen for your API site, and saves it as pending so that delivery notes and purchase vouchers can later be made against it.
The user name and password of your API site.
The branch the order is saved in (Branch_Code in Get Branch Info). See the known issue below.
The supplier, by the party code shown in Logic ERP (User_Code in Get Party Master). A supplier or customer account is accepted.
The prefix of the order number, for example PO. The order gets the next free number for this prefix in the branch, and its number is the prefix, a hyphen and that number – for example PO-128.
The order date, yyyy-MM-dd. It also decides the financial year.
The supplier's own order reference. *Required when the purchase-order series has Do not allow duplicate Supp. Order No. for Same Supplier ticked – see Rules.
Remarks of the order.
Always HTTP 200. Check Status and Message.
The order number – prefix, a hyphen and the number, for example PO-128. Empty (null) when not saved.
Always null.
Always empty.
true when the order was saved.
Empty when saved; the reason when not saved.
Logic ERP's internal number of the new order; 0 when not saved.
The ID of this request – quote it to support.
No login was sent.
POST /api/SavePurchaseOrder HTTP/1.1
Host: demo.logicerp.com
Authorization: Basic username:password
Content-Type: application/json
Accept: */*
Content-Length: 269
{
"Branch_Code": 2,
"Party_User_code": "556",
"Order_Prefix": "APITEST",
"Order_Date": "2026-10-30",
"Supplier_Order_No": "APITEST-PO-001",
"Remarks": "API TEST",
"ListItems": [
{
"LogicUser_Code": "APITEST0001",
"Order_Qty": 2,
"Rate": 100,
"SPCD_P": 0,
"Tax_Amount": 5,
"Remarks": "API TEST"
}
]
}{
"LastSavedDocNo": "text",
"Order_No": "text",
"ErrorCode": "text",
"Status": true,
"Message": "text",
"LastSavedCode": 1,
"request_ID": "text"
}Response
Status
true / false
true when the order was saved.
Message
text
Empty when saved; the reason when not saved.
LastSavedCode
number
Logic ERP's internal number of the new order; 0 when not saved.
LastSavedDocNo
text
The order number – prefix, a hyphen and the number, for example PO-128. Empty (null) when not saved.
Order_No
text
Always null.
ErrorCode
text
Always empty.
request_ID
text
The ID of this request – quote it to support.
Example response
Messages you may see
The checks run roughly in the order of this table, so the first problem found is the one reported. With DisplayError "1", every message comes with technical detail around it – look for the reason in the first line.
A message saying the text could not be converted to a date
Order_Date is not a date.
Send dates as yyyy-MM-dd.
Default Purchase Order Configuration Not Selected!!
No purchase-order series is chosen in your API site's settings.
Ask your Logic ERP team to choose the Default Configuration.
Invalid Party User Code...
Party_User_code is missing or is not a supplier or customer account.
Send the supplier's party code.
Invalid Agent Name... / Invalid Company Name... / Invalid Transport Name...
A name was not found.
Send it exactly as in Logic ERP, or leave it out.
LogicUserCode Or EAN Code Cannot Blank!!
An entry in ListItems has neither code.
Send LogicUser_Code or AddlItemCode.
Invalid LogicUserCode / EANCode : …
An item code was not found (the code is shown in capitals).
Send the code exactly as in Logic ERP.
Quantity cannot be blank. Logic User Code : …
Order_Qty is 0 or less.
Send a quantity above 0.
Entry not allowed in back date.......
The order date is earlier than the latest purchase order of the branch (or than today), and back-dated entries are not allowed.
Send a later Order_Date, or ask your Logic ERP team about the rights.
Post Dated enteries are not allowed.......
The order date is after today.
Send today's date or earlier.
Entry/Modification is locked for this period.... / Modification rights not available for this date.....
The period of the order date is locked.
Send a date in an open period.
Invalid Order Prefix Entered...
Order_Prefix is empty.
Send a prefix.
No Item Found!!
ListItems is empty (or every entry was dropped as -1).
Send at least one item.
Unable to found Department Name : … / Unable to found Transfer Party Name : …
A department or transfer party was not found.
Send it exactly as in Logic ERP, or leave it out.
Date not Within Financial Year / Order Date is not Within the Financial Year
No financial year is open for the order date.
Send a date in an open financial year.
Supplier Order No. Cannot be blank.Please Check
The series needs a supplier order number.
Send Supplier_Order_No.
Supplier Order No. already exists for same Supplier.Please Check
The supplier order number is already used for this supplier in the branch.
Send the correct number; do not resend an order that was saved.
The operation was canceled.
Saving was stopped inside Logic ERP; nothing was saved.
Retry once; if it repeats, send the request_ID to support.
Another technical error
Saving failed inside Logic ERP; nothing was saved.
Retry once; if it repeats, send the request_ID to support.
Last updated