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-KeyYour API key
X-Idempotency-KeyUnique key per request
Content-Typeapplication/json

Request Body

FieldTypeRequiredDescription
sourceIdstringYour source code (e.g. TESTSRC)
docTypeenumOne of the document types above
documentNostringYour unique document number
documentDatestringDate in YYYY-MM-DD format
pdfBase64stringPre-generated PDF as base64. Omit to let the server generate from template
metadataobjectSee Metadata fields below

Metadata Fields

FieldTypeRequiredNotes
sellerTaxIdstring13-digit Thai tax ID
sellerNamestring
sellerBranchCodestring5-digit branch code
sellerAddressstring
buyerTaxIdstring13-digit Thai tax ID
buyerNamestring
buyerBranchCodestring5-digit branch code
buyerAddressstring
currencystringDefault: THB
amountExVatnumberAmount excluding VAT
vatAmountnumberVAT amount
totalAmountnumberMust equal amountExVat + vatAmount
lineItemsarrayArray of line item objects
phonestringBuyer phone
emailstringBuyer 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-KeyYour 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
sourceIdYour source code
statusallFilter by document status
documentNoFilter by document number
page1Page number
limit20Items 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
  }
}