KWNDevelopersالعربيةOpen KWN

API reference

Quotations

Draft quotations, confirmed into exactly one sales order. A quotation costs no credit.

Create a quotation

POST/quotations

Needs
sales.write
Scopes
sales:write

Send an Idempotency-Key header.

A draft quotation. Lines name a product by productId or productCode (SKU, then barcode). Requires Idempotency-Key.

Parameters

FieldTypeDescription
Idempotency-KeyHeaderRequiredstring1 to 100 visible ASCII characters, such as a UUID, unique to this request. Sent again with the same request, the first answer is replayed (Idempotent-Replayed: true); with another request, 422 IDEMPOTENCY_KEY_REUSED.

Request body

29 fields
FieldTypeDescription
linesobject[]
lines[].unitPricenumberWhat it costs; a product needs no product. VAT-exclusive, as stored.
lines[].quantitynumber
lines[].taxRatenumberVAT percent: 5 (standard) or 0 (zero-rated).
lines[].descriptionstring
lines[].productIdstringA product of this company by id …
lines[].productCodestring… or by its internal reference (SKU), then its barcode.
lines[].uomstring
lines[].discountnumberDiscount percent, 0 to 100.
lines[].kindPRODUCT | SECTION | NOTE
customerIdstringRequired on an invoice.
issueDatedateThe document's day, YYYY-MM-DD. Defaults to today.
dueDatedate
expiryDatedateA quotation's expiry day.
customerRefstring
notesstring
paymentTermIdstring
fiscalPositionIdstring
salespersonIdstring
salesTeamIdstring
emirateABU_DHABI | DUBAI | SHARJAH | AJMAN | UMM_AL_QUWAIN | RAS_AL_KHAIMAH | FUJAIRAH
taxModeTAX_EXCLUDED | TAX_INCLUDED
invoiceAddressIdstring
deliveryAddressIdstring
externalIdstringYour system's id for it, kept for good; unique per company. Create only.
paymentMeansCodestringUNCL 4461 payment means, such as 30 (credit transfer).
transactionFlagsFREE_TRADE_ZONE | DEEMED_SUPPLY | MARGIN_SCHEME | SUMMARY_INVOICE | CONTINUOUS_SUPPLY | DISCLOSED_AGENT_BILLING | ECOMMERCE | EXPORTS[]
invoicePeriodStartstring
invoicePeriodEndstring

Code samples

curl -sS -X POST "https://app.kwn.tax/api/v1/quotations" \
  -H "X-Api-Key: $KWN_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "customerId": "cus_4kq9w2m1",
  "issueDate": "2026-10-15",
  "dueDate": "2026-11-14",
  "customerRef": "PO-7781",
  "externalId": "SO-10045",
  "lines": [
    {
      "description": "Office chair, mesh back",
      "quantity": 4,
      "unitPrice": 450,
      "taxRate": 5,
      "productCode": "CHR-MESH-01"
    },
    {
      "description": "Delivery within Dubai",
      "quantity": 1,
      "unitPrice": 100,
      "taxRate": 5
    }
  ]
}'

Responses

  • 201Created
    FieldTypeDescription
    idstring
    typeQUOTATION | ORDER | INVOICE | CREDIT_NOTE | DEBIT_NOTE
    numberstring
    statusDRAFT | SENT | CONFIRMED | ISSUED | SUBMITTED | PROCESSING | APPROVED | REJECTED | FAILED | PAID | CANCELLED | EXPIRED
    issueDatedate
    dueDatedate
    expiryDatedate
    customerobject
    emirateABU_DHABI | DUBAI | SHARJAH | AJMAN | UMM_AL_QUWAIN | RAS_AL_KHAIMAH | FUJAIRAH
    currencystring
    taxModeTAX_EXCLUDED | TAX_INCLUDED
    customerRefstring
    notesstring
    paymentTermIdstring
    fiscalPositionIdstring
    salespersonIdstring
    salesTeamIdstring
    invoiceAddressIdstring
    deliveryAddressIdstring
    linesobject[]
    subtotalnumber
    discountTotalnumber
    taxTotalnumber
    totalnumber
    invoicedTotalnumber
    paidTotalnumber
    creditedTotalnumber
    sourceobject
    derivedobject[]
    originstringAPI, MANUAL, ODOO or POS.
    externalIdstring
    clearanceobject
    eInvoiceobject
    createdAtdate
    updatedAtdate
  • 400Refused: the request or a business rule. The code says which (REQUEST_INVALID, RULE_REFUSED, …).
    Example
    {
      "error": "Lines: at least one line is required.",
      "code": "REQUEST_INVALID"
    }
  • 401No key, a key that is not ours, or one revoked (API_KEY_INVALID); a merchant not active (MERCHANT_INACTIVE).
    Example
    {
      "error": "That API key is not valid, or it was revoked.",
      "code": "API_KEY_INVALID"
    }
  • 403The key's scopes do not carry the capability (APP_NOT_GRANTED, ROLE_TOO_LOW), or the plan lacks the app (APP_LOCKED).
    Example
    {
      "error": "This key's scopes do not include sales.approve.",
      "code": "ROLE_TOO_LOW"
    }
  • 404Not found: another type under this route, or another company's (NOT_FOUND).
    Example
    {
      "error": "Not found.",
      "code": "NOT_FOUND"
    }
  • 409A conflict: an externalId taken, or a change that could not be saved (EXTERNAL_ID_TAKEN, CONFLICT).
    Example
    {
      "error": "That externalId is already used by another record of this company.",
      "code": "EXTERNAL_ID_TAKEN"
    }
  • 422That Idempotency-Key was used for a different request (IDEMPOTENCY_KEY_REUSED).
    Example
    {
      "error": "That Idempotency-Key was used for a different request.",
      "code": "IDEMPOTENCY_KEY_REUSED"
    }
  • 429Too many requests: wait retryAfter seconds (RATE_LIMITED).
    Example
    {
      "error": "Too many requests. Wait a little and try again.",
      "code": "RATE_LIMITED"
    }

