> ## Documentation Index
> Fetch the complete documentation index at: https://apidocs.noyax.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Quotes

> Fields and rules of purchase and sales quotes.

A quote has a header and one or more lines. Purchase quotes (`QuoteType` 1) and sales quotes (`QuoteType` 2) use the same endpoints.

| Operation   | Endpoint                                                              |
| ----------- | --------------------------------------------------------------------- |
| List        | [`GET /quotes`](/en/v1/quotes/list)                                   |
| Get         | [`GET /quotes/{quoteId}`](/en/v1/quotes/get)                          |
| Create      | [`POST /quotes`](/en/v1/quotes/create)                                |
| Update      | [`PUT /quotes/{quoteId}`](/en/v1/quotes/update)                       |
| Delete      | [`DELETE /quotes/{quoteId}`](/en/v1/quotes/delete)                    |
| Line groups | [`GET /definitions/line-groups`](/en/v1/definitions/line-groups/list) |

<Warning>
  **The API does not calculate amounts and does not check that they are consistent.** Line amounts, discount amounts, VAT, additional taxes, withholding, quote totals and the weighted average exchange rate are stored exactly as you send them. How Noyax calculates them is described on the [calculations](/en/v1/quotes/calculations) page; follow it so that quotes created through the API add up like quotes created in Noyax.
</Warning>

## Required fields

* `QuoteType`: `1` purchase quote, `2` sales quote. It cannot be changed after the quote is created (`5015`).
* `QuoteNumber`: unique within the company for the same `QuoteType`, at most 10 characters (`5002`). Send `"Next"` on create to generate it from the company's number series: **ALTEKLİFNO** for purchase quotes and **VERTEKLİFNO** for sales quotes. `"Next"` cannot be sent on update (`5003`).
* `Date`: the quote date. If you send a time it is stored as the quote time, otherwise the current time is used.
* `CustomerId`: a customer the user can see. `RepresentativeId` is optional and must be a representative of that customer.
* `CurrencyId`: the quote currency.
* `Lines`: at least one line (`5012`).

## Lines

* `ProductId` and `UnitId` are 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.
* `CurrencyId` of a line defaults to the quote currency; `ExchangeRate` is the rate of the line currency.
* `Discounts` is the list of discount rates of the line. They are applied one after another in list order: 10, 10 and 10 give a 27.1% line discount. Leave the list empty when the line has no discount.
* `LineGroupId` is optional and comes from the [line groups](/en/v1/definitions/line-groups/list) definition.
* Lines have no ID: their order in the list is their order in the quote, and update replaces all lines.

## Status

`Status` is read-only.

| Value | Meaning  |
| ----- | -------- |
| `0`   | Pending  |
| `1`   | Accepted |
| `2`   | Revised  |
| `3`   | Rejected |

Quotes created through the API are always `0` (pending), and update never changes the status. Quotes accepted, revised or rejected in Noyax show that status here.

## Editing and deleting

Editing and deleting are not restricted by status: a quote can be updated or deleted whatever its status is, even if it was already converted to an order, invoice or waybill in Noyax. Noyax only asks the user to confirm in that case; the API has no such confirmation, so check on your side before changing such quotes. A quote that other records refer to (for example a service slip or an opportunity) cannot be deleted (`5014`).

## Sharing

`SharingCodeId` limits who can see the quote: empty means everyone, otherwise it must be one of the user's [sharing codes](/en/v1/guides/sharing-codes) (`5011`). Quotes the user cannot see return 404.
