Credit Note

POST/v1/credit-note

Issue professional credit notes and refund documents as PDF with a single API call.

Headers

HeaderValueRequired
AuthorizationBearer YOUR_API_KEYYes
Content-Typeapplication/jsonYes

Request Body

json
{
"credit_note_number": "CN-001",
"date": "2026-03-09",
"currency": "USD",
"invoice_number": "INV-045",
"reason": "Goods returned — defective items",
"from": {
"name": "Acme Digital Agency",
"email": "billing@acme.agency",
"address": "123 Creative Blvd\nSan Francisco, CA 94102"
},
"to": {
"name": "TechStart Inc.",
"email": "accounts@techstart.io",
"address": "456 Innovation Drive\nAustin, TX 73301"
},
"items": [
{
"description": "Website Redesign — UX Phase (returned scope)",
"quantity": 1,
"unit_price": 3500
},
{
"description": "Unused design assets",
"quantity": 5,
"unit_price": 200,
"tax": { "rate": 10 }
}
],
"tax": { "rate": 8.25 },
"notes": "This credit references INV-045. Amount will be applied to your next invoice."
}

Fields

FieldTypeRequiredDescription
credit_note_numberstringYesUnique credit note identifier (e.g. "CN-001")
datestringYesIssue date (e.g. "2026-03-09")
currencystringYesCurrency code (e.g. "USD", "EUR", "AZN")
fromobjectYesYour company info
from.namestringYesCompany name
from.emailstringNoCompany email
from.addressstringNoCompany address
itemsarrayYesCredited line items (at least 1)
items[].descriptionstringYesItem description
items[].quantitynumberYesQuantity (must be > 0)
items[].unit_pricenumberYesUnit price (must be >= 0)
items[].taxobjectNoItem-level tax
items[].tax.ratenumberNoTax rate % for this item
invoice_numberstringNoReference to the original invoice (e.g. "INV-045")
reasonstringNoReason for credit (e.g. "Goods returned", "Overcharge correction")
toobjectNoClient info
to.namestringNoClient name
to.emailstringNoClient email
to.addressstringNoClient address
taxobjectNoInvoice-level tax
tax.ratenumberNoTax rate % applied to all items
directionstringNoText direction: "ltr" (default) or "rtl" for Arabic/Hebrew
languagestringNoLanguage hint: "ar", "he", "fa", etc. Optional metadata
notesstringNoAdditional notes

Full Example

bash
curl -X POST https://api.kagyz.com/v1/credit-note \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"credit_note_number": "CN-001",
"date": "2026-03-09",
"currency": "USD",
"invoice_number": "INV-045",
"reason": "Goods returned — defective items",
"from": {
"name": "Acme Digital Agency",
"email": "billing@acme.agency",
"address": "123 Creative Blvd\nSan Francisco, CA 94102"
},
"to": {
"name": "TechStart Inc.",
"email": "accounts@techstart.io",
"address": "456 Innovation Drive\nAustin, TX 73301"
},
"items": [
{
"description": "Website Redesign — UX Phase (returned scope)",
"quantity": 1,
"unit_price": 3500
},
{
"description": "Unused design assets",
"quantity": 5,
"unit_price": 200,
"tax": { "rate": 10 }
}
],
"tax": { "rate": 8.25 },
"notes": "This credit references INV-045. Amount will be applied to your next invoice."
}' \
--output credit-note.pdf
javascript
const response = await fetch('https://api.kagyz.com/v1/credit-note', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
credit_note_number: 'CN-001',
date: '2026-03-09',
currency: 'USD',
invoice_number: 'INV-045',
reason: 'Goods returned — defective items',
from: {
name: 'Acme Digital Agency',
email: 'billing@acme.agency',
address: '123 Creative Blvd\nSan Francisco, CA 94102'
},
to: {
name: 'TechStart Inc.',
email: 'accounts@techstart.io'
},
items: [
{ description: 'Website Redesign — UX Phase (returned scope)', quantity: 1, unit_price: 3500 },
{ description: 'Unused design assets', quantity: 5, unit_price: 200, tax: { rate: 10 } }
],
tax: { rate: 8.25 },
notes: 'This credit references INV-045. Amount will be applied to your next invoice.'
})
});
const blob = await response.blob();
// Save or send the PDF

Invoice Reference

If you provide invoice_number, the credit note PDF will display it as a reference linking back to the original invoice. This is recommended for audit trails and proper accounting.

json
{
"invoice_number": "INV-045",
"credit_note_number": "CN-001",
"date": "2026-03-09",
"currency": "USD",
"from": { "name": "Acme Corp" },
"items": [
{ "description": "Refunded item", "quantity": 1, "unit_price": 500 }
]
}

The reference appears on the PDF as “Reference: INV-045”.

Reason

The reason field lets you specify why the credit note was issued. Common reasons include:

  • Goods returned
  • Overcharge correction
  • Order cancelled
  • Pricing error
  • Duplicate payment
json
{
"reason": "Goods returned — defective items",
"credit_note_number": "CN-001",
"date": "2026-03-09",
"currency": "USD",
"from": { "name": "Acme Corp" },
"items": [
{ "description": "Refunded item", "quantity": 1, "unit_price": 500 }
]
}

Minimal Example

Only required fields — no invoice reference, no reason, no tax, no client details:

bash
curl -X POST https://api.kagyz.com/v1/credit-note \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"credit_note_number": "CN-002",
"date": "2026-03-09",
"currency": "USD",
"from": { "name": "Quick Services" },
"items": [
{ "description": "Service credit", "quantity": 1, "unit_price": 150 }
]
}' \
--output credit-note.pdf

Tax Rates

Tax works the same as Invoice, Receipt, and Quote:

  1. 1. If an item has items[].tax — that rate is used
  2. 2. If an item has no items[].tax — the credit note-level tax is used
  3. 3. If neither is set — no tax (0%)
Item-level tax overrides credit note-level tax for that item.

Mixed Tax Rates Example

json
{
"tax": { "rate": 10 },
"items": [
{ "description": "Returned hardware", "quantity": 1, "unit_price": 3000, "tax": { "rate": 20 } },
{ "description": "Service credit", "quantity": 1, "unit_price": 800 },
{ "description": "Exempt adjustment", "quantity": 1, "unit_price": 500, "tax": { "rate": 0 } }
]
}
ItemTax RateReason
Returned hardware20%Uses item-level tax
Service credit10%Falls back to credit note-level tax
Exempt adjustment0%Uses item-level tax (explicitly 0)

Response

Success (200)

  • Content-Type: application/pdf
  • Body: PDF binary data

Errors

StatusBody
400{ "error": "credit_note_number is required" }
401{ "error": "Invalid API key" }
429{ "error": "Monthly limit reached. Please upgrade." }

All Five Endpoints

DocumentEndpointKey Fields
InvoicePOST /v1/invoiceinvoice_number, issue_date, due_date
ReceiptPOST /v1/receiptreceipt_number, date, payment_method, transaction_id
QuotePOST /v1/quotequote_number, date, expiry_date, title
Credit NotePOST /v1/credit-notecredit_note_number, date, invoice_number, reason
Packing SlipPOST /v1/packing-slippacking_slip_number, date, order_number, shipping_method, tracking_number

Credit notes reference original invoices. See the Invoice API docs →

Send this document via email → See Email Delivery

Supports Arabic & RTL → See docs

Every generated PDF is automatically stored and gets a shareable URL. Check the X-Kagyz-Document-URL response header. Learn more →