GET /v1/orders.
Registering a URL
Callbacks are configured by INRA, not through the API. Email the HTTPS URL you want to use to inraasth@inra.co.th. After a short review we register:- the URL
- any extra allowed hosts (for a test destination)
- a signing secret, which we send to you once, out of band
GET /v1/webhook shows what is configured and the last delivery. The signing secret is never returned (secret_configured is a boolean).
Request shape
Event types currently sent:
Each callback is an HTTPS
POST with a JSON body:
Verify the signature
The signed string is<X-INRA-Timestamp>.<raw body> (the exact bytes of the body, not a re-serialised JSON document). The header value is v1= followed by the hex digest of HMAC-SHA256 over that string, using the signing secret.
- Reject timestamps older than five minutes (clock skew included).
- De-duplicate on
X-INRA-Event-Id(orevent_idin the body). - Answer with a
2xxwithin 10 seconds. Other answers, and timeouts, are retried with backoff for about 35 hours. - Fetch the order and the report from the API after you accept the event. Treat the callback as a signal, not as the only copy of the data.
Test ping
POST /v1/webhook/test queues a signed webhook.ping to the configured URL. You may pass a url whose host is on the allowed-hosts list. Check the outcome with GET /v1/webhook.
url is not on the allowed-hosts list, the API returns 422 with the code callback_url_not_allowed. If the delivery path is temporarily unavailable you may see 503 with the code service_unavailable.
