Gov APImoj.gov.kh ↗
Access Cambodian laws, regulations, books, and news from the Ministry of Justice (moj.gov.kh). Six endpoints covering legal documents, library, and site search.
What is the Gov API?
The moj.gov.kh API provides 6 endpoints to retrieve legal content from Cambodia's official Ministry of Justice website, including laws with PDF links, a library of books with download URLs, and paginated news events. The get_laws endpoint returns structured records with law number, name, type, date, and separate Khmer and English PDF links where available, making it practical for building Cambodian legal reference tools.
curl -X GET 'https://api.parse.bot/scraper/190e9c81-7a8c-4fe6-b5e6-30370299705f/get_books?page=1&view_mode=grid' \ -H 'X-API-Key: $PARSE_API_KEY'
Typed, relational, agent-ready
A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.
- Fully typed · autocompletes
- Objects link to objects
- Typed errors & pagination
Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:
uv add parse-sdk uv run parse init uv run parse add --marketplace moj-gov-kh-api
uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.
"""Walkthrough: MOJ Cambodia SDK — bounded, re-runnable; every call capped."""
from parse_apis.moj_cambodia_api import MOJCambodia, ViewMode, QueryRequired
client = MOJCambodia()
# List books from the library with a view mode filter
for book in client.books.list(view_mode=ViewMode.LIST, limit=3):
print(book.title, book.download_url)
# Search legal documents in Khmer
result = client.legalresults.search(query="ច្បាប់", limit=1).first()
if result:
print(result.title, result.category, result.date)
# List laws and regulations
for law in client.laws.list(limit=3):
print(law.number, law.name, law.date)
# Browse news items
for item in client.newsitems.list(limit=3):
print(item.title, item.url)
# Site-wide search with typed error handling
try:
for sr in client.searchresults.search(query="យុត្តិធម៌", limit=3):
print(sr.title, sr.url)
except QueryRequired as exc:
print(f"Query error: {exc}")
print("exercised: books.list / legalresults.search / laws.list / newsitems.list / searchresults.search")
Retrieve paginated books from the Ministry of Justice library. Returns book titles, thumbnail URLs, and download URLs. Supports optional filtering by title keyword, category, and institute. Pagination via page number; each page returns up to ~18 books.
| Param | Type | Description |
|---|---|---|
| page | integer | Page number for pagination (1-based). |
| title | string | Filter by book title keyword (Khmer text recommended). |
| category | string | Filter by category (Khmer text, e.g. 'ច្បាប់'). |
| institute | string | Filter by institute name. |
| view_mode | string | View mode: 'grid' or 'list'. |
{
"type": "object",
"fields": {
"page": "current page number as integer",
"books": "array of book objects with title, thumbnail_url, and download_url",
"count": "number of books on the current page",
"total_pages": "total number of pages available"
},
"sample": {
"data": {
"page": 1,
"books": [
{
"title": "រដ្ឋធម្មនុញ្ញឆ្នាំបោះពុម្ពផ្សាយ",
"download_url": "https://moj.gov.kh/files/user-folder/document/Digital_Library/example.pdf",
"thumbnail_url": "https://moj.gov.kh/files/book/example.jpg"
}
],
"count": 18,
"total_pages": 7
},
"status": "success"
}
}About the Gov API
Legal Documents and Regulations
The get_laws endpoint returns paginated records from the Ministry of Justice laws database. Each law object includes number, name, type, date, pdf_kh (Khmer-language PDF), and pdf_en (English-language PDF where available). Not all laws have English PDFs, so pdf_en may be null for some entries. The page parameter controls pagination, and each response includes the count of laws on the current page alongside the laws array.
For full-text legal search, get_legal_search_results accepts a query string and returns title, url, description, date, and category for each matching document. Khmer-script queries (ច្បាប់, យុត្តិធម៌, កិច្ចសន្យា) produce the most complete results — English-language queries are not supported by the source.
Library and Books
The get_books endpoint retrieves the Ministry's digital library with filtering by title, category, and institute, plus a view_mode parameter (grid or list). Each book object exposes title, thumbnail_url, and download_url. The response includes total_pages for your own pagination logic. When you need the full catalog at once, get_all_books iterates all pages internally and returns a flat books array with a total_count — useful for indexing but slower than a single-page get_books call.
News and Site Search
get_news_events returns paginated news items from the Ministry, each with title, url, date, and thumbnail_url. The search_site endpoint supports site-wide keyword search across all content types, returning title, url, date, and thumbnail_url per result. As with the legal search, only Khmer-script queries return results; English queries produce an empty results array.
The Gov API is a managed, monitored endpoint for moj.gov.kh — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when moj.gov.kh changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.
This isn't an official moj.gov.kh API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.
Will this API break when the source site changes?+
Is this an official API from the source site?+
Can I fix or extend this API myself if I need a new endpoint or field?+
What happens if I call an endpoint that has an issue?+
- Building a Cambodian legal research tool that links directly to Khmer and English PDFs via
pdf_khandpdf_enfields - Indexing the Ministry of Justice book library using
get_all_booksto collect alldownload_urlvalues in one pass - Monitoring new Ministry announcements by polling
get_news_eventsfor freshdateandurlentries - Searching for specific legislation by keyword using
get_legal_search_resultswith Khmer-script queries and filtering bycategory - Aggregating law metadata (number, name, type, date) for a Cambodian regulatory compliance database
- Filtering the digital library by subject with the
categoryparameter to surface books in a specific legal domain - Powering a Khmer-language legal chatbot with document titles, descriptions, and URLs from
get_legal_search_results
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 100 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 100 req/min |
One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does moj.gov.kh provide an official developer API?+
What does `get_laws` return and are all laws available in English?+
number, name, type, date, pdf_kh, and pdf_en. English PDFs (pdf_en) are only present where the Ministry has published an English translation — many records will have a null pdf_en and only a Khmer PDF.Why do English-language queries to `search_site` and `get_legal_search_results` return no results?+
search_site and get_legal_search_results require Khmer-script input to return results; English-language queries consistently return an empty array. Use Khmer text (e.g. 'ច្បាប់') for any search query.Does the API expose full law text or only metadata and PDF links?+
get_laws endpoint returns metadata fields (number, name, type, date) and links to PDFs (pdf_kh, pdf_en). Full document text is not extracted. You can fork this API on Parse and revise it to add a law-detail endpoint that fetches and parses the PDF content.Can I filter news events by date range or category?+
get_news_events only accepts a page parameter; date-range and category filtering are not supported. The API covers paginated news items with title, url, date, and thumbnail_url fields. You can fork this API on Parse and revise it to add date or category filter parameters to the news endpoint.