# Vietnamese Legal Documents Search API

> Search ~171,000 Vietnamese legal documents (laws, decrees, circulars, decisions) by keyword or number, filter by type, status, agency and year.

- Endpoint: `GET | POST https://apibox.io.vn/v1/vn-law-search`
- Category: Data & JSON
- HTML docs: https://apibox.io.vn/docs/vn-law-search/ (Vietnamese: https://apibox.io.vn/vi/docs/vn-law-search/)
- Online tool: https://apibox.io.vn/tools/vn-law-search/
- Authentication: `Authorization: Bearer <API key>` or `X-API-Key: <API key>` (free key: https://apibox.io.vn/dashboard/#signup)

Full-text search over about 171,000 Vietnamese legal normative documents from the national legal database (vbpl.vn), refreshed nightly. Search with or without diacritics; a document number in `q` (e.g. `45/2019/QH14`) is matched first. Filter by `type` (Luật, Nghị định, Thông tư, Quyết định…), `status` (Còn hiệu lực, Hết hiệu lực…), issuing `agency`, `scope` (`tw` central / `dp` local) and `year_from` / `year_to`; sort by `relevance`, `newest` or `oldest`; page through with `page` and `page_size` (max 50; the first 10,000 results are reachable).

Each item gives the document id, number, title, type, status, `inForce` (true for documents fully or partly in force), issue date (dd/mm/yyyy as published), agency and a link to the full text. Use the id with `/v1/vn-law-document/{id}` to get all attributes, related documents and the text (plain text for LLM / RAG pipelines, or clean HTML). `facets=1` adds counts by type and status.

Data: national legal database vbpl.vn (Ministry of Justice); legal normative documents are not protected by copyright (IP Law art. 15); part of the metadata comes from the "Vietnamese Legal Documents" dataset (CC BY 4.0, attribution in every answer). Reference only: the Official Gazette text prevails.

## Parameters

| Name | In | Type | Required | Default | Description |
|---|---|---|---|---|---|
| `q` | query | string | no |  | Keywords (max 200 characters), with or without diacritics, or a document number. Empty = browse by filters. |
| `type` | query | string | no |  | Document type, e.g. `Luật`, `Nghị định`, `Thông tư` (with or without diacritics). |
| `status` | query | string | no |  | Validity status, e.g. `Còn hiệu lực`, `Hết hiệu lực`. |
| `agency` | query | string | no |  | Issuing agency, e.g. `Bộ Tài chính`, `UBND tỉnh Phú Yên`. |
| `scope` | query | string | no |  | `tw` (central) or `dp` (local). |
| `year_from` | query | number | no |  | Issued from this year. |
| `year_to` | query | number | no |  | Issued up to this year. |
| `sort` | query | string | no |  | `relevance` (default with q), `newest` (default without q) or `oldest`. |
| `page` | query | number | no | `1` | Page number. |
| `page_size` | query | number | no | `20` | Results per page (1–50). |
| `facets` | query | boolean | no |  | `1`: add counts by type and status. |

## Example request

```bash
curl "https://apibox.io.vn/v1/vn-law-search?q=luật đất đai&type=Luật&page_size=1" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

## Example response

```json
{
  "total": 9,
  "approximate": false,
  "page": 1,
  "pageSize": 1,
  "items": [
    {
      "id": "177815",
      "number": "31/2024/QH15",
      "title": "Luật Đất đai",
      "type": "Luật",
      "status": "Còn hiệu lực",
      "inForce": true,
      "issuedDate": "18/01/2024",
      "agency": "Quốc hội",
      "url": "https://thuvienphapluat.io.vn/van-ban/177815/luat-dat-dai"
    }
  ],
  "source": {
    "name": "Thư viện Pháp luật Mở (thuvienphapluat.io.vn)",
    "texts": "National legal database vbpl.vn (Ministry of Justice); legal normative documents are not protected by copyright (IP Law art. 15)",
    "metadata_licence": "Part of the metadata: \"Vietnamese Legal Documents\" dataset by Thịnh Ngô, CC BY 4.0",
    "disclaimer": "Reference only; the text published in the Official Gazette (Công báo) prevails."
  }
}
```

## Use cases

- Find the laws, decrees and circulars on a topic for a legal or compliance app
- Check whether a document is still in force before citing it
- Feed an LLM / RAG assistant with the right Vietnamese legal texts
- Build a "related regulations" box for a news or accounting site

## FAQ

### How fresh is the data?

The library is synchronised nightly from the national legal database; new documents usually appear the next day.

### Can I search without diacritics?

Yes. "luat dat dai" and "luật đất đai" give the same results; a document number in the query is matched first.

### Is this an official source?

It is a reference copy of the national legal database. For legal effect, the text published in the Official Gazette prevails.
