Purchase_POST

The latest version of the Cin7 Core API (V2) is available, with more advanced functionality and support for recent system changes. See the full API documentation to get started.

The Purchase resource allows creating new Purchase, by sending POST request:

Operation HTTP Action
Create new Purchase Task POST /Purchase

Creating new Purchase

To create new Purchase you need to send POST request to Purchase endpoint with Purchase structure (see below) as payload.

Available Fields for Purchase:

Property Type Length Required Notes
SupplierID Guid Yes* Identifier of Supplier
Supplier String 256 Yes* Supplier name. Required if SupplierID not set
Contact String 256 Supplier Contact name
Phone String 50 Supplier Contact phone
InventoryAccount String 50 Account code used by default for invoice lines when no Inventory account is defined on Product. By default Inventory Control Account is used from account mapping.
BlindReceipt Boolean “True” if there is no order in the purchase. “False” is default
Approach String 10 Yes “INVOICE” for “Invoice First”, or “STOCK” for “Stock First”
VendorAddress Structured Purchase Vendor address, see below
ShippingAddress Structured Purchase Shipping address, see below
BaseCurrency String 3 Yes 3 character currency code of Base Currency defined in general settings on the moment when Purchase was created.
TaxRule String 50 Yes Default Tax Rule name selected for Purchase, if not specified then used supplier defined Tax Rule
TaxCalculation String No “Inclusive” or “Excelusive”. If not set, it will be used from TaxRule
Terms String 256 Yes Payment terms name, if not specified supplier Terms would be used
RequiredBy Date Date when shipment is due
Location String 256 Default location to store stock
Note String 1024 Custom Purchase note
CurrencyRate Decimal Up to 5 decimal places Yes Conversion Rate expressed as number of Base currency units for one Supplier currency unit
Order Structured Yes Purchase Order, see below
StockReceived Structured Purchased and received items, see below
AdditionalAttributes Structured Purchase Additional Attributes, see below
Invoice Structured Purchase Invoice, see below.

Available Fields for VendorAddress and ShippingAddress:

Property Type Length Required Notes
Line1 String 256 Yes
Line2 String 256
City String 256
State String 256
Postcode String 20
Country String 32 Yes

Available Fields for Order:

Property Type Length Required Notes
Memo String 1024 Purchase Order memo
Date Date Purchase Order Date
Status String 20 Yes Purchase Order status. Possible values are “VOIDED”, “DRAFT”, “AUTHORISED”, “NOT AVAILABLE”
Lines Array of OrderLine Order Lines, see below
AdditionalCharges Array of AdditionalCharge Order Additional Charges, see below
Prepayments Array of Prepayment Prepayments, see below
TotalBeforeTax Money Yes Order Total before taxes in Supplier Currency
Tax Money Yes Order Total Tax in Supplier Currency
Total Money Yes Order Total (TotalBeforeTax + Tax) in Supplier Currency

Available Fields for StockReceived:

Property Type Length Required Notes
Status String 20 Yes Purchase StockReceived status. Possible values are “VOIDED”, “DRAFT”, “AUTHORISED”, “NOT AVAILABLE”
Lines Array of StockReceivedLine Lines stock received, see below

Available Fields for Invoice:

Property Type Length Required Notes
Status String 20 Yes Invoice status. Possible values are “VOIDED”, “DRAFT”, “AUTHORISED”, “NOT AVAILABLE”, “PAID”
InvoiceNumber String 256 Yes Number in invoice from supplier
InvoiceDate Date Date when invoice created. Default value is current date, used if not specified
InvoiceDueDate Date Date until invoice is valid. If not specified, used default value from Terms
Lines Array of InvoiceLine Invoice Lines, see below
AdditionalCharges Array of InvoiceAdditionalCharge Invoice Additional Charges, see below
Payments Array of Payment All invoice payments, see below
TotalBeforeTax Money Yes Invoice Total before taxes in Supplier Currency
Tax Money Yes Invoice Total Tax in Supplier Currency
Total Money Yes Invoice Total (TotalBeforeTax + Tax) in Supplier Currency
Paid Money Yes Invoice Paid Total in Supplier Currency

