For the complete documentation index, see llms.txt. This page is also available as Markdown.

Save a Purchase Challan

Creates a purchase challan in Logic ERP: a goods receipt for goods that arrive from a supplier before the supplier's bill, usually with the supplier's delivery challan. The goods are added to your branch's stock at once, in lots, and get a GRN number. A purchase challan is not a purchase bill: it is kept with the challans, not with the year's purchase vouchers, and the bill is raised later against it.

Endpoint

Name
Detail

Address

https://your-server/api/SavePurchaseChallan

Method

POST

Authorization

Basic Auth

The response envelope, branches, dates and the common messages are explained in How Every API Call Works.

Send one challan per request. Field names are matched without regard to upper/lower case; fields not listed below are ignored. Do not send null for LstItems.

Where a purchase challan fits

How it differs from Save a Purchase Voucher

The request has the same fields as Save a Purchase Voucher. The differences:

  • The document is a challan, not a purchase bill. It is kept with the purchase challans, apart from the purchase vouchers, and has its own numbering.

  • This endpoint always uses Logic ERP's import save routine. Save a Purchase Voucher can be switched by your Logic ERP team to a routine that drives the purchase screen; this one cannot.

  • LotNo is optional. Without it the lot number is the first 24 characters of Bill_No. (On Save a Purchase Voucher with the import routine a lot number is required on every line.)

  • Your API site has separate settings for this endpoint: the default purchase-challan series, the default godown and the duplicate bill-number check. Goods-in-transit does not apply to challans.

  • A Bill_No already used is checked against the supplier's purchase challans and purchase challan returns, not against purchase bills.

Request fields

Field
Type
Required
Default
Meaning

AccountCode

text

Yes

–

The supplier's party code (User_Code in Get Party Master). Must already exist. The tax region, credit days, transporter and default discounts are taken from this account.

SupplierCode

text

No

AccountCode

A different party code for the supplier of the goods, when the account is someone else. Must exist. Usually left out.

BranchCode

number

No

0

The branch receiving the goods, by Logic ERP's branch number (Branch_Code in Get Branch Info).

BranchShortName

text

No

empty

The branch by its short name; used only when BranchCode is 0. With neither, Logic ERP falls back to a default branch – always send one.

Bill_No

text

No*

empty

The supplier's bill or delivery-challan number. *Required when your API site checks duplicate supplier bills. Also becomes the lot number when LotNo is empty, and is stored on the lots as their bill number.

InvoiceDate

date

No

today

Date of the challan (the goods-receipt date), yyyy-MM-dd. See the rules on dates.

Bill_Date

date

No

InvoiceDate

Date of the supplier's bill / challan; also the lots' purchase date.

PartyBillDate

date

No

InvoiceDate

Party bill date stored on the challan.

Godown_Name

text

No

API site default godown

Godown the goods go into, by name. Must exist.

GRN_Prefix

text

No

the series' GRN prefix, else GRN

Prefix of the GRN number. The number itself is always the next free number.

GR_Number, GR_Date

text, date

No

empty

Transporter's LR / GR number and date; GR_Date is used when it is a date. A separate field GRDate, when sent as a date, takes priority over GR_Date.

GPN_No, GPN_Date

text, date

No

empty

Gate pass number and date. GPN_Date must be a date when GPN_No is sent.

OrderNo, OrderDate

text, date

No

empty

Your purchase order reference and its date.

ChallanNo, ChallanDate

text, date

No

empty

A further challan reference and date, stored only.

PU_Remarks_1

text

No

–

See the known issue – not saved.

PU_Remarks_2, PU_Remarks_3

text

No

empty

Remarks.

AgentName

text

No

none

Agent, by name. Must exist.

TransporterName

text

No

the supplier's transporter

Transporter, by name. Must exist.

CostCenter

text

No

none

Cost centre, by name. Must exist.

CurrencyName, ExchangeRate

text, number

No

empty, 1

Foreign currency by name (must exist) and its rate; the rate is used when more than 0.

CreditDays

number

No

the supplier's payment terms

Used when more than 0.

Freight, Adjustment_Rs, SpDiscountRs

number

No

0

Freight, adjustment and special discount in ₹ for the whole challan; used when more than 0 and spread over the lines.

CD_P, TD_P, SP_CD, SchemeRs, AdjustUnit

number

No

0

See the known issue on bill-level discounts.

TransportMode, VehicleNo, Cases, Weight, PVTMark, Insurance_Policy_No, Declaration_No, DeliveryAt, DeliveryAdd1, DeliveryAdd2

text

No

empty

Transport, packing and delivery details, stored on the challan.

Series_Code

number

No*

–

