> ## 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.

# JSON and XML

> How to choose a format, what happens when headers disagree, and where the XML schemas live.

The same response model is serialised two ways. Field names are `snake_case` in both. XML uses the namespace `https://partners.inra.co.th/schema/v1`.

This is easy to miss on a first integration: **resource responses default to XML**. If you send no `Accept` header, you will get XML.

| You want | Send |
| - | - |
| XML (the default) | nothing, or `Accept: application/xml`, or `?format=xml` |
| JSON | `Accept: application/json` or `?format=json` |

If `Accept` and `format` disagree, the API returns `406` with the code `not_acceptable`.

`POST /oauth/token` is always JSON and ignores this negotiation.

## XML requests

When you POST a JSON body, use `Content-Type: application/json`. An XML body uses the same namespace and a root that matches the operation, for example `database_report_request` or the equivalent offline request root. XSD files live at `/v1/schemas/`:

* `/v1/schemas/` — index (XML by default, or JSON with `Accept: application/json`)
* `/v1/schemas/company.xsd`
* `/v1/schemas/order.xsd`
* `/v1/schemas/report.xsd`
* `/v1/schemas/error.xsd`
* `/v1/schemas/dictionary.xsd`

## Errors

The error envelope is the same in both formats. See [Errors](https://docs.partners.inra.co.th/errors.md) for the catalogue of `code` values.


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