Available Fields for Order Line:

Property Type Length Required Notes
ProductID Guid Yes* Unique ID of the product referenced by this Order Line. Required only if SKU is not set. If both ProductID and SKU specified priority has ProductID
SKU String 50 Yes* Product SKU. Required only if ProductID is not set. If both ProductID and SKU specified priority has ProductID
Quantity Decimal with up to 4 decimal places Yes
Price Decimal with up to 4 decimal places Yes Price per unit in Supplier currency
Discount Decimal with up to 2 decimal places Yes Discount. Value between 0 and 100. For free items discount is 100
Tax Decimal with up to 4 decimal places Yes Calculated Tax value in Supplier currency
Total Decimal with up to 2 decimal places Yes Line Total in Supplier currency. Can include Tax if Tax Rule for Purchase is Tax Inclusive
TaxRule String 50 Yes Line Tax Rule name
Comment String 256

Available Fields for Order AdditionalCharge:

Property Type Length Required Notes
Description String 256 Yes Additional charge description
Reference String 256 Reference
Amount Decimal with up to 4 decimal places Yes Charge amount in Supplier currency
Discount Decimal with up to 2 decimal places Yes Discount. Value between 0 and 100. For free items discount is 100
Tax Decimal with up to 4 decimal places Yes Calculated Tax value in Supplier currency
Total Decimal with up to 2 decimal places Yes Additional Charge line total in Supplier currency. Can include Tax if Tax Rule for Purchase is Tax Inclusive
TaxRule String 50 Yes Additional Charge Tax Rule name

Available Fields for Payment and Prepayment:

Property Type Length Required Notes
Reference String 50 Payment reference number
Amount Money Yes Payment amount in Supplier currency
DateCreated Date Yes Date when payment was created
DatePaid Date Yes Date when payment has been made
Account String 50 Yes Account Code of the Bank account
CurrencyRate Decimal with up to 5 decimal places Yes Currency Conversion rate expressed as number of Base currency units for one Supplier currency unit. Equals 1 when Supplier currency is the same as base currency.

Available Fields for StockReceivedLine:

Property Type Length Required Notes
ProductID Guid Yes* Unique ID of the product referenced by this Order Line. Required only if SKU is not set. If both ProductID and SKU specified priority has ProductID
SKU String 50 Yes* Product SKU. Required only if ProductID is not set. If both ProductID and SKU specified priority has ProductID
Location String 256 Yes Location where the product would be stock to/from
Quantity Decimal with up to 4 decimal places Yes
DateReceived Date Date when items were received
Batch String 50 Batch or Serial Number
ExpiryDate Date Date when selected Batch expires

Available Fields for InvoiceLine:

Property Type Length Required Notes
ProductID Guid Yes* Unique ID of the product referenced by this Order Line. Required only if SKU is not set. If both ProductID and SKU specified priority has ProductID
SKU String 50 Yes* Product SKU. Required only if ProductID is not set. If both ProductID and SKU specified priority has ProductID
Name String 256 Yes Product name referenced by this Line
Quantity Decimal with up to 4 decimal places Yes
Price Decimal with up to 4 decimal places Yes Price per unit in Supplier currency
Discount Decimal with up to 2 decimal places Yes Discount. Value between 0 and 100. For free items discount is 100
Tax Decimal with up to 4 decimal places Yes Calculated Tax value in Supplier currency
Total Decimal with up to 2 decimal places Yes Line Total in Supplier currency. Can include Tax if Tax Rule for Purchase is Tax Inclusive
TaxRule String 50 Yes Line Tax Rule name
Account String 50 Yes
Comment String 256

Available Fields for InvoiceAdditionalCharge:

Property Type Length Required Notes
Description String 256 Yes Additional charge description
Amount Decimal with up to 4 decimal places Yes Charge amount in Supplier currency
Reference String 256 Reference
Discount Decimal with up to 2 decimal places Yes Discount. Value between 0 and 100. For free items discount is 100
Tax Decimal with up to 4 decimal places Yes Calculated Tax value in Supplier currency
Total Decimal with up to 2 decimal places Yes Additional Charge line total in Supplier currency. Can include Tax if Tax Rule for Purchase is Tax Inclusive
TaxRule String 50 Yes Additional Charge Tax Rule name
Account String 50 Yes

