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

> Name matching, registration-number matching, the match parameter, and how to choose a company_id.

`GET /v1/companies` finds companies by name, by registration number, or both.

## Name matching

The `name` parameter accepts English or Thai text. The server applies the match itself and **ignores client-supplied wildcard characters** (`* % _ ? [ ]`). After those characters are removed, at least three characters must remain or the request is rejected.

`match` controls how the remaining text is applied:

| `match` | Behaviour |
| - | - |
| `contains` (default) | The text may appear anywhere in the English or Thai name. Names that start with the text are ranked first. |
| `prefix` | Starts-with match on the English or Thai name. |

A common mistake is to send `%` or `*` yourself. The server will strip them, which can leave fewer than three characters and produce a validation error. Send the raw text and let the server add its own pattern.

## Registration numbers

`reg_no` is a full 13-digit registration number. It is matched **exactly** after the same wildcard characters are stripped, and `match` is ignored for this parameter. Partial numbers are not supported.

You can send `name` and `reg_no` together; a hit has to satisfy both.

## Choosing a company\_id

Each hit includes a `company_id`. That is the value you pass to lookup and to report orders.

* In the sandbox, use the [sample catalogue](https://docs.partners.inra.co.th/guides/sandbox-vs-production.md).
* In production, the value is a nine-digit [`public_id`](https://docs.partners.inra.co.th/concepts/public-id). Persist it with the environment you called.

If several companies match, do not guess. Compare `company_name`, `local_name`, `registration_number`, and `operating_address`, then look up the one you mean.

The profile field `database_report` is also present on search hits. Use it to decide between a database report and an offline investigation.

## Empty results

An empty list is a successful response, not an error. See [Coverage](https://docs.partners.inra.co.th/concepts/coverage.md) for the usual reasons a production search returns nothing, and [Offline reports](https://docs.partners.inra.co.th/guides/offline-reports.md) for ordering by details when you cannot find the company.

```bash cURL theme={null}
curl -s -H "Authorization: Bearer $TOKEN"   -H "Accept: application/json"   "https://partners-sandbox.inra.co.th/v1/companies?name=Sample&match=contains"
```

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

headers = {
    "Authorization": f"Bearer {os.environ['TOKEN']}",
    "Accept": "application/json",
}
response = requests.get(
    "https://partners-sandbox.inra.co.th/v1/companies",
    params={"name": "Sample", "match": "contains"},
    headers=headers,
    timeout=30,
)
response.raise_for_status()
for company in response.json()["companies"]:
    print(company["company_id"], company["company_name"])
```


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