Logic ERP's internal number of a purchase series. *Used only when your API site has no default series for this endpoint; otherwise ignored. Ask your Logic ERP team for the number.

LstItems

list

Yes

–

The goods received. See below. ListItems is accepted as another name.

DisplayError

text

No

"0"

"1" = full technical error text in Message when something fails.

Doc_Type

text

No

"PU"

Leave it out. Any value other than PU or PR stops the reverse-charge flag from being taken from the tax region.

Request_ID, EntrySource, DNO_Code, Challan_Code, PO_Code

–

No

–

Ignored by this endpoint.

LstItems

Field
Type
Required
Default
Meaning

LogicUser_Code

text

Yes, or AddlItemCode

empty

The item code shown in Logic ERP (UserCode in Get Item Master).

AddlItemCode

text

Yes, or LogicUser_Code

empty

The item's additional code / barcode; used when LogicUser_Code is empty or not found.

ScannedQty

number

Yes

–

Quantity received; more than 0.

BasicRate

number

No

0

Rate per unit in ₹ used for the line amount (before discounts and taxes).

PurRate

number

No

0

Purchase rate per unit for the lot.

SaleRate

number

No

0

Sale rate per unit for the lot. See the known issue on lot rates.

Lot_Mrp

number

No

0

MRP per unit for the lot.

SP_Rate_1 … SP_Rate_5

number

No

0

Special rates 1 to 5 for the lot.

LotNo

text

No

first 24 characters of Bill_No

Lot (batch) number for the goods. See the rules on lots.

Production_Unit

text

No

empty

