Documents
Submit Thai tax documents (tax invoice receipts, credit notes, debit notes) for PDF generation and INET e-Tax submission.
Document Types
docType | Description |
|---|
TAX_INVOICE_RECEIPT | Combined tax invoice and receipt |
FULL_TAX_INVOICE | Full tax invoice only |
CREDIT_NOTE | Credit adjustment (requires original document fields) |
DEBIT_NOTE | Debit adjustment (requires original document fields) |
POST /api/v1/documents
Submit a new tax document.
POST /api/v1/documents
Headers
| Header | Required | Description |
|---|
X-API-Key | ✓ | Your API key |
X-Idempotency-Key | ✓ | Unique key per request |
Content-Type | ✓ | application/json |
Request Body
| Field | Type | Required | Description |
|---|
sourceId | string | ✓ | Your source code (e.g. TESTSRC) |
docType | enum | ✓ | One of the document types above |
documentNo | string | ✓ | Your unique document number |
documentDate | string | ✓ | Date in YYYY-MM-DD format |
pdfBase64 | string | — | Pre-generated PDF as base64. Omit to let the server generate from template |
metadata | object | ✓ | See Metadata fields below |
Metadata Fields
| Field | Type | Required | Notes |
|---|
sellerTaxId | string | ✓ | 13-digit Thai tax ID |
sellerName | string | ✓ | — |
sellerBranchCode | string | ✓ | 5-digit branch code |
sellerAddress | string | ✓ | — |
buyerTaxId | string | ✓ | 13-digit Thai tax ID |
buyerName | string | ✓ | — |
buyerBranchCode | string | ✓ | 5-digit branch code |
buyerAddress | string | ✓ | — |
currency | string | — | Default: THB |
amountExVat | number | — | Amount excluding VAT |
vatAmount | number | — | VAT amount |
totalAmount | number | — | Must equal amountExVat + vatAmount |
lineItems | array | — | Array of line item objects |
phone | string | — | Buyer phone |
email | string | — | Buyer email (valid email format) |
originalDocumentNo | string | Credit/Debit only | Required for CREDIT_NOTE / DEBIT_NOTE |
originalDocumentDate | string | Credit/Debit only | YYYY-MM-DD |
originalDocumentType | enum | Credit/Debit only | One of the document types above |
adjustmentReason | string | Credit/Debit only | — |
adjustedAmountExVat | number | Credit/Debit only | — |
adjustedVatAmount | number | Credit/Debit only | — |
adjustedTotalAmount | number | Credit/Debit only | — |
Example Request
curl -X POST https://dev-etax.siamprop.app/api/v1/documents \
-H "X-API-Key: sk_etax_your_key" \
-H "X-Idempotency-Key: idem-inv-2026-001" \
-H "Content-Type: application/json" \
-d '{
"sourceId": "TESTSRC",
"docType": "TAX_INVOICE_RECEIPT",
"documentNo": "INV-2026-001",
"documentDate": "2026-03-09",
"metadata": {
"sellerTaxId": "0101234567890",
"sellerName": "ACME Co., Ltd.",
"sellerBranchCode": "00000",
"sellerAddress": "99 Sukhumvit Rd, Bangkok 10110",
"buyerTaxId": "0109876543210",
"buyerName": "Beta Corp Co., Ltd.",
"buyerBranchCode": "00001",
"buyerAddress": "55 Silom Rd, Bangkok 10500",
"currency": "THB",
"amountExVat": 1000,
"vatAmount": 70,
"totalAmount": 1070,
"lineItems": [
{ "description": "Software License", "qty": 1, "unitPrice": 1000, "lineTotal": 1000 }
]
}
}'
Response — 201 Created
{
"documentId": "01KK9PJ85APR3S0AWMCNDY6Y6Y",
"status": "RECEIVED"
}
Response — 200 OK (idempotency replay)
Returns the same body as the original 201 response.
Error Cases
| errorCode | HTTP | Cause |
|---|
UNAUTHORIZED | 401 | Invalid or missing API key |
VALIDATION_ERROR | 422 | Missing required fields or invalid format |
DUPLICATE_DOCUMENT | 409 | documentNo already exists for this source |
IDEMPOTENCY_CONFLICT | 409 | Same idempotency key, different request body |
PDF_GENERATION_FAILED | 422 | Server-side PDF generation failed |
TEMPLATE_NOT_FOUND | 422 | No active template for this docType |
GET /api/v1/documents/:id
Retrieve a single document by its ID.
GET /api/v1/documents/{documentId}
Headers
| Header | Required | Description |
|---|
X-API-Key | ✓ | Your API key |
Example Request
curl https://dev-etax.siamprop.app/api/v1/documents/01KK9PJ85APR3S0AWMCNDY6Y6Y \
-H "X-API-Key: sk_etax_your_key"
Response — 200 OK
{
"documentId": "01KK9PJ85APR3S0AWMCNDY6Y6Y",
"sourceId": "TESTSRC",
"docType": "TAX_INVOICE_RECEIPT",
"documentNo": "INV-2026-001",
"documentDate": "2026-03-09",
"status": "ACKNOWLEDGED",
"inetReference": "INET-REF-12345",
"receivedAt": "2026-03-09T10:00:00.000Z",
"acknowledgedAt": "2026-03-09T10:01:30.000Z"
}
GET /api/v1/documents
List documents for your source.
GET /api/v1/documents?sourceId=TESTSRC&page=1&limit=20
Query Parameters
| Parameter | Required | Default | Description |
|---|
sourceId | ✓ | — | Your source code |
status | — | all | Filter by document status |
documentNo | — | — | Filter by document number |
page | — | 1 | Page number |
limit | — | 20 | Items per page (max 100) |
Response — 200 OK
{
"items": [
{
"documentId": "01KK9PJ85APR3S0AWMCNDY6Y6Y",
"docType": "TAX_INVOICE_RECEIPT",
"documentNo": "INV-2026-001",
"documentDate": "2026-03-09",
"status": "ACKNOWLEDGED"
}
],
"pagination": {
"page": 1,
"limit": 20,
"total": 1
}
}