Skip to main content
A despatch has a header and one or more lines. Inbound despatches (DespatchType 2, a goods receipt) and outbound despatches (DespatchType -2, a dispatch) use the same endpoints. Despatches create stock movements, so a line may also carry Lot or serial number entries depending on the product’s stock tracking method.
The API does not calculate line amounts, but it checks that they add up. Line amounts, discount amounts, VAT, additional taxes and withholding are stored as you send them (the same fields as order lines); a line whose amounts do not follow Noyax’s rules is rejected (7124). The despatch totals and AverageExchangeRate are filled from the lines; values sent for them are ignored. The API also calculates the line’s main unit quantity and the despatch’s currency (derived from the lines), and it requires the sum of a line’s Lot/serial number entries to equal the line’s Quantity. A line’s AdditionalTaxes follow the same rules as the product’s additional taxes: at most 3, each Code required and one of the listed codes, and a code can be used only once on a line.

Required fields

  • DespatchType: 2 inbound (goods receipt), -2 outbound (dispatch). Cannot be changed after the despatch is created.
  • DespatchNumber: unique within the company for the same DespatchType, at most 20 characters. Send "Next" on create to generate it automatically: ALİRSNO series for inbound despatches; for outbound despatches, the SATİRSNO series, or, when the company uses e-Despatch, the company’s e-Despatch numbering (a fixed prefix, the year and a 9-digit sequence, for example EDD2026000000014; the sequence continues from the highest outbound despatch number with the same prefix and year, so it starts again at 1 every year). "Next" cannot be sent on update.
  • Date: the despatch date. If you send a time it is stored as the despatch time, otherwise the current time is used.
  • CustomerCode: a customer the user can see.
  • Lines: at least one line.
The despatch currency is not a request field: each line sends its own CurrencyCode. The document currency is derived from the lines (the single currency they share, or the company’s default currency when they differ) and returned as CurrencyCode. AverageExchangeRate is not sent either; it is filled from the lines (a value in the request is ignored): when all lines share one currency, the average of the line exchange rates weighted by the line amounts (the sum of AmountExcludingTax × ExchangeRate divided by the sum of AmountExcludingTax); when the lines have different currencies, 1. See currencies. DueDays (payment term in days) is stored with the despatch. ShipmentDefinitionCode (optional) comes from shipment definitions.

Customer snapshot

The despatch’s address, title, tax number and tax office are not accepted in the request. They are copied from the customer at the moment the despatch is saved (the invoice address when the customer has one, otherwise the first address) and stay fixed afterward even if the customer changes later — this is why they only appear in responses (Address, CustomerTitle, TaxNumber, TaxOffice). On update, they are only recomputed when CustomerCode changes; otherwise the existing values are kept.

Lines

  • The product is given with ProductCode (the product’s code) or ECommerceProductCode (its e-commerce integration code); one of them is required. If both are sent, ProductCode is used. UnitCode is required. The unit must be one of the product’s own units (its main unit, or its second/third unit).
  • Quantity must be greater than 0; UnitPrice cannot be negative and must exclude VAT. VatIncluded is ignored (it is still accepted so that existing requests keep working).
  • CurrencyCode is required on every line. ExchangeRate must be 1 when the line currency is the company’s default currency; otherwise it is required and must be greater than 0.
  • Discounts is the list of the line’s discount rates, applied one after another in list order.
  • LineGroupName is optional, from line groups.
  • WarehouseName is required and must be one of the company’s warehouses.

Main unit quantity

Quantity is in the line’s unit. MainUnitQuantity in responses is the same quantity expressed in the product’s main unit, calculated by the API exactly as for order lines: the quantity itself when UnitCode is the main unit, otherwise divided by the unit’s multiplier. It is negative on an outbound despatch and positive on an inbound despatch.

Updating a despatch

Only the descriptive fields (Description, DocumentNumber, ActualDispatchDate, ShipmentDefinitionCode, SharingCode) can be updated; the lines and everything that affects stock or the customer account are fixed once the despatch is created. See Update despatch. To correct a despatch, delete it and create it again; a despatch already sent as an e-Despatch cannot be deleted (7019).

Lot and serial number tracking

Whether a line needs Lots or SerialNumbers depends on the product’s stock type (from the product’s StockType, read via Get product): Lots (LotNo, Quantity, UnitCode, and, on an inbound despatch only, SupplierLotNo/ExpiryDate/Description):
  • Inbound, for all four Lot-tracked stock types: each entry creates a new lot (LotNo is always provided by you, unique within the company) and a matching inbound movement.
  • Outbound, StockType 3 (Lot): you specify LotNo and Quantity for each lot to consume from.
  • Outbound, StockType 4/6/7 (FIFO/LIFO/FEFO): leave Lots empty — the API selects the lots automatically (oldest first for FIFO, nearest expiry first for FEFO, newest first for LIFO), consuming from one lot after another until the quantity is covered.
  • A lot that has already been consumed by an outbound transaction cannot be removed or reduced below the consumed quantity; the operation is cancelled instead.
Serial numbers (SerialNumbers, a plain list of strings, one per unit): on an inbound despatch each entry registers a new serial number (rejected if that serial number is already registered and has not been dispatched yet); on an outbound despatch each entry must be an existing, not-yet-dispatched serial number, which is marked as dispatched. A serial number that has already been dispatched by this despatch cannot be removed from the line.

Critical stock

If a product has a critical stock definition for a warehouse with controls set to stop the operation, every create and delete of a line that moves stock in that warehouse is checked. The stock that would result in that warehouse must satisfy every such control, otherwise the whole operation is rejected: The result is calculated for the whole request: for each product and warehouse, the stock before the request is compared with the stock after all its lines. A product and warehouse whose stock does not change is not checked. Deleting an inbound line decreases the stock and deleting an outbound line increases it, so deletes are checked too. The rule looks only at the resulting stock: a movement that leaves the stock outside a limit is rejected even if it moves the stock closer to that limit. Controls set to continue or warn do not block anything.

Linked orders

A despatch line that was created from an order line in the Noyax application carries a link to it. The API never creates or changes this link: despatches created through the API are not linked to orders.

Sharing

SharingCode limits who can see the despatch: empty means visible to everyone, otherwise it must be one of the user’s sharing codes. Despatches the user cannot see return 404.