Send a credit note

Send a credit note, which reduces or cancels an invoice, and report it to the FTA.

A credit note takes the same journey as an invoice (see POST /invoices):
Wafeq checks it, delivers it to the buyer's e-invoicing provider or reports it
to the FTA only, and reports it to the FTA. Wafeq files it as a tax credit note
(381) or a commercial credit note (81).

Say which invoice it credits. For an invoice sent through Wafeq, send its
document_id in previous_document_id. For one issued elsewhere, set
previous_invoice_source to external and send its number, and its issue date
if you have it; keep the original's records in your own system. A volume
discount (credit_note_reason_code VD) credits no single invoice. To cancel an
invoice in full, POST /invoices/{invoice_id}/void builds the credit note for you.

Live mode needs an active subscription for your organization: without one you
get 402 (subscription_required). If Wafeq can't confirm the billing status
just then, you get 503 (billing_status_unavailable): try again shortly.
Sandbox needs no subscription.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Body Params

A credit note, which reduces or cancels an invoice. Wafeq files it as a tax credit note (381), or as a
commercial credit note (81) by the same rules as an invoice. A credit note for an invoice sent through
Wafeq takes that invoice's type instead: 381 for a 380, 81 for a 480. The seller is the taxpayer; you send
the buyer in customer. A credit note has no due date and no payment means.

string
enum
Defaults to ap

Where the invoice being credited was issued. ap (the default): through Wafeq; send its previous_document_id. external: elsewhere, e.g. in your previous system or through another e-invoicing provider; send its previous_invoice_number, and its previous_invoice_issue_date if you have it, and keep the original's records yourself. Marking an invoice external doesn't mean the FTA accepts credit notes for invoices issued before e-invoicing started.

Allowed:
string | null

The document_id Wafeq returned for the invoice being credited (inv_…), not its document_uuid. Required when previous_invoice_source is ap.

string | null

Number of the invoice being credited. Send it only when previous_invoice_source is external; for an invoice sent through Wafeq, Wafeq fills it in.

string | null

Issue date of the invoice being credited, YYYY-MM-DD. Optional, and only for external invoices.

string | null

Only to correct a document the buyer's e-invoicing provider rejected as invalid (delivery_status rejected, with reason BV or SV): that document's document_id. Wafeq takes care of the rejected document's report to the FTA, withdrawing it where needed. Send the corrected document in full to the same endpoint, with the same number, and a new Idempotency-Key; it must be filed as the same document type. A correction is always queued (202). If Wafeq is still handling the rejected document's report, you get 409 correction_not_ready: send the same request again later, with the same key. A correction is a new document and must satisfy current issuance rules. A VAT-registered seller cannot correct an older 480/81 with exempt (E) or zero-rated (Z) supplies into another commercial document; the O-only restriction still applies.

metadata
object

Your own string key-value pairs: up to 100 keys, 100 characters per key, 16 KiB in total. Kept apart from the e-invoice and never sent to Peppol or the FTA.

string | null

Issue date, YYYY-MM-DD. Defaults to today.

string
length ≤ 64
^pint:(billing|selfbilling)-1(@ae-1)?\*?$
Defaults to pint:billing-1@ae-1

The Peppol profile the document is sent under. Leave the default.

string
^(ALWAYS_SEND|FAILURE_ONLY)$
Defaults to ALWAYS_SEND

Whether the buyer's e-invoicing provider sends a delivery confirmation for every document (ALWAYS_SEND, the default and recommended) or only when it rejects one (FAILURE_ONLY).

string
length between 3 and 3
Defaults to AED

Currency of the amounts, as an ISO 4217 code. Defaults to AED. Other currencies require currency_exchange_rate.

> 0

AED per one unit of document currency. A finite positive decimal with at most 6 decimal places, required when currency is not AED; ignored for AED documents. For example, 3.6725 means 1 USD = 3.6725 AED on a USD document. Wafeq multiplies the published document-currency VAT and total including VAT by this rate, then rounds each AED amount to 2 decimal places, half up. Send a decimal string to retain the rate's exact precision.

string
enum
Defaults to TAX_EXCLUSIVE

Whether unit prices and all discount/charge amounts and percentage bases exclude VAT (TAX_EXCLUSIVE, the default) or include it (TAX_INCLUSIVE). With TAX_INCLUSIVE, Wafeq e-invoicing ASP converts these inputs to amounts before VAT, then calculates VAT and totals as usual, and makes the amount due what you charge. Line quotes include any separate discounts and charges and are rounded to 2 decimal places, half up, then document adjustments are applied. Line adjustments use the line's VAT rate; document adjustments use their own rate. Any difference from the total including VAT appears on the e-invoice as a rounding amount. For example, one line of 0.10 including 5% VAT has an amount before VAT of 0.10 and VAT of 0.01, so the total including VAT is 0.11 and the amount due is 0.10. The e-invoice always shows prices and amounts before VAT.

Allowed:
string | null

The buyer's reference for the purchase, e.g. its purchase order number.

string | null