List

GET/quotations

Needs
sales.read
Scopes
sales:read

Newest first, a page at a time: send the previous page's next as cursor. Filter by status, partnerId (the customer), issueFrom/issueTo, number, externalId, createdFrom/createdTo, or updatedSince to poll for changes.

Parameters

FieldTypeDescription
statusQuerystringA status, by name.
partnerIdQuerystringThe customer (sales) or the vendor (purchases).
issueFromQuerydateIssued on or after this day.
issueToQuerydateIssued on or before this day.
numberQuerystring
limitQueryinteger1 to 200; 50 by default.
cursorQuerystringThe previous page's next.
updatedSinceQuerydateOnly rows changed at or after this instant.
createdFromQuerydate
createdToQuerydate
externalIdQuerystringOnly the row your system gave this id.

Code samples

curl -sS -X GET "https://app.kwn.tax/api/v1/quotations" \
  -H "X-Api-Key: $KWN_API_KEY"

Responses

  • 200OK
    FieldTypeDescription
    dataobject[]The rows of this page.
    nextstringThe cursor of the next page, to send as ?cursor=; null on the last page.
  • 400Refused: the request or a business rule. The code says which (REQUEST_INVALID, RULE_REFUSED, …).
    Example
    {
      "error": "Lines: at least one line is required.",
      "code": "REQUEST_INVALID"
    }
  • 401No key, a key that is not ours, or one revoked (API_KEY_INVALID); a merchant not active (MERCHANT_INACTIVE).
    Example
    {
      "error": "That API key is not valid, or it was revoked.",
      "code": "API_KEY_INVALID"
    }
  • 403The key's scopes do not carry the capability (APP_NOT_GRANTED, ROLE_TOO_LOW), or the plan lacks the app (APP_LOCKED).
    Example
    {
      "error": "This key's scopes do not include sales.approve.",
      "code": "ROLE_TOO_LOW"
    }
  • 404Not found: another type under this route, or another company's (NOT_FOUND).
    Example
    {
      "error": "Not found.",
      "code": "NOT_FOUND"
    }
  • 409A conflict: an externalId taken, or a change that could not be saved (EXTERNAL_ID_TAKEN, CONFLICT).
    Example
    {
      "error": "That externalId is already used by another record of this company.",
      "code": "EXTERNAL_ID_TAKEN"
    }
  • 429Too many requests: wait retryAfter seconds (RATE_LIMITED).
    Example
    {
      "error": "Too many requests. Wait a little and try again.",
      "code": "RATE_LIMITED"
    }

Update a quotation

PUT/quotations/{id}

Needs
sales.write
Scopes
sales:write

Replaces the header and the lines of a quotation that is still a draft or sent.

Parameters

FieldTypeDescription
idPathRequiredstring

Request body

