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

# Company identifiers

> How company_id works in production (the nine-digit public_id) and why sandbox sample ids are different.

In this API, `company_id` is the identifier you store, pass to lookup, and send when you order a report. Its meaning depends on the environment.

## Production: the public\_id

In production, `company_id` is INRA's **public company identifier** (`public_id`):

* It is a nine-digit number. The first digit is never `0`. The last digit is a Luhn check digit computed from the first eight, so a mistyped id is usually rejected as `404` rather than silently resolved to the wrong company.
* It is unique and is bound to one company record for as long as that record exists.
* It is not the 13-digit DBD registration number, and it is not INRA's internal filing number. Search can accept a registration number; every later call uses `company_id`.
* If INRA removes a company record, that `public_id` is **retired**. It is never issued again. A lookup of a retired id returns `410` with the code `company_retired`. Store the id, but treat a `410` as final.

You receive the production `company_id` from `GET /v1/companies` (and later from an offline order once INRA has identified the subject). Do not try to invent or reuse one.

## Sandbox: sample identifiers

The sandbox catalogue uses its own short sample ids — `100001`, `100002`, `100005`, `100006`, `100007`, and so on. Those values are convenient for fixtures. They are **not** valid production `public_id` values, and they will not resolve on `https://partners.inra.co.th`.

Likewise, a production `public_id` will not resolve in the sandbox. Keep the two sets of identifiers separate in your own records, or use a distinct sandbox tenant in your system.

## What to persist

When a search or lookup succeeds, persist:

* `company_id` — the handle you will use on later calls
* `company_name` / `local_name` and `registration_number` — useful for display and for support
* the environment you called (`sandbox` or `production`)

If you later place an offline order by details (because search did not find the company), the order may have no `company_id` until INRA identifies the subject. The `order.identified` callback and a later `GET /v1/orders/{order_id}` include the id once it exists. See [Orders and callbacks](https://docs.partners.inra.co.th/concepts/orders-and-callbacks.md).


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