Documents

Submit Thai tax documents (tax invoice receipts, credit notes, debit notes) for PDF generation and INET e-Tax submission.

Document Types

docTypeDescription
TAX_INVOICE_RECEIPTCombined tax invoice and receipt
FULL_TAX_INVOICEFull tax invoice only
CREDIT_NOTECredit adjustment (requires original document fields)
DEBIT_NOTEDebit adjustment (requires original document fields)

POST /api/v1/documents

Submit a new tax document.

POST /api/v1/documents

Headers

HeaderRequiredDescription
X-API-Key✓Your API key
X-Idempotency-Key✓Unique key per request
Content-Type✓application/json

Request Body

FieldTypeRequiredDescription
sourceIdstring✓Your source code (e.g. TESTSRC)
docTypeenum✓One of the document types above
documentNostring✓Your unique document number
documentDatestring✓Date in YYYY-MM-DD format
pdfBase64string—Pre-generated PDF as base64. Omit to let the server generate from template
metadataobject✓See Metadata fields below

Metadata Fields

FieldTypeRequiredNotes
sellerTaxIdstring✓13-digit Thai tax ID
sellerNamestring✓—
sellerBranchCodestring✓5-digit branch code
sellerAddressstring✓—
buyerTaxIdstring✓13-digit Thai tax ID
buyerNamestring✓—
buyerBranchCodestring✓5-digit branch code
buyerAddressstring✓—
currencystring—Default: THB
amountExVatnumber—Amount excluding VAT
vatAmountnumber—VAT amount
totalAmountnumber—Must equal amountExVat + vatAmount
lineItemsarray—Array of line item objects
phonestring—Buyer phone
emailstring—Buyer email (valid email format)
originalDocumentNostringCredit/Debit onlyRequired for CREDIT_NOTE / DEBIT_NOTE
originalDocumentDatestringCredit/Debit onlyYYYY-MM-DD
originalDocumentTypeenumCredit/Debit onlyOne of the document types above
adjustmentReasonstringCredit/Debit only—
adjustedAmountExVatnumberCredit/Debit only—
adjustedVatAmountnumberCredit/Debit only—
adjustedTotalAmountnumberCredit/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

errorCodeHTTPCause
UNAUTHORIZED401Invalid or missing API key
VALIDATION_ERROR422Missing required fields or invalid format
DUPLICATE_DOCUMENT409documentNo already exists for this source
IDEMPOTENCY_CONFLICT409Same idempotency key, different request body
PDF_GENERATION_FAILED422Server-side PDF generation failed
TEMPLATE_NOT_FOUND422No active template for this docType

GET /api/v1/documents/:id

Retrieve a single document by its ID.

GET /api/v1/documents/{documentId}

Headers

HeaderRequiredDescription
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

ParameterRequiredDefaultDescription
sourceId✓—Your source code
status—allFilter by document status
documentNo——Filter by document number
page—1Page number
limit—20Items 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
  }
}