Skip to main content
POST
Create order
The order, its lines and the discounts of the lines are written in a single transaction: if any of them is invalid, nothing is saved and all errors are returned in one Message. Line errors start with the line number, for example Line 2: Quantity must be greater than 0.

Field rules

Required fields, customer movement, approvals and status, lines.

Calculations

How amounts and totals are calculated.
The API does not calculate amounts and does not check that they are consistent. Send the line amounts and totals as your system calculated them. The main unit quantity of each line is calculated by the API.
  • If you send "Next" instead of OrderNumber, the number is generated from the number series of the order type.
  • With CreateCustomerMovement: true, the order amount is also written to the customer’s account (credit for a purchase order, debit for a sales order) in the same transaction. See customer movement.
  • The approvals required by the company’s approval definitions and the default order status are assigned automatically.
  • A successful response is 201 Created; the Location header points to the new order.

Error codes

Codes this endpoint can return. The general errors that apply to every endpoint (authentication, permissions, request headers, daily limit) are not repeated here.

Authorizations

Authorization
string
header
required

Access token obtained from the Noyax auth service with your API key.

Headers

X-UserID
integer<int32>
required

ID of the Noyax user the request is made on behalf of. Written to the audit fields of created, updated and deleted records.

Required range: x >= 1
X-CompanyID
integer<int32>
required

ID of the company. The user must be assigned to this company. All reads and writes are limited to this company.

Required range: x >= 1
X-PeriodID
integer<int32>

ID of the accounting period. Optional for customer endpoints; if sent, it is written to created records.

Required range: x >= 1

Body

OrderType
integer<int32>

Required. 1: Purchase order (placed with a supplier), 2: Sales order (received from a customer). Cannot be changed after the order is created.

Example:

2

OrderNumber
null | string

Required. Order number, unique within the company for the same OrderType. Send "Next" on create to generate it from the company's order number series for the type. At most 10 characters.

Example:

"9446A4D834"

DocumentNumber
null | string

Document number (free text). At most 20 characters.

Example:

"2026-15"

Date
null | string<date-time>

Required. Order date. The date part is stored as the order date; if a time is sent it is stored as the order time, otherwise the current time is used.

Example:

"2026-09-21T10:30:00"

Description
null | string

Description. At most 1000 characters.

CustomerCode
null | string

Required. Customer code (the customer's CustomerCode from GET /api/v1/customers). The order is written with the customer's address: the invoice address when the customer has one, otherwise the first address.

Example:

"C-0001"

CurrencyCode
null | string

Required. Currency code from GET /api/v1/definitions/currencies. It is also the currency of the customer movement when CreateCustomerMovement is true.

Example:

"TRY"

DueDays
integer<int32>

Payment term in days. Cannot be less than 0. When CreateCustomerMovement is true, the customer movement is due Date + DueDays (no due date when 0).

Example:

30

DeliveryDate
null | string<date-time>

Delivery date.

SharingCode
null | string

Sharing code that limits who can see the order. Empty means visible to everyone; otherwise it must be one of the user's sharing codes.

DiscountTotal
number<double>

Total discount amount. Sent by the integrator, not calculated by the API.

Example:

0

SubTotal
number<double>

Subtotal (sum of the line amounts excluding taxes). Sent by the integrator, not calculated by the API.

Example:

1000

VatTotal
number<double>

Total VAT amount. Sent by the integrator, not calculated by the API.

Example:

200

AdditionalTaxTotal
number<double>

Total additional tax amount. Sent by the integrator, not calculated by the API.

Example:

0

WithholdingTotal
number<double>

Total withholding (tevkifat) amount. Sent by the integrator, not calculated by the API.

Example:

0

GrandTotal
number<double>

Grand total. Sent by the integrator, not calculated by the API. When CreateCustomerMovement is true, it is the amount of the customer movement.

Example:

1200

AverageExchangeRate
number<double>

Weighted average exchange rate of the lines. Sent by the integrator, not calculated by the API. Use 1 when everything is in the company's default currency. It is also the exchange rate of the customer movement when CreateCustomerMovement is true.

Example:

1

CreateCustomerMovement
boolean

Whether the order has a customer movement. When true, a purchase order creates a credit (alacak) and a sales order creates a debit (borç) movement on the customer for GrandTotal, kept in sync on every update. When false the order has no customer movement; on update, false removes an existing movement. Movements that were already closed by a collection or payment cannot be changed or removed.

Example:

true

Lines
object[]

Required, at least one line. On update the lines are replaced: the order's existing lines are removed and these are saved instead.

Response

Created

Success
boolean
required

Whether the operation succeeded.

Example:

true

ResultCode
string
required

"0000" on success. On failure, the code of the first error; all errors are listed in Errors.

Example:

"0000"

Data
object
required

Response data. Null when Success is false.

Message
null | string

Error message when Success is false. Messages of all errors are joined into a single text.