Your own ID for this document, e.g. the invoice's ID in your system. Wafeq stores it and sends it back in every document.* webhook, so you can match events to your records.

string | null

A free-text note on the document.

string
^[01]{8}$
Defaults to 00000000

Special scenarios that apply to the sale, as 8 flags. Each position is one scenario, left to right: free zone, deemed supply (goods or services given away or used privately, which VAT treats as a sale), margin scheme (second-hand goods taxed only on the seller's margin), summary invoice (one invoice for several supplies over a period), continuous supply, disclosed agent billing, e-commerce, export. 1 means the scenario applies, 0 that it doesn't; several can apply at once. The default 00000000 means none; 00000001 is an export. A summary invoice needs invoice_period; an export or an e-commerce sale needs delivery_address. Free zone requires beneficiary, disclosed agent billing requires principal, and margin scheme requires category N at tax_percent: 5 on every line, with no VAT added.

invoice_period
object

The period the document covers. Required on a summary invoice (the 4th flag of transaction_type_code).

beneficiary
object

The beneficiary of the supply. Required only when the free-zone transaction flag (position 1) is set; refused without that flag. The beneficiary may be the buyer.

principal
object

The principal the seller acts for. Required only when the disclosed-agent-billing transaction flag (position 6) is set; refused without that flag. Its TRN must differ from the seller's TRN.

line_items
array of objects
required
length between 1 and 1000

The document's lines: 1 to 1000. The maximum is an API capacity limit, not a UAE regulatory limit.

Line Items*
discounts
array of objects
length ≤ 100

Discounts on the whole document, after line discounts. Amounts and bases follow tax_amount_type. Give each entry its VAT category and rate.

Discounts
charges
array of objects
length ≤ 100

Charges on the whole document, after line charges. Amounts and bases follow tax_amount_type. Give each entry its VAT category and rate.

Charges
customer
object
required

The buyer.

delivery_address
object

Where the goods or services are actually delivered. Required for an export (services included), where it must be outside the UAE, and for an e-commerce sale. Wafeq never copies it from the buyer's address.

string
required
length ≤ 64

Your credit note number. Unique among the taxpayer's documents: a number already sent is refused (duplicate_number).

string | null

Why the credit note is issued: DL8.61.1.A to DL8.61.1.E (the cases of Article 61(1) of the UAE VAT law), or VD for a volume discount, which credits no single invoice: send no invoice reference with it. Defaults to DL8.61.1.A.

string | null
enum

The type the credit note must be filed as: 381 tax credit note or 81 commercial credit note (outside the scope of VAT). Optional: leave it out and Wafeq e-invoicing ASP picks the type. A supplied type is never switched. A type incompatible with the seller, supplies or original invoice is refused with 422 (document_type_mismatch), e.g. a 381 for an invoice filed as 480. For a VAT-registered seller, 81 requires every line, document discount and charge to be out of scope (O), including when crediting an older 480. Compatible types still undergo official validation: E-only and mixed E/O tax credit notes currently fail with SCH:ibr-151-ae.

Allowed:
Headers
string | null
^[\x21-\x7e]+$

Makes the send safe to repeat: send the same body with the same key again and you get the first answer back, and nothing is sent twice. Use one key per version of the document; a changed body needs a new key. Required for a document reported to the FTA only, for queued delivery (Prefer: respond-async) and with corrects_document_id, so send one every time. Keys are scoped to the taxpayer and your organization, and never expire.

string | null
enum

respond-async asks for queued delivery: Wafeq accepts the document and answers 202 straight away, then delivers it in the background. Needs Idempotency-Key. Without it, the call waits until the delivery to the buyer's provider has finished.

Allowed:
string | null
string
required

Taxpayer ID (txpay_…). Required with an organization API key (pk_…) for this taxpayer-specific operation, even for one taxpayer. Not a TIN. Optional with a taxpayer access token, which already names its taxpayer.

string | null

Grant ID (tgr_…) to act through, with an organization API key. The request then has exactly that grant's scopes and fails once the grant is revoked. Without it, the key acts through all of the organization's active grants on the taxpayer.

Responses

409

Conflict; detail.code says which. idempotency_key_reused: the key was used before with a different body; use a new key for a changed document. idempotency_in_progress or idempotency_unconfirmed: an earlier send with this key hasn't settled yet; wait, then send the same body with the same key. document_already_submitted: a document with this number was already accepted; follow it instead of sending it again. correction_not_ready: Wafeq is still handling the rejected document's report to the FTA; send the same correction again later, with the same key.

503

A temporary problem, e.g. the buyer couldn't be looked up on Peppol just now (smp_unavailable), the billing status couldn't be confirmed (billing_status_unavailable), or the send couldn't be saved (idempotency_unavailable). Send it again later with the same Idempotency-Key, never a new one, so it can't be sent twice. queued_delivery_unavailable means new queued delivery is unavailable (for example, disabled): submit without Prefer: respond-async, or retry once queued delivery is enabled. A key already reserved for queued delivery keeps that delivery mode; completed keys still replay.

Language
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json