29 fields
FieldTypeDescription
linesobject[]
lines[].unitPricenumberWhat it costs; a product needs no product. VAT-exclusive, as stored.
lines[].quantitynumber
lines[].taxRatenumberVAT percent: 5 (standard) or 0 (zero-rated).
lines[].descriptionstring
lines[].productIdstringA product of this company by id …
lines[].productCodestring… or by its internal reference (SKU), then its barcode.
lines[].uomstring
lines[].discountnumberDiscount percent, 0 to 100.
lines[].kindPRODUCT | SECTION | NOTE
customerIdstringRequired on an invoice.
issueDatedateThe document's day, YYYY-MM-DD. Defaults to today.
dueDatedate
expiryDatedateA quotation's expiry day.
customerRefstring
notesstring
paymentTermIdstring
fiscalPositionIdstring
salespersonIdstring
salesTeamIdstring
emirateABU_DHABI | DUBAI | SHARJAH | AJMAN | UMM_AL_QUWAIN | RAS_AL_KHAIMAH | FUJAIRAH
taxModeTAX_EXCLUDED | TAX_INCLUDED
invoiceAddressIdstring
deliveryAddressIdstring
externalIdstringYour system's id for it, kept for good; unique per company. Create only.
paymentMeansCodestringUNCL 4461 payment means, such as 30 (credit transfer).
transactionFlagsFREE_TRADE_ZONE | DEEMED_SUPPLY | MARGIN_SCHEME | SUMMARY_INVOICE | CONTINUOUS_SUPPLY | DISCLOSED_AGENT_BILLING | ECOMMERCE | EXPORTS[]
invoicePeriodStartstring
invoicePeriodEndstring

Code samples

curl -sS -X PUT "https://app.kwn.tax/api/v1/quotations/<id>" \
  -H "X-Api-Key: $KWN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "customerId": "cus_4kq9w2m1",
  "issueDate": "2026-10-15",
  "dueDate": "2026-11-14",
  "customerRef": "PO-7781",
  "externalId": "SO-10045",
  "lines": [
    {
      "description": "Office chair, mesh back",
      "quantity": 4,
      "unitPrice": 450,
      "taxRate": 5,
      "productCode": "CHR-MESH-01"
    },
    {
      "description": "Delivery within Dubai",
      "quantity": 1,
      "unitPrice": 100,
      "taxRate": 5
    }
  ]
}'

Responses

  • 200OK
    FieldTypeDescription
    idstring
    typeQUOTATION | ORDER | INVOICE | CREDIT_NOTE | DEBIT_NOTE
    numberstring
    statusDRAFT | SENT | CONFIRMED | ISSUED | SUBMITTED | PROCESSING | APPROVED | REJECTED | FAILED | PAID | CANCELLED | EXPIRED
    issueDatedate
    dueDatedate
    expiryDatedate
    customerobject
    emirateABU_DHABI | DUBAI | SHARJAH | AJMAN | UMM_AL_QUWAIN | RAS_AL_KHAIMAH | FUJAIRAH
    currencystring
    taxModeTAX_EXCLUDED | TAX_INCLUDED
    customerRefstring
    notesstring
    paymentTermIdstring
    fiscalPositionIdstring
    salespersonIdstring
    salesTeamIdstring
    invoiceAddressIdstring
    deliveryAddressIdstring
    linesobject[]
    subtotalnumber
    discountTotalnumber
    taxTotalnumber
    totalnumber
    invoicedTotalnumber
    paidTotalnumber
    creditedTotalnumber
    sourceobject
    derivedobject[]
    originstringAPI, MANUAL, ODOO or POS.
    externalIdstring
    clearanceobject
    eInvoiceobject
    createdAtdate
    updatedAtdate
  • 400Refused: the request or a business rule. The code says which (REQUEST_INVALID, RULE_REFUSED, …).
    Example
    {
      "error": "Lines: at least one line is required.",
      "code": "REQUEST_INVALID"
    }
  • 401No key, a key that is not ours, or one revoked (API_KEY_INVALID); a merchant not active (MERCHANT_INACTIVE).
    Example
    {
      "error": "That API key is not valid, or it was revoked.",
      "code": "API_KEY_INVALID"
    }
  • 403The key's scopes do not carry the capability (APP_NOT_GRANTED, ROLE_TOO_LOW), or the plan lacks the app (APP_LOCKED).
    Example
    {
      "error": "This key's scopes do not include sales.approve.",
      "code": "ROLE_TOO_LOW"
    }
  • 404Not found: another type under this route, or another company's (NOT_FOUND).
    Example
    {
      "error": "Not found.",
      "code": "NOT_FOUND"
    }
  • 409A conflict: an externalId taken, or a change that could not be saved (EXTERNAL_ID_TAKEN, CONFLICT).
    Example
    {
      "error": "That externalId is already used by another record of this company.",
      "code": "EXTERNAL_ID_TAKEN"
    }
  • 429Too many requests: wait retryAfter seconds (RATE_LIMITED).
    Example
    {
      "error": "Too many requests. Wait a little and try again.",
      "code": "RATE_LIMITED"
    }