Available Fields for AdditionalAttributes:

Property Type Length Required Notes
AdditionalAttribute1 String 256 Additional Attribute 1 value
AdditionalAttribute2 String 256 Additional Attribute 2 value
AdditionalAttribute3 String 256 Additional Attribute 3 value
AdditionalAttribute4 String 256 Additional Attribute 4 value
AdditionalAttribute5 String 256 Additional Attribute 5 value
AdditionalAttribute6 String 256 Additional Attribute 6 value
AdditionalAttribute7 String 256 Additional Attribute 7 value
AdditionalAttribute8 String 256 Additional Attribute 8 value
AdditionalAttribute9 String 256 Additional Attribute 9 value
AdditionalAttribute10 String 256 Additional Attribute 10 value

Sample of request

POST /DearApi/Purchase

Payload:

{ "Supplier": "whuk", "Contact": "New Contact", "Phone": "1234567890", "InventoryAccount": "715", "BlindReceipt": false, "Approach": "Invoice", "VendorAddress": { "Country": "Australia", "City": "Sydney", "Postcode": "13231", "Line1": "First ave 3-2" }, "ShippingAddress": { "Country": "Australia", "City": "Sydney", "Postcode": "98765", "Line1": "Second st. 5-7" }, "BaseCurrency": "AUD", "TaxRule": "Sales Tax on Imports", "Terms": "M1", "RequiredBy": "2016/01/01", "Location": "Main Warehouse", "Note": "Test Note", "CurrencyRate": 1, "Order": { "Memo": "Order Memo", "Status": "AUTHORISED", "Lines": [ { "ProductID": "b00c729f-0de2-474b-9fb2-57cb81d54e01", "SKU": "APItest2", "Quantity": 5, "Price": 11.2, "Discount": 0, "Tax": 0, "Total": 56, "TaxRule": "Sales Tax on Imports" } ], "AdditionalCharges": [ { "Description": "Extra handling", "Amount": 5, "Tax": 0, "TaxRule": "Sales Tax on Imports", "Reference": "Test Reference", "Discount": 0, "Total": 5 } ], "Prepayments": [ {"Amount": 20, "Reference": "Ref for prepay", "DateCreated": "2016/01/01", "DatePaid": "2016/01/01", "Account": "715", "CurrencyRate": 1 } ], "TotalBeforeTax": 61, "Tax": 0, "Total": 61 }, "Invoice": { "Status": "AUTHORISED", "InvoiceDate": "2016/01/01", "InvoiceDueDate": "2016/02/02", "InvoiceNumber": "AAA-111", "Lines": [ { "ProductID": "b00c729f-0de2-474b-9fb2-57cb81d54e01", "SKU": "APItest2", "Quantity": 5, "Price": 11.2, "Discount": 0, "Tax": 0, "Total": 56, "TaxRule": "Sales Tax on Imports", "Account": "715" } ], "AdditionalCharges": [ { "Description": "Extra handling", "Amount": 5, "Tax": 0, "TaxRule": "Sales Tax on Imports", "Reference": "Test Reference", "Discount": 0, "Total": 5, "Account": "715" } ], "Payments": [ {"Amount": 30, "Reference": "Ref for Pay", "DateCreated": "2016/01/01", "DatePaid": "2016/01/01", "Account": "715", "CurrencyRate": 1 } ], "TotalBeforeTax": 61, "Tax": 0, "Total": 61, "Paid": 50 }, "StockReceived": { "Status": "AUTHORISED", "Lines": [ { "ProductID": "b00c729f-0de2-474b-9fb2-57cb81d54e01", "SKU": "APItest2", "Quantity": 5, "Location": "Main Warehouse", "DateReceived": "2016/01/01" } ] }, "AdditionalAttributes": { "AdditionalAttribute1": "some value", "AdditionalAttribute2": "some value" } }

Was this article helpful?

Have more questions? Submit a request