Validates a document (invoice, quote, proforma invoice, receipt or credit note) and returns editor_url, a short link that opens it prefilled in the LuckPanda editor, where the person can review, edit and download the PDF. Also returns the totals with tax worked out, the required fields still missing and any parts left out as invalid. Side effect: the document is stored on LuckPanda's servers for 7 days under a random link id (not listed or indexed), and every call creates a new link. Nothing is issued, numbered or sent. Use details the person gave; do not invent them.
View input schema
{
"type": "object",
"properties": {
"page": {
"type": "string",
"description": "The page to open: a slug (\"credit-note\", \"gst-invoice-format\") or its URL. Default: the generator for the document type and country."
},
"doc": {
"type": "object",
"description": "A document to prefill. Parts that fail validation are left out and listed in `ignored`; nothing is ever rendered as HTML.",
"properties": {
"kind": {
"type": "string",
"enum": [
"invoice",
"quote",
"proforma",
"credit_note",
"receipt"
],
"description": "Document type."
},
"country_code": {
"type": "string",
"enum": [
"US",
"GB",
"DE",
"FR",
"NL",
"IE",
"AE",
"SG",
"AU",
"CA",
"IN",
"ES",
"IT",
"BE",
"AT",
"PT",
"FI",
"MX",
"BR"
],
"description": "The seller's country: decides currency, formats and tax rules. If missing: the currency's country (INR -> IN, GBP -> GB …; EUR -> DE unless the caller is in a euro country), else the caller's country."
},
"currency": {
"type": "string",
"enum": [
"USD",
"EUR",
"GBP",
"INR",
"AED",
"SGD",
"AUD",
"CAD",
"MXN",
"BRL"
],
"description": "ISO 4217 code. If missing: the seller country's currency."
},
"seller": {
"type": "object",
"description": "Your business (who issues the document; for a receipt, who received the money).",
"properties": {
"name": {
"type": "string",
"maxLength": 200
},
"address": {
"type": "string",
"maxLength": 600,
"description": "New lines as \\n."
},
"email": {
"type": "string",
"maxLength": 200
},
"tax_id": {
"type": "string",
"maxLength": 60,
"description": "GSTIN (India), VAT number (UK/EU), EIN (US), ABN, TRN..."
},
"country_code": {
"type": "string",
"pattern": "^[A-Za-z]{2}$",
"description": "Buyer only; the seller's country is the document's country_code."
},
"state_code": {
"type": "string",
"description": "India: two-digit GST state code or the state name."
}
}
},
"buyer": {
"type": "object",
"description": "The client (for a receipt, who paid).",
"properties": {
"name": {
"type": "string",
"maxLength": 200
},
"address": {
"type": "string",
"maxLength": 600,
"description": "New lines as \\n."
},
"email": {
"type": "string",
"maxLength": 200
},
"tax_id": {
"type": "string",
"maxLength": 60,
"description": "GSTIN (India), VAT number (UK/EU), EIN (US), ABN, TRN..."
},
"country_code": {
"type": "string",
"pattern": "^[A-Za-z]{2}$",
"description": "Buyer only; the seller's country is the document's country_code."
},
"state_code": {
"type": "string",
"description": "India: two-digit GST state code or the state name."
}
}
},
"issue_date": {
"type": "string",
"pattern": "^\\d{4}-\\d{2}-\\d{2}$",
"description": "YYYY-MM-DD. Default: today."
},
"due_date": {
"type": [
"string",
"null"
],
"pattern": "^\\d{4}-\\d{2}-\\d{2}$",
"description": "Due date; for a quote, valid until."
},
"lines": {
"type": "array",
"maxItems": 100,
"items": {
"type": "object",
"properties": {
"description": {
"type": "string",
"maxLength": 500
},
"quantity": {
"type": [
"string",
"number"
],
"description": "Decimal, up to 6 decimals (\"1\", \"2.5\")."
},
"unit_price_minor": {
"type": "integer",
"minimum": 0,
"description": "Price per unit in minor units (cents, paise)."
},
"unit_price": {
"type": [
"string",
"number"
],
"description": "Alternative: price per unit in major units (\"1250.50\")."
},
"tax_rate_bp": {
"type": "integer",
"minimum": 0,
"maximum": 10000,
"description": "Tax rate in basis points: 18% = 1800."
},
"tax_percent": {
"type": [
"string",
"number"
],
"description": "Alternative: tax rate in percent (18)."
},
"unit_code": {
"type": "string",
"description": "unit | hour | day | month | item"
},
"discount_minor": {
"type": "integer",
"minimum": 0
},
"hsn_sac": {
"type": "string",
"description": "India: HSN (goods, 4/6/8 digits) or SAC (services, 6 digits starting 99)."
}
}
},
"description": "The items or services, 1 to 100 lines."
},
"notes": {
"type": "string",
"maxLength": 2000,
"description": "Shown on the document, for example a thank-you or a delivery note."
},
"terms": {
"type": "string",
"maxLength": 2000,
"description": "Payment terms and bank details; for a quote, validity and delivery terms."
},
"place_of_supply": {
"type": "string",
"description": "India: GST state code, or 96 for another country."
},
"export_type": {
"type": "string",
"enum": [
"none",
"lut",
"with_payment"
],
"description": "India, buyer abroad."
},
"original_invoice_number": {
"type": "string",
"maxLength": 40,
"description": "Credit notes: the invoice it corrects."
},
"original_invoice_date": {
"type": "string",
"pattern": "^\\d{4}-\\d{2}-\\d{2}$"
},
"reason": {
"type": "string",
"description": "Credit notes: refund, product_return, discount, price_correction, defect, cancellation, tax_correction, other, or the reason in your own words."
},
"reason_note": {
"type": "string",
"maxLength": 500
}
}
}
},
"required": [
"doc"
]
}