Read one

GET/quotations/{id}

Needs
sales.read
Scopes
sales:read

The document with its lines, where it came from and what came of it, its e-invoice readiness and, for an invoice or credit note, its clearance. A document of another type under this route is NOT_FOUND.

Parameters

FieldTypeDescription
idPathRequiredstring

Code samples

curl -sS -X GET "https://app.kwn.tax/api/v1/quotations/<id>" \
  -H "X-Api-Key: $KWN_API_KEY"

Responses

  • 200OK
    FieldTypeDescription
    idstring
    typeQUOTATION | ORDER | INVOICE | CREDIT_NOTE | DEBIT_NOTE
    numberstring
    statusDRAFT | SENT | CONFIRMED | ISSUED | SUBMITTED | PROCESSING | APPROVED | REJECTED | FAILED | PAID | CANCELLED | EXPIRED
    issueDatedate
    dueDatedate
    expiryDatedate
    customerobject
    emirateABU_DHABI | DUBAI | SHARJAH | AJMAN | UMM_AL_QUWAIN | RAS_AL_KHAIMAH | FUJAIRAH
    currencystring
    taxModeTAX_EXCLUDED | TAX_INCLUDED
    customerRefstring
    notesstring
    paymentTermIdstring
    fiscalPositionIdstring
    salespersonIdstring
    salesTeamIdstring
    invoiceAddressIdstring
    deliveryAddressIdstring
    linesobject[]
    subtotalnumber
    discountTotalnumber
    taxTotalnumber
    totalnumber
    invoicedTotalnumber
    paidTotalnumber
    creditedTotalnumber
    sourceobject
    derivedobject[]
    originstringAPI, MANUAL, ODOO or POS.
    externalIdstring
    clearanceobject
    eInvoiceobject
    createdAtdate
    updatedAtdate
  • 400Refused: the request or a business rule. The code says which (REQUEST_INVALID, RULE_REFUSED, …).
    Example
    {
      "error": "Lines: at least one line is required.",
      "code": "REQUEST_INVALID"
    }
  • 401No key, a key that is not ours, or one revoked (API_KEY_INVALID); a merchant not active (MERCHANT_INACTIVE).
    Example
    {
      "error": "That API key is not valid, or it was revoked.",
      "code": "API_KEY_INVALID"
    }
  • 403The key's scopes do not carry the capability (APP_NOT_GRANTED, ROLE_TOO_LOW), or the plan lacks the app (APP_LOCKED).
    Example
    {
      "error": "This key's scopes do not include sales.approve.",
      "code": "ROLE_TOO_LOW"
    }
  • 404Not found: another type under this route, or another company's (NOT_FOUND).
    Example
    {
      "error": "Not found.",
      "code": "NOT_FOUND"
    }
  • 409A conflict: an externalId taken, or a change that could not be saved (EXTERNAL_ID_TAKEN, CONFLICT).
    Example
    {
      "error": "That externalId is already used by another record of this company.",
      "code": "EXTERNAL_ID_TAKEN"
    }
  • 429Too many requests: wait retryAfter seconds (RATE_LIMITED).
    Example
    {
      "error": "Too many requests. Wait a little and try again.",
      "code": "RATE_LIMITED"
    }

Confirm into a sales order

POST/quotations/{id}/confirm

Needs
sales.write
Scopes
sales:write

Confirms the quotation into exactly one sales order and answers the order. Confirmed already: alreadyDone with that order. Costs no credit.

Parameters

FieldTypeDescription
idPathRequiredstring

Code samples

curl -sS -X POST "https://app.kwn.tax/api/v1/quotations/<id>/confirm" \
  -H "X-Api-Key: $KWN_API_KEY"

Responses

  • 200OK
    FieldTypeDescription
    alreadyDonebooleanTrue when the document was already where the action takes it; nothing changed.
    documentobject
  • 400Refused: the request or a business rule. The code says which (REQUEST_INVALID, RULE_REFUSED, …).
    Example
    {
      "error": "Lines: at least one line is required.",
      "code": "REQUEST_INVALID"
    }
  • 401No key, a key that is not ours, or one revoked (API_KEY_INVALID); a merchant not active (MERCHANT_INACTIVE).
    Example
    {
      "error": "That API key is not valid, or it was revoked.",
      "code": "API_KEY_INVALID"
    }
  • 403The key's scopes do not carry the capability (APP_NOT_GRANTED, ROLE_TOO_LOW), or the plan lacks the app (APP_LOCKED).
    Example
    {
      "error": "This key's scopes do not include sales.approve.",
      "code": "ROLE_TOO_LOW"
    }
  • 404Not found: another type under this route, or another company's (NOT_FOUND).
    Example
    {
      "error": "Not found.",
      "code": "NOT_FOUND"
    }
  • 409A conflict: an externalId taken, or a change that could not be saved (EXTERNAL_ID_TAKEN, CONFLICT).
    Example
    {
      "error": "That externalId is already used by another record of this company.",
      "code": "EXTERNAL_ID_TAKEN"
    }
  • 429Too many requests: wait retryAfter seconds (RATE_LIMITED).
    Example
    {
      "error": "Too many requests. Wait a little and try again.",
      "code": "RATE_LIMITED"
    }