Production unit of the lot. Added to the lot number as `LotNo

Expiry_Date, MFG_Date

date

No

empty

Expiry and manufacturing dates for the lot; used when they are dates.

ItemDescription

text

No

empty

Description for the line.

Godown_Code

number

No

0

Logic ERP's internal number of a godown for this line only. 0 = the challan's godown. Must exist.

LotCode, Lot_Bill_No, Org_Production_Unit

–

No

–

Ignored by this endpoint (the lot always gets Bill_No as its bill number).

Rules Logic ERP applies

Supplier, branch and series

  • The supplier is found by its party code. The code is not checked to be a supplier – any account code is accepted.

  • The series is your API site's default series for purchase challans. If none is set, Series_Code is used; with neither the request fails.

  • The branch is BranchCode, else BranchShortName.

Dates and financial year

  • The challan is saved in the financial year of the day the request arrives, whatever dates you send.

  • InvoiceDate is the challan date. Left out, it is today. A date after today is refused unless your Logic ERP user may enter post-dated purchase documents; a date in a period locked for entry is refused. See the known issue on earlier dates.

  • Bill_Date and PartyBillDate default to InvoiceDate. If the series dates purchases by the supplier's bill date, Bill_Date must also fall in the current financial year.

Lots and stock

  • Each line adds stock to a lot of the item in the branch and godown. The lot number is LotNo, else the first 24 characters of Bill_No – send at least one of them.

  • Whether an existing lot with the same item and number is added to, or a new lot is created, depends on how the series keeps lots (set in Logic ERP). When an existing lot is used, its purchase date, supplier and bill number are updated from this challan.

  • Godown: the line's Godown_Code, else Godown_Name, else your API site's default godown.

Taxes and amounts

  • The tax region comes only from the supplier: the account's tax region for this branch, else the account's own tax region (when SupplierCode is sent, that party's tax region for this branch takes priority). No request field can supply one, and the series' default tax region is not used. Taxes are then worked out per item from that region.

  • The line amount is ScannedQty × BasicRate. Freight, Adjustment_Rs and SpDiscountRs are spread over the lines. The supplier's default CD %, TD % and special CD % in Logic ERP are applied to every line.

  • GST checks run before saving: the supplier's GST state against the tax region (for example an IGST region for a supplier in your own state is refused), and the GST accounts linked to the taxes.

Duplicates

  • If your API site checks duplicate supplier bills, Bill_No must not be empty and must not already be on a purchase challan or purchase challan return – of this supplier and branch, of this supplier, or of anyone, depending on the setting.

  • In every case Logic ERP also refuses a Bill_No already used on a purchase challan or purchase challan return of the same supplier in the same branch (matched without regard to case).

Saving

  • The challan is saved in one step; on any failure nothing is saved.

  • This endpoint's settings, including whether it is switched off, are read for the whole API site, not per branch. For what a switched-off endpoint answers, see How Every API Call Works.

Known issue – PU_Remarks_1 is not saved. The first remark is dropped, so the challan's first remark stays empty. Send remarks in PU_Remarks_2 and PU_Remarks_3.

Known issue – earlier dates are moved silently. An InvoiceDate before the start of the current financial year is not refused: the challan is saved dated on the first day of the current financial year. Send an InvoiceDate within the current financial year, and check the date of saved challans with Get Purchase Challans.

Known issue – a supplier without a tax region cannot be used. If neither the supplier's branch tax region nor its own tax region is set, the request fails with Default Tax Region not Set.Please Check.... even when the series has a default tax region. Set the supplier's tax region in Logic ERP first.

Known issue – bill-level discounts. CD_P, TD_P, SP_CD, SchemeRs and AdjustUnit do not change the amounts; the lines take the supplier's default discounts. Send the net rate in BasicRate instead.

Known issue – lot rates. On a test run, a challan saved with SaleRate 3099 and BasicRate 100 showed the lot's sale rate and basic rate as 0 in Get Stock In Hand, while the MRP was kept. Do not rely on lot rates being stored as sent; check them in Logic ERP.

Known issue – an apostrophe in a code or name. Codes and names you send (party codes, item codes, godown, agent, transporter, cost centre, currency, bill number) are looked up exactly as typed. An apostrophe (') in any of them, for example D'SOUZA, makes the request fail with a database error. Leave apostrophes out of codes and names you send.

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 challan of the sandbox's test item APITEST0001.

Save a Purchase Challan

post

Creates a purchase challan in Logic ERP: a goods receipt for goods that arrive from a supplier before the supplier's bill, usually with the supplier's delivery challan. The goods are added to your branch's stock at once, in lots, and get a GRN number. A purchase challan is not a purchase bill: it is kept with the challans, not with the year's purchase vouchers, and the bill is raised later against it.

Authorizations
AuthorizationstringRequired

The user name and password of your API site.

Body
BranchCodeintegerOptional

The branch receiving the goods, by Logic ERP's branch number (Branch_Code in Get Branch Info).

AccountCodestringOptional

The supplier's party code (User_Code in Get Party Master). Must already exist. The tax region, credit days, transporter and default discounts are taken from this account.

Bill_NostringOptional

The supplier's bill or delivery-challan number. *Required when your API site checks duplicate supplier bills. Also becomes the lot number when LotNo is empty, and is stored on the lots as their bill number.

Bill_DatestringOptional

Date of the supplier's bill / challan; also the lots' purchase date.

PartyBillDatestringOptional

Party bill date stored on the challan.

InvoiceDatestringOptional

Date of the challan (the goods-receipt date), yyyy-MM-dd. See the rules on dates.

Godown_NamestringOptional

Godown the goods go into, by name. Must exist.

OrderNostringOptional

Your purchase order reference and its date.

PU_Remarks_2stringOptional

Remarks.

Responses
200

Always HTTP 200. Check Status and Message.

application/json
LastSavedDocNostringOptional

The challan's GRN number, GRN prefix and number joined by -, for example GRN-10041 (GRN_Prefix and GRN_Number in Get Purchase Challans). This is not the voucher number (Vouch_No). null when nothing was saved.

StatusbooleanOptional

true = the challan was saved.

MessagestringOptional

Why it failed; empty on success.

LastSavedCodeintegerOptional

Logic ERP's internal number of the challan. Send it as Challan_Code to bill the challan, or in Doc_Codes to read it back.

request_IDstringOptional

The ID of this request – quote it to support.

post/SavePurchaseChallan
POST /api/SavePurchaseChallan HTTP/1.1
Host: demo.logicerp.com
Authorization: Basic username:password
Content-Type: application/json
Accept: */*
Content-Length: 391

{
  "BranchCode": 2,
  "AccountCode": "556",
  "Bill_No": "APITEST-PC-003",
  "Bill_Date": "2026-10-30",
  "PartyBillDate": "2026-10-30",
  "InvoiceDate": "2026-10-30",
  "Godown_Name": "MAIN",
  "OrderNo": "APITEST-PC-003",
  "PU_Remarks_2": "API TEST",
  "LstItems": [
    {
      "LogicUser_Code": "APITEST0001",
      "ScannedQty": 5,
      "BasicRate": 100,
      "PurRate": 100,
      "SaleRate": 3099,
      "Lot_Mrp": 3199,
      "LotNo": "APITESTLOT2",
      "ItemDescription": "API TEST"
    }
  ]
}
{
  "LastSavedDocNo": "text",
  "Status": true,
  "Message": "text",
  "LastSavedCode": 1,
  "request_ID": "text"
}

Response

Field
Type
Meaning

Status

true / false

true = the challan was saved.

Message

text

Why it failed; empty on success.

LastSavedCode

number

Logic ERP's internal number of the challan. Send it as Challan_Code to bill the challan, or in Doc_Codes to read it back.

LastSavedDocNo

text

The challan's GRN number, GRN prefix and number joined by -, for example GRN-10041 (GRN_Prefix and GRN_Number in Get Purchase Challans). This is not the voucher number (Vouch_No). null when nothing was saved.

request_ID

text

The ID of this request – quote it to support.

Example response

Messages you may see

All with Status: false. Text in … is replaced by the value concerned. Messages marked † arise while the challan is being built and saved: they come with technical text before and after the reason – look for the sentence. With "DisplayError": "1" every message carries technical detail – read the first line.

Message
Meaning
What to do

Default Configuration Not Defined in API Template

No default series for this endpoint and no Series_Code.

Ask your Logic ERP team to set the default purchase-challan series.

Account Code Not Defined..., Invalid Account User Code...

AccountCode is empty or not found.

Send an existing party code.

Invalid Supplier Code Defined...

SupplierCode not found.

Send an existing party code, or leave it out.

Invalid Invoice Date Defined..., Invalid Bill Date..., Invalid Party Bill Date...

A date that is not a date.

Send yyyy-MM-dd.

Post Dated enteries are not allowed.......

InvoiceDate is after today.

Send today or an earlier date.

Entry/Modification is locked for this period...., Modification rights not available for this date..... †

The date falls in a period locked for entry.

Use a date in an open period, or ask the Logic ERP user to unlock it.

Invoice Date Date not within financial year.Please Check....

InvoiceDate is after the end of the current financial year.

Send a date in the current financial year.

Bill Date not Within Financial Year †

The series dates purchases by bill date and Bill_Date is outside the current financial year.

Send a Bill_Date in the current financial year.

Bill No can't be blank...

Duplicate checking is on and Bill_No is empty.

Send the supplier's bill number.

Bill No:… already exists for current supplier and current Branch, Bill No:… already exists for current supplier.., Bill No:… already exists.

Your API site's duplicate check found the number.

Send the right bill number; do not resend a challan already saved.

Bill No:… already exists for this supplier... Cannot Continue. †

The number is already on a challan or challan return of this supplier in this branch.

As above.

Logic User Code/Additional Item Code Not Defined for Item No : …

A line has neither item code.

Send LogicUser_Code or AddlItemCode.

Invalid LogicUserCode / EANCode : …

The item code was not found.

Check the code with Get Item Master.

Quantity Not Defined For : '' Item No : …

ScannedQty is 0 or less on that line.

Send a positive quantity.

Unable to Find Items for Import... †

LstItems is empty or missing.

Send at least one line.

Invalid Godown Name […]. Please Check...

Godown_Name not found.

Use a godown name from Logic ERP.

Error Finding Godown...… †

A line's Godown_Code does not exist.

Send an existing godown, or 0.

Default Tax Region not Set.Please Check....

The supplier has no tax region.

See the known issue.

Party GST State and Company/Branch GST State cannot be same for IGST. Please check., Party GST State and Company/Branch GST State cannot be different for CGST/SGST. Please check., GST State not defined for this party. Please check., Party GSTN State Code and GST State Code do not match . Please check., Export/SEZ Party cannot be billed under CGST/SGST. Please check. †

The supplier's GST details do not suit its tax region.

Correct the supplier's GST state or tax region in Logic ERP.

Invalid CGST/SGST accounts linked. Please check., Invalid IGST accounts linked. Please check., Invalid GST accounts linked. Please check. † (may be followed by Row No.:…)

The tax accounts set up for the taxes do not match the GST type.

Ask your Logic ERP team to correct the tax set-up.

Please set Default Tax Type before import this document....... †

The series works taxes for the whole bill and has no default tax type.

Ask your Logic ERP team to set it.

Purchase / Tax Details not found for all Items. Check Row No.: … †

No purchase tax was found for an item in the supplier's tax region.

Set the item's tax group / HSN in Logic ERP.

Invalid Agent […] .Please Check, Unable to found Cost Center […] .Please Check †, Transporter Name [ … ] not found. Please Check... †, Currency Name [ … ] not found. Please Check... †

A name sent does not exist.

Use the name exactly as in Logic ERP.

Invalid GPN_Date .Please Check †

GPN_No sent without a valid GPN_Date.

Send both.

Blank GRN Number not allowed.. †

No GRN number could be given.

Contact support with the request_ID.

This document date is before/equal to Last Physical Stock Entry Date:… †

The branch's stock is locked up to a physical stock date.

Use a later date.

Error while saving voucher †

The save was stopped by a check inside Logic ERP.

Contact support with the request_ID.