Skip to main content
This guide walks you through your first successful calls: get a token, find a company, and read its profile. You should be able to finish it in about fifteen minutes. Use the sandbox for this walkthrough. A production database or offline report can create a billable order. Sandbox calls never do that.

1. Request credentials

INRA issues a client_id and client_secret for your organisation. Email inraasth@inra.co.th to request a sandbox credential first, and a separate production credential when you are ready to go live. We send these once, out of band — not from this page. Store the secret in your own secret manager. Do not put it in a mobile app, a front-end bundle, source control, or a screenshot. If a secret is ever lost or leaked, ask us to rotate it; the old value stops working immediately. The examples below use placeholders. Replace them with the values you were issued.

2. Request an access token

The API uses OAuth 2.0 client credentials. Authenticate to the token endpoint with HTTP Basic (client_id as the username, client_secret as the password), then use the access token as a Bearer token on every /v1 call. POST /oauth/token always returns JSON, even if you usually prefer XML.
A successful response looks like this:
Details that matter in production code:
  • The access token is an RS256 JWT and is valid for 15 minutes. Request a new one when it is close to expiry; there is no refresh token.
  • You can verify the signature with the keys at GET /.well-known/jwks.json. The token header carries a kid (sandbox-1 in the sandbox, prod-1 in production).
  • The token is scoped. If you call an endpoint your client has not been granted, the API returns 403 with the code insufficient_scope.
  • If the client id or secret is wrong, the token endpoint returns the standard OAuth error invalid_client, not the /v1 error envelope.
  • The token endpoint itself is limited to 30 requests per minute per client.
There is a longer note on tokens, scopes, and rotation in Authentication.

3. Search for a company

Resource responses default to XML. Send Accept: application/json when you want JSON. Company search matches a name with contains by default (at least three characters after wildcard characters are stripped), or matches a 13-digit registration number exactly. In the sandbox the catalogue is small and deliberate. Searching a real Thai company name will usually return nothing. Use the samples below instead.
Useful sandbox queries: Each hit includes a company_id. You will need that id for lookup and for ordering a report. One sandbox company (100003) can be found in search but has no database report — that is intentional, so you can practise the report_not_available case. In production, company_id is INRA’s nine-digit public identifier, and only companies with a Thai address are returned. Sandbox ids such as 100001 do not work in production.

4. Look up the company

The profile repeats the search fields and is the source of database_report: if that flag is true, you can order an on-file report for this company.

5. Optional: download a sandbox database report

This step is safe in the sandbox. Skip it against production until you intend to place a real order.
Sandbox companies that have a report: The reports are based on real INRA reports that have been masked: personal names, registration numbers, contact details, and other identifiers are replaced consistently throughout each file. Figures are adjusted. Treat them as realistic in shape, not as information about any actual company. You can fetch the order again with GET /v1/orders/{order_id}.

6. When something goes wrong

Every /v1 error uses a small envelope with a stable code, a human message, and a request_id. The same shape is used in JSON and XML. Every response also carries the X-Request-Id header — please include it when you email inraasth@inra.co.th.
Codes you are most likely to see on day one: A full list lives on the Errors page.

Next steps

If something in this guide does not match what the API returns, please email inraasth@inra.co.th and include the X-Request-Id. The documentation should follow the API, not the other way around.