create_invoice
Create a Thai e-Tax Invoice / Tax Invoice (ใบกำกับภาษี) through Leceipt — the POST /etax/documents/invoices-taxinvoices call. You pass the buyer + line items in plain fields; this server computes the Thai VAT 7% math locally (to show you the totals and enforce the owner amount policy), assembles the Leceipt document, and — in live mode — submits it. Leceipt then SIGNS it with your account certificate (CA) and files it with the Thai Revenue Department, returning a JOB you poll with query_job. In x-leceipt-mode=test (the default) NOTHING is submitted: you get the computed totals + the exact assembled payload back (a local dry-run) so you can review before going live. Result (live): accepted=true with a job_id -> poll query_job until status "complete", then download_document. percentVat per line is 7 / 0 / -1 only. Credential header (set once in your MCP client, per-request, never stored): x-leceipt-api-key = the API key you generated in your OWN Leceipt account (Settings -> "Connection to API" -> "Generating API Key"; self-signup at my.leceipt.com/signup). Your company profile and signing certificate (CA — TDID/INET) live inside YOUR Leceipt account — this server never sees them. Mode header x-leceipt-mode: test (default = LOCAL dry-run, assembles + computes VAT but does NOT submit; Leceipt has no sandbox host) | live (submits to Leceipt -> Thai Revenue Department, real fiscal effect; requires x-leceipt-api-key). Optional owner-policy headers x-agentpay-max-amount / x-agentpay-approval-above / x-agentpay-allowed-tools.
Parameters9
| number | string | required | Your invoice / document number (becomes the document "number"), e.g. INV-2026-000123. REQUIRED. |
| date | string | optional | Issue date in Gregorian ISO "YYYY-MM-DD" (converted to the Buddhist-Era dateBE for you). Omit to use today. Or pass dateBE directly. |
| dateBE | string | optional | Issue date already in Buddhist-Era "dd/MM/yyyy" (e.g. 10/07/2569). Optional alternative to date. |
| customer | object | required | Buyer identification & address. |
| items | array | required | Line items. Each: { description, quantity, unitPrice, discount?, vatRate? }. |
| includeVat | boolean | optional | true = the unitPrice values already INCLUDE VAT (server backs it out); false = prices are net, VAT added on top (default). |
| discount | number | optional | Document-level discount in THB (optional). Forwarded to Leceipt; when > 0 the authoritative grand total is Leceipt's. |
| reference | string | optional | Optional reference number shown on the document. |
| note | string | optional | Optional note / remark printed on the document. |
Raw schema
{
"type": "object",
"properties": {
"number": {
"type": "string",
"description": "Your invoice / document number (becomes the document \"number\"), e.g. INV-2026-000123. REQUIRED."
},
"date": {
"type": "string",
"description": "Issue date in Gregorian ISO \"YYYY-MM-DD\" (converted to the Buddhist-Era dateBE for you). Omit to use today. Or pass dateBE directly."
},
"dateBE": {
"type": "string",
"description": "Issue date already in Buddhist-Era \"dd/MM/yyyy\" (e.g. 10/07/2569). Optional alternative to date."
},
"customer": {
"type": "object",
"description": "Buyer identification & address.",
"properties": {
"name": {
"type": "string",
"description": "Buyer / customer name (company or person). REQUIRED."
},
"taxId": {
"type": "string",
"description": "Buyer tax id. For taxNumberType TXID/NIDN it is the 13-digit Thai taxpayer/national id (no dashes). REQUIRED. Use \"0000000000000\" only for an unidentified cash customer."
},
"taxNumberType": {
"type": "string",
"enum": [
"TXID",
"NIDN",
"CCPT",
"OTHR"
],
"description": "Buyer id type: TXID juristic 13-digit taxpayer id (default), NIDN individual 13-digit national id, CCPT passport, OTHR other."
},
"branchNumber": {
"type": "string",
"description": "Buyer branch number, 5 digits. Head office = \"00000\" (default). A branch e.g. \"00001\"."
},
"address": {
"type": "string",
"description": "Buyer address (free text). Optional but recommended for a valid tax invoice."
},
"postcode": {
"type": "string",
"description": "Buyer postal code (5 digits). Optional."
},
"phone": {
"type": "string",
"description": "Buyer phone. Optional."
},
"email": {
"type": "string",
"description": "Buyer email (Leceipt can deliver the document here). Optional."
}
},
"required": [
"name",
"taxId"
]
},
"items": {
"type": "array",
"description": "Line items. Each: { description, quantity, unitPrice, discount?, vatRate? }.",
"items": {
"type": "object",
"properties": {
"description": {
"type": "string",
"description": "Line item description."
},
"quantity": {
"type": "number",
"description": "Quantity (> 0)."
},
"unitPrice": {
"type": "number",
"description": "Unit price in THB. If document includeVat=true this price already includes VAT."
},
"discount": {
"type": "number",
"description": "Per-line discount in THB (optional, default 0)."
},
"vatRate": {
"type": "number",
"description": "VAT rate for this line: 7 = standard VAT 7% (default), 0 = zero-rated (e.g. exports), -1 = VAT-exempt / non-VAT."
},
"unitName": {
"type": "string",
"description": "Unit label e.g. \"ชิ้น\" / \"unit\" (optional)."
}
},
"required": [
"description",
"quantity",
"unitPrice"
]
}
},
"includeVat": {
"type": "boolean",
"description": "true = the unitPrice values already INCLUDE VAT (server backs it out); false = prices are net, VAT added on top (default)."
},
"discount": {
"type": "number",
"description": "Document-level discount in THB (optional). Forwarded to Leceipt; when > 0 the authoritative grand total is Leceipt's."
},
"reference": {
"type": "string",
"description": "Optional reference number shown on the document."
},
"note": {
"type": "string",
"description": "Optional note / remark printed on the document."
}
},
"required": [
"number",
"customer",
"items"
]
}