Cancel a quotation

POST/quotations/{id}/cancel

Needs
sales.write
Scopes
sales:write

Cancelled already: alreadyDone.

Parameters

FieldTypeDescription
idPathRequiredstring

Code samples

curl -sS -X POST "https://app.kwn.tax/api/v1/quotations/<id>/cancel" \
  -H "X-Api-Key: $KWN_API_KEY"

Responses

  • 200OK
    FieldTypeDescription
    alreadyDonebooleanTrue when the document was already where the action takes it; nothing changed.
    documentobject
  • 400Refused: the request or a business rule. The code says which (REQUEST_INVALID, RULE_REFUSED, …).
    Example
    {
      "error": "Lines: at least one line is required.",
      "code": "REQUEST_INVALID"
    }
  • 401No key, a key that is not ours, or one revoked (API_KEY_INVALID); a merchant not active (MERCHANT_INACTIVE).
    Example
    {
      "error": "That API key is not valid, or it was revoked.",
      "code": "API_KEY_INVALID"
    }
  • 403The key's scopes do not carry the capability (APP_NOT_GRANTED, ROLE_TOO_LOW), or the plan lacks the app (APP_LOCKED).
    Example
    {
      "error": "This key's scopes do not include sales.approve.",
      "code": "ROLE_TOO_LOW"
    }
  • 404Not found: another type under this route, or another company's (NOT_FOUND).
    Example
    {
      "error": "Not found.",
      "code": "NOT_FOUND"
    }
  • 409A conflict: an externalId taken, or a change that could not be saved (EXTERNAL_ID_TAKEN, CONFLICT).
    Example
    {
      "error": "That externalId is already used by another record of this company.",
      "code": "EXTERNAL_ID_TAKEN"
    }
  • 429Too many requests: wait retryAfter seconds (RATE_LIMITED).
    Example
    {
      "error": "Too many requests. Wait a little and try again.",
      "code": "RATE_LIMITED"
    }

Print

GET/quotations/{id}/pdf

Needs
sales.read
Scopes
sales:read

The printed document as the app prints it, in English or Arabic (?lang=ar). Counted against the apikey-heavy budget.

Parameters

FieldTypeDescription
idPathRequiredstring
langQuerystring

Code samples

curl -sS -X GET "https://app.kwn.tax/api/v1/quotations/<id>/pdf" \
  -H "X-Api-Key: $KWN_API_KEY"

Responses

  • 200OK
  • 400Refused: the request or a business rule. The code says which (REQUEST_INVALID, RULE_REFUSED, …).
    Example
    {
      "error": "Lines: at least one line is required.",
      "code": "REQUEST_INVALID"
    }
  • 401No key, a key that is not ours, or one revoked (API_KEY_INVALID); a merchant not active (MERCHANT_INACTIVE).
    Example
    {
      "error": "That API key is not valid, or it was revoked.",
      "code": "API_KEY_INVALID"
    }
  • 403The key's scopes do not carry the capability (APP_NOT_GRANTED, ROLE_TOO_LOW), or the plan lacks the app (APP_LOCKED).
    Example
    {
      "error": "This key's scopes do not include sales.approve.",
      "code": "ROLE_TOO_LOW"
    }
  • 404Not found: another type under this route, or another company's (NOT_FOUND).
    Example
    {
      "error": "Not found.",
      "code": "NOT_FOUND"
    }
  • 409A conflict: an externalId taken, or a change that could not be saved (EXTERNAL_ID_TAKEN, CONFLICT).
    Example
    {
      "error": "That externalId is already used by another record of this company.",
      "code": "EXTERNAL_ID_TAKEN"
    }
  • 429Too many requests: wait retryAfter seconds (RATE_LIMITED).
    Example
    {
      "error": "Too many requests. Wait a little and try again.",
      "code": "RATE_LIMITED"
    }