KWNللمطورينEnglishافتح KWN

مرجع الواجهة البرمجية

الإشعارات الدائنة

إشعارات دائنة على فاتورة مخلّصة، تُعتمد وتُخلَّص بالطريقة نفسها.

الأوصاف التقنية أدناه بالإنجليزية كما يولّدها خادم الواجهة، وهي اللغة التي تُكتب بها رسائل الأخطاء أيضًا. العناوين والجداول بالعربية.

تعديل مسودة

PUT/credit-notes/{id}

يتطلب
sales.write
النطاقات
sales:write

Replaces the header and the lines of a draft. Anything past a draft is refused with the app's own sentence (RULE_REFUSED).

المعاملات

الحقلالنوعالوصف
idالمسارإلزاميstring

جسم الطلب

29 حقلًا
الحقلالنوعالوصف
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

أمثلة برمجية

curl -sS -X PUT "https://app.kwn.tax/api/v1/credit-notes/<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
    }
  ]
}'

الاستجابات

  • 200OK
    الحقلالنوعالوصف
    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, …).
    مثال
    {
      "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).
    مثال
    {
      "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).
    مثال
    {
      "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).
    مثال
    {
      "error": "Not found.",
      "code": "NOT_FOUND"
    }
  • 409A conflict: an externalId taken, or a change that could not be saved (EXTERNAL_ID_TAKEN, CONFLICT).
    مثال
    {
      "error": "That externalId is already used by another record of this company.",
      "code": "EXTERNAL_ID_TAKEN"
    }
  • 429Too many requests: wait retryAfter seconds (RATE_LIMITED).
    مثال
    {
      "error": "Too many requests. Wait a little and try again.",
      "code": "RATE_LIMITED"
    }

قراءة مستند

GET/credit-notes/{id}

يتطلب
sales.read
النطاقات
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.

المعاملات

الحقلالنوعالوصف
idالمسارإلزاميstring

أمثلة برمجية

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

الاستجابات

  • 200OK
    الحقلالنوعالوصف
    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, …).
    مثال
    {
      "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).
    مثال
    {
      "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).
    مثال
    {
      "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).
    مثال
    {
      "error": "Not found.",
      "code": "NOT_FOUND"
    }
  • 409A conflict: an externalId taken, or a change that could not be saved (EXTERNAL_ID_TAKEN, CONFLICT).
    مثال
    {
      "error": "That externalId is already used by another record of this company.",
      "code": "EXTERNAL_ID_TAKEN"
    }
  • 429Too many requests: wait retryAfter seconds (RATE_LIMITED).
    مثال
    {
      "error": "Too many requests. Wait a little and try again.",
      "code": "RATE_LIMITED"
    }

طلب الاعتماد من شخص

POST/credit-notes/{id}/request-approval

يتطلب
sales.write
النطاقات
sales:write

Puts a draft in front of a person who may approve it. Not available yet: RULE_REFUSED.

المعاملات

الحقلالنوعالوصف
idالمسارإلزاميstring

أمثلة برمجية

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

الاستجابات

  • 200OK
    الحقلالنوعالوصف
    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, …).
    مثال
    {
      "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).
    مثال
    {
      "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).
    مثال
    {
      "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).
    مثال
    {
      "error": "Not found.",
      "code": "NOT_FOUND"
    }
  • 409A conflict: an externalId taken, or a change that could not be saved (EXTERNAL_ID_TAKEN, CONFLICT).
    مثال
    {
      "error": "That externalId is already used by another record of this company.",
      "code": "EXTERNAL_ID_TAKEN"
    }
  • 429Too many requests: wait retryAfter seconds (RATE_LIMITED).
    مثال
    {
      "error": "Too many requests. Wait a little and try again.",
      "code": "RATE_LIMITED"
    }

الاعتماد للإصدار

POST/credit-notes/{id}/approve

يتطلب
sales.approve
النطاقات
sales:approve

Checks the lock dates, the UAE mandatory fields, the clearance rules and the provider's dry run, and moves the draft to ISSUED. Costs nothing. Approved already: alreadyDone.

المعاملات

الحقلالنوعالوصف
idالمسارإلزاميstring

أمثلة برمجية

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

الاستجابات

  • 200OK
    الحقلالنوعالوصف
    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, …).
    مثال
    {
      "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).
    مثال
    {
      "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).
    مثال
    {
      "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).
    مثال
    {
      "error": "Not found.",
      "code": "NOT_FOUND"
    }
  • 409A conflict: an externalId taken, or a change that could not be saved (EXTERNAL_ID_TAKEN, CONFLICT).
    مثال
    {
      "error": "That externalId is already used by another record of this company.",
      "code": "EXTERNAL_ID_TAKEN"
    }
  • 429Too many requests: wait retryAfter seconds (RATE_LIMITED).
    مثال
    {
      "error": "Too many requests. Wait a little and try again.",
      "code": "RATE_LIMITED"
    }

الإصدار والإرسال للتخليص

POST/credit-notes/{id}/issue

يتطلب
sales.write
النطاقات
sales:write

Takes the document's one credit and queues it for clearance. A draft is approved first when the key holds sales:approve, else APPROVAL_REQUIRED. Sent already: alreadyDone. The answer may say SUBMITTED; poll the document or its clearance for the outcome.

المعاملات

الحقلالنوعالوصف
idالمسارإلزاميstring

أمثلة برمجية

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

الاستجابات

  • 200OK
    الحقلالنوعالوصف
    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, …).
    مثال
    {
      "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).
    مثال
    {
      "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).
    مثال
    {
      "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).
    مثال
    {
      "error": "Not found.",
      "code": "NOT_FOUND"
    }
  • 409A conflict: an externalId taken, or a change that could not be saved (EXTERNAL_ID_TAKEN, CONFLICT).
    مثال
    {
      "error": "That externalId is already used by another record of this company.",
      "code": "EXTERNAL_ID_TAKEN"
    }
  • 429Too many requests: wait retryAfter seconds (RATE_LIMITED).
    مثال
    {
      "error": "Too many requests. Wait a little and try again.",
      "code": "RATE_LIMITED"
    }

إلغاء

POST/credit-notes/{id}/cancel

يتطلب
sales.write
النطاقات
sales:write

A draft, an approved document not yet sent, or a rejected one (its credit is released). A cleared document is credited, never cancelled. Cancelled already: alreadyDone.

المعاملات

الحقلالنوعالوصف
idالمسارإلزاميstring

أمثلة برمجية

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

الاستجابات

  • 200OK
    الحقلالنوعالوصف
    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, …).
    مثال
    {
      "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).
    مثال
    {
      "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).
    مثال
    {
      "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).
    مثال
    {
      "error": "Not found.",
      "code": "NOT_FOUND"
    }
  • 409A conflict: an externalId taken, or a change that could not be saved (EXTERNAL_ID_TAKEN, CONFLICT).
    مثال
    {
      "error": "That externalId is already used by another record of this company.",
      "code": "EXTERNAL_ID_TAKEN"
    }
  • 429Too many requests: wait retryAfter seconds (RATE_LIMITED).
    مثال
    {
      "error": "Too many requests. Wait a little and try again.",
      "code": "RATE_LIMITED"
    }

الإرجاع إلى مسودة

POST/credit-notes/{id}/reset-to-draft

يتطلب
sales.write
النطاقات
sales:write

A rejected or failed document opens again for correction. A draft already: alreadyDone.

المعاملات

الحقلالنوعالوصف
idالمسارإلزاميstring

أمثلة برمجية

curl -sS -X POST "https://app.kwn.tax/api/v1/credit-notes/<id>/reset-to-draft" \
  -H "X-Api-Key: $KWN_API_KEY"

الاستجابات

  • 200OK
    الحقلالنوعالوصف
    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, …).
    مثال
    {
      "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).
    مثال
    {
      "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).
    مثال
    {
      "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).
    مثال
    {
      "error": "Not found.",
      "code": "NOT_FOUND"
    }
  • 409A conflict: an externalId taken, or a change that could not be saved (EXTERNAL_ID_TAKEN, CONFLICT).
    مثال
    {
      "error": "That externalId is already used by another record of this company.",
      "code": "EXTERNAL_ID_TAKEN"
    }
  • 429Too many requests: wait retryAfter seconds (RATE_LIMITED).
    مثال
    {
      "error": "Too many requests. Wait a little and try again.",
      "code": "RATE_LIMITED"
    }

حالة التخليص

GET/credit-notes/{id}/clearance

يتطلب
sales.read
النطاقات
sales:read

Where the document stands with e-invoicing clearance: status, provider reference, attempts and the provider's errors.

المعاملات

الحقلالنوعالوصف
idالمسارإلزاميstring

أمثلة برمجية

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

الاستجابات

  • 200OK
    الحقلالنوعالوصف
    statusstringThe document's status: SUBMITTED, PROCESSING, APPROVED (cleared), REJECTED, FAILED, …
    routestringTAXSTAR, LOCAL_B2C or LOCAL_CREDIT_NOTE; null before it is issued.
    providerobject
    providerCodestring
    referencestringThe provider's or the FTA's reference once cleared.
    submittedAtdate
    lastCheckedAtdate
    clearedAtdate
    attemptsinteger
    errorCodestring
    errorstring
    errorsobject[]
    deliverystring
    canRetryboolean
    canRefreshboolean
  • 400Refused: the request or a business rule. The code says which (REQUEST_INVALID, RULE_REFUSED, …).
    مثال
    {
      "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).
    مثال
    {
      "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).
    مثال
    {
      "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).
    مثال
    {
      "error": "Not found.",
      "code": "NOT_FOUND"
    }
  • 409A conflict: an externalId taken, or a change that could not be saved (EXTERNAL_ID_TAKEN, CONFLICT).
    مثال
    {
      "error": "That externalId is already used by another record of this company.",
      "code": "EXTERNAL_ID_TAKEN"
    }
  • 429Too many requests: wait retryAfter seconds (RATE_LIMITED).
    مثال
    {
      "error": "Too many requests. Wait a little and try again.",
      "code": "RATE_LIMITED"
    }

الإرسال مرة أخرى

POST/credit-notes/{id}/clearance/retry

يتطلب
sales.write
النطاقات
sales:write

A FAILED document is sent to the provider again, with no second credit.

المعاملات

الحقلالنوعالوصف
idالمسارإلزاميstring

أمثلة برمجية

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

الاستجابات

  • 200OK
    الحقلالنوعالوصف
    statusstringThe document's status: SUBMITTED, PROCESSING, APPROVED (cleared), REJECTED, FAILED, …
    routestringTAXSTAR, LOCAL_B2C or LOCAL_CREDIT_NOTE; null before it is issued.
    providerobject
    providerCodestring
    referencestringThe provider's or the FTA's reference once cleared.
    submittedAtdate
    lastCheckedAtdate
    clearedAtdate
    attemptsinteger
    errorCodestring
    errorstring
    errorsobject[]
    deliverystring
    canRetryboolean
    canRefreshboolean
  • 400Refused: the request or a business rule. The code says which (REQUEST_INVALID, RULE_REFUSED, …).
    مثال
    {
      "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).
    مثال
    {
      "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).
    مثال
    {
      "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).
    مثال
    {
      "error": "Not found.",
      "code": "NOT_FOUND"
    }
  • 409A conflict: an externalId taken, or a change that could not be saved (EXTERNAL_ID_TAKEN, CONFLICT).
    مثال
    {
      "error": "That externalId is already used by another record of this company.",
      "code": "EXTERNAL_ID_TAKEN"
    }
  • 429Too many requests: wait retryAfter seconds (RATE_LIMITED).
    مثال
    {
      "error": "Too many requests. Wait a little and try again.",
      "code": "RATE_LIMITED"
    }

سؤال المزوّد الآن

POST/credit-notes/{id}/clearance/refresh

يتطلب
sales.write
النطاقات
sales:write

Asks the provider for the outcome of a PROCESSING document now. At most every 30 seconds: REFRESH_TOO_SOON with retryAfter.

المعاملات

الحقلالنوعالوصف
idالمسارإلزاميstring

أمثلة برمجية

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

الاستجابات

  • 200OK
    الحقلالنوعالوصف
    statusstringThe document's status: SUBMITTED, PROCESSING, APPROVED (cleared), REJECTED, FAILED, …
    routestringTAXSTAR, LOCAL_B2C or LOCAL_CREDIT_NOTE; null before it is issued.
    providerobject
    providerCodestring
    referencestringThe provider's or the FTA's reference once cleared.
    submittedAtdate
    lastCheckedAtdate
    clearedAtdate
    attemptsinteger
    errorCodestring
    errorstring
    errorsobject[]
    deliverystring
    canRetryboolean
    canRefreshboolean
  • 400Refused: the request or a business rule. The code says which (REQUEST_INVALID, RULE_REFUSED, …).
    مثال
    {
      "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).
    مثال
    {
      "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).
    مثال
    {
      "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).
    مثال
    {
      "error": "Not found.",
      "code": "NOT_FOUND"
    }
  • 409A conflict: an externalId taken, or a change that could not be saved (EXTERNAL_ID_TAKEN, CONFLICT).
    مثال
    {
      "error": "That externalId is already used by another record of this company.",
      "code": "EXTERNAL_ID_TAKEN"
    }
  • 429Too many requests: wait retryAfter seconds (RATE_LIMITED).
    مثال
    {
      "error": "Too many requests. Wait a little and try again.",
      "code": "RATE_LIMITED"
    }

عرض القائمة

GET/credit-notes

يتطلب
sales.read
النطاقات
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.

المعاملات

الحقلالنوعالوصف
statusالاستعلامstringA status, by name.
partnerIdالاستعلامstringThe customer (sales) or the vendor (purchases).
issueFromالاستعلامdateIssued on or after this day.
issueToالاستعلامdateIssued on or before this day.
numberالاستعلامstring
limitالاستعلامinteger1 to 200; 50 by default.
cursorالاستعلامstringThe previous page's next.
updatedSinceالاستعلامdateOnly rows changed at or after this instant.
createdFromالاستعلامdate
createdToالاستعلامdate
externalIdالاستعلامstringOnly the row your system gave this id.

أمثلة برمجية

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

الاستجابات

  • 200OK
    الحقلالنوعالوصف
    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, …).
    مثال
    {
      "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).
    مثال
    {
      "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).
    مثال
    {
      "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).
    مثال
    {
      "error": "Not found.",
      "code": "NOT_FOUND"
    }
  • 409A conflict: an externalId taken, or a change that could not be saved (EXTERNAL_ID_TAKEN, CONFLICT).
    مثال
    {
      "error": "That externalId is already used by another record of this company.",
      "code": "EXTERNAL_ID_TAKEN"
    }
  • 429Too many requests: wait retryAfter seconds (RATE_LIMITED).
    مثال
    {
      "error": "Too many requests. Wait a little and try again.",
      "code": "RATE_LIMITED"
    }

طباعة

GET/credit-notes/{id}/pdf

يتطلب
sales.read
النطاقات
sales:read

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

المعاملات

الحقلالنوعالوصف
idالمسارإلزاميstring
langالاستعلامstring

أمثلة برمجية

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

الاستجابات

  • 200OK
  • 400Refused: the request or a business rule. The code says which (REQUEST_INVALID, RULE_REFUSED, …).
    مثال
    {
      "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).
    مثال
    {
      "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).
    مثال
    {
      "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).
    مثال
    {
      "error": "Not found.",
      "code": "NOT_FOUND"
    }
  • 409A conflict: an externalId taken, or a change that could not be saved (EXTERNAL_ID_TAKEN, CONFLICT).
    مثال
    {
      "error": "That externalId is already used by another record of this company.",
      "code": "EXTERNAL_ID_TAKEN"
    }
  • 429Too many requests: wait retryAfter seconds (RATE_LIMITED).
    مثال
    {
      "error": "Too many requests. Wait a little and try again.",
      "code": "RATE_LIMITED"
    }