> ## Documentation Index
> Fetch the complete documentation index at: https://docs.partners.inra.co.th/llms.txt
> Use this file to discover all available pages before exploring further.

# Database reports

> How to order an on-file INRA database report, what the sandbox returns, and when to switch to an offline investigation.

A **database report** is an on-file INRA report for a company you have already found. You place it with `POST /v1/database-reports`.

In the sandbox this returns a masked fixture immediately and does **not** create an order at INRA head office, does not send email, and is not billed. In production it creates a real order, returns the report in the same response when one is on file, and may be billed.

## Request

The only required field is `company_id`. `reference` is optional and is echoed on the order so you can correlate it with your own records.

```bash cURL theme={null}
curl -s -H "Authorization: Bearer $TOKEN"   -H "Accept: application/json"   -H "Content-Type: application/json"   -d '{"company_id":100001,"reference":"PO-12345"}'   https://partners-sandbox.inra.co.th/v1/database-reports
```

```python Python theme={null}
import os
import requests

headers = {
    "Authorization": f"Bearer {os.environ['TOKEN']}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}
response = requests.post(
    "https://partners-sandbox.inra.co.th/v1/database-reports",
    headers=headers,
    json={"company_id": 100001, "reference": "PO-12345"},
    timeout=60,
)
response.raise_for_status()
order = response.json()
print(order["order_id"], order["status"])
```

An XML body uses the root `database_report_request` in the namespace `https://partners.inra.co.th/schema/v1`.

The response is an order already in status `Completed`, including the report body. You can fetch it again with `GET /v1/orders/{order_id}` or download only the report from `GET /v1/orders/{order_id}/report`.

## When there is no report on file

If the company exists but has no database report, the API returns `404` with the code `report_not_available`. Check `database_report` on the search hit or the profile before you order, and use an [offline report](https://docs.partners.inra.co.th/guides/offline-reports.md) when the flag is `false`.

Sandbox company `100003` is reserved for this case.

## Production-only failures

* `403 client_not_configured` — this production client has not yet been enabled for database reports. Email [inraasth@inra.co.th](mailto:inraasth@inra.co.th).
* `503 order_failed` — the order could not be queued. No charge was made. Wait for `Retry-After` and retry.

PDF is not available in v1 (`406 pdf_not_available`). Use JSON or XML.

Coded values inside the report are `{code, name}` objects. Resolve and cache them with [Dictionaries](https://docs.partners.inra.co.th/dictionaries/overview.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.