Thai Legal Data API and MCP
Returns a Thai law section by number, the sections that govern a described situation, the Supreme Court rulings that interpret them, or a cited answer to a question.
- PriceFree
- Served50.3Kcalls
- v1.0
- Active
Input
- law
- ประมวลกฎหมายอาญา
- section
- 335
- with_deka
- true
OutputGET /v3/store/data/thai-legal/section
{
"found": true,
"law": "ประมวลกฎหมายอาญา",
"section": "335",
"unit": "มาตรา",
"chapter": "หมวด ๑ ความผิดฐานลักทรัพย์และวิ่งราวทรัพย์",
"in_force": "curated",
"text": "ผู้ใดลักทรัพย์
(๑) ในเวลากลางคืน
...",
"deka": [
{ "case_id": "600/2544", "year_be": 2544,
"headnote": "เมื่อผู้เสียหายเห็นจำเลยทั้งสองกำลังลักเอามะม่วง...",
"official_url": "https://deka.supremecourt.or.th" }
]
}Every field, under ResponseOther endpoints: /meta, /laws, /search, /search, /ask see Request
Request
GET with query parameters, or POST with JSON where the table says so. 0.1 IC per request, free during the launch promotion; /meta and /laws are always free.
Headers
apikeystringrequiredBody
lawstringrequired/laws lists it, for /section: ประมวลกฎหมายอาญา.sectionstringrequired/section: 335.with_dekabooleantrue adds the Supreme Court decisions that cite the section.querystring/search and /deka/search: "นายจ้างเลิกจ้างลูกจ้างต้องจ่ายค่าชดเชยเท่าไร".cites_lawcites_sectionstring/deka/search: only rulings that cite this section, the law by its court abbreviation, ป.อ. and 335.year_fromtop_kintegerquestioninclude_dekastring, boolean/ask: the question in Thai, and whether to retrieve rulings as well as sections.| Endpoint | Does | Price |
|---|---|---|
GET /v3/store/data/thai-legal/meta | What is indexed, and what is known to be missing | Free |
GET …/laws, GET …/laws?law= | The catalogue of laws; a law's section numbers | Free |
GET …/section | One section, verbatim | 0.1 IC |
GET or POST …/search | The sections that govern a situation, as 600-character snippets | 0.1 IC |
GET or POST …/deka/search | The rulings on a situation or a section, by headnote | 0.1 IC |
GET …/deka/{case_id} | One ruling, 1234/2565 or 1234-2565; include=body adds up to 4,000 characters | 0.1 IC |
POST …/ask | A grounded answer with citations | 0.1 IC |
Use it from an AI agent
Add the remote server https://mcp.iapp.co.th and sign in with your iApp account; there is no key to copy. In Claude, open Settings, Connectors, Add custom connector, name it iApp AI and paste the URL; in Claude Code, run claude mcp add --transport http iapp-ai https://mcp.iapp.co.th; the MCP server guide covers every other client. To run it locally, use uvx iapp-mcp with IAPP_API_KEY in the environment; the key stays on your machine. Tool calls are billed as the REST calls are.
| Tool | Parameters | Does |
|---|---|---|
iapp_thai_law_list | q | The catalogue, free; call it first for valid law names |
iapp_thai_law_section | law, section, with_deka | The section's text |
iapp_thai_law_search | query, top_k | Semantic search across the sections; warns when the governing law is not indexed |
iapp_thai_deka_search | query, cites_law, cites_section, year_from, top_k | Precedent search |
iapp_thai_deka_get | case_id, include_body | One ruling |
iapp_thai_krisdika_opinion_search | query, top_k | Council of State opinions by subject line, linking the official PDF |
iapp_thai_admincourt_search | query, court, top_k | Administrative Court decisions by subject, parties or case number, linking the official PDF |
iapp_thai_legal_ask | question, include_deka | The grounded answer |
Then ask in Thai: "ลักทรัพย์ในเวลากลางคืนมีโทษอย่างไร อ้างมาตราและฎีกาให้ด้วย", "หาฎีกาที่ตีความ ป.อ. มาตรา 335 หลังปี 2560".
Response
The panel shows /section; a field that appears only on some results says when.
in_forcestringcurated, in the 39-law consolidated core; repealed, marked ยกเลิก by krisdika, kept out of search but readable; unverified, everything else. There is deliberately no "in force" value, since an absent marker proves nothing: check that a section is still in force before relying on it.citation_join/deka/search: exact, range or none, how confidently it was linked to the section.coveragestatus: governing_law_not_indexed and the name of that law, instead of the closest thing held.grounded/ask: false when nothing was retrieved, and then no answer. Every cited ฎีกา number is checked against what was retrieved; an unbacked citation gets one stricter regeneration, then a refusal.depthmetadata_only on Council of State and Administrative Court results: their reasoning is in the linked PDF, so a hit is a pointer, never a holding.foundbooleanfalse, with suggestions, for a section not held; still HTTP 200, so a client does not retry it.lawstringsectionstringunitstringchapterstringtextstringdekaarraywith_deka: the rulings that cite the section, each with case_id, year_be, headnote and official_url.A search below the confidence floor returns count: 0 and a confidence note rather than plausible filler.
Details
Measured
Limits
- The ฎีกา corpus is not the whole Supreme Court archive;
/metareports what is indexed. Precedent search matches the headnote, not the narrative. - Council of State opinions and Administrative Court decisions are indexed at subject level only.
- Not legal advice. Verify a ruling at deka.supremecourt.or.th before relying on it; every result links there. Report an error to legal@iapp.co.th.
The corpus
- Statutes: 2,346 laws and 68,235 sections, พ.ศ. 2417 to 2569: the five codes, พ.ร.บ., พ.ร.ก., พ.ร.ฎ. and กฎกระทรวง; among them the 2560 constitution and labour, land, PDPA, computer, narcotics, traffic, social security, bankruptcy and intellectual property law.
- Curated core: 39 laws in consolidated text, the same used by OpenThai 2.0 Legal, preferred over any other copy.
- Supreme Court: 133,159 documents, 120,216 judgments plus orders and rulings, each with its headnote; 91,384 case numbers, since one ruling can hold several headnotes; 99.7% linked to the sections they cite.
- Council of State: 6,534 opinions, พ.ศ. 2466 to 2569.
- Administrative Court: 128,361 judgments and orders from all 16 courts, published under CC-BY.
Judgments and official reports are not copyright works under พ.ร.บ. ลิขสิทธิ์ พ.ศ. 2537 มาตรา 7(4), so the text is public domain; iApp does not certify it on the court's behalf.
Data handling
Queries are processed in memory and not kept after the response. Consent and notice under PDPA and GDPR remain with you as the data controller.