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
- Measured88.0%
- Served75.3Kcalls
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
On the production service, 28 October 2026, against the public NitiBench benchmark of Thai financial and commercial law, searching all 2,346 laws the API holds.
| Measure | Result |
|---|---|
| Governing section in the first 10 results, 3,729 short questions | 88.0% (95% CI 87.0–89.1%) |
| Governing section first / in the first 5 | 58.4% / 84.3% |
| Answer sections in the first 10, 50 real Revenue Department rulings (131 sections) | 22.1%; at least one found for 44.0% |
Benchmark sections returned by /section | 3,585 of 3,585 |
| Sections amended since 2014 served in the amended wording | 139 of 154 (the benchmark's own copy: 86) |
Rulings returned with cites_section that cite that section | 94.1% (443 of 471) |
Median time through the API: /search / /section | 0.88 s / 69 ms |
A question about one provision usually finds its section on the first page of results; a long set of facts that turns on several provisions rarely finds all of them, so search once per issue. The benchmark covers financial and commercial law only: criminal, labour, land and administrative law were not measured, and /ask was not scored. Method, results by law and limits: the benchmark (PDF).
Limits
- Each account can make 5 requests a second, 100 a minute and 1,000 a day (the day starts at 00:00 UTC, 07:00 in Bangkok). A request over a limit returns
429, and theX-RateLimit-Remaining-Dayheader shows what is left of the day. The API answers questions one at a time: downloading the corpus in bulk is not permitted, and accounts that do so are suspended. For higher volume, contact sale@iapp.co.th. - The ฎีกา corpus is not the whole Supreme Court archive;
/metareports what is indexed. Precedent search matches the headnote, not the narrative, and returns one entry per headnote, so the same ruling can appear more than once; group results bycase_id. /sectiontakes the law name exactly as/lawslists it and the section number in Arabic numerals,335. Thai numerals (๓๓๕), the word มาตรา before the number, an abbreviation such asป.พ.พ.or an act name without its year returnfound: false, even when the law is held./deka/{case_id}does not accept joined case numbers such as1579-1580/2558, which/deka/searchcan return; open those rulings from the link in the search result.- 13 of 154 sections amended since 2014 are still served in their earlier wording, 12 of them family-law sections of the Civil and Commercial Code amended in 2024. Each such response carries a warning naming the amending act; read it before relying on the text.
- 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,237 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.