On this page
The Authentication API lets your application offer ThaID login to your end users — allowing a person to prove their identity using Thailand's national ThaID (Digital ID) app — without your company needing to register directly with the Department of Provincial Administration (DOPA) as a Relying Party.
Finema holds its own DOPA Relying Party registration and credentials, and Verifined brokers the ThaID login flow on your behalf through a simple REST API. Your application never needs to store or handle DOPA credentials, and it never receives or exchanges a DOPA authorization code directly — that exchange happens on Verifined's side.
How the login flow works
A ThaID login through Verifined starts with a button in your own UI (e.g. "Log in with ThaID") and involves five steps:
- 1
The user clicks "Log in with ThaID"
In your own web page or app.
- 2
Your backend starts the login
It calls Start a login with the identity fields you need (
scope) and where to send the user afterwards (redirect_url). Verifined returns anauth_urland atransaction_id. - 3
The user verifies with ThaID
Your frontend opens
auth_url— DOPA's own ThaID authorization page, where the user scans a QR code with the ThaID app and completes verification with their ThaID PIN. - 4
Verifined completes the exchange
DOPA redirects the browser back to Verifined, which completes the token exchange and redirects the browser on to your
redirect_urlwith onlytransaction_idandstatusattached — no identity data. - 5
Your backend fetches the result
It calls Check login status with the
transaction_idto get the outcome and, on success, the verified identity data.
Steps 2 and 5 are typically both handled by your backend; steps 1 and 3 happen in the end user's browser or in-app browser; step 4 happens automatically and requires no code on your side beyond having a redirect_url ready to receive the user back.
Start a login
Begins a new ThaID login attempt and returns the URL to send the end user to.
https://verifined.co/api/public/v1/thai-id/authenticateRequest header
AuthorizationstringRequiredYour API key, in the
FINEMA <api-key>format.Content-TypestringOptionalMedia type of the request body:
application/json.
Request body
scopestring[]RequiredThe identity fields you want returned. At least one value is required. See allowed scope values.
redirect_urlstring (URL)RecommendedA page on your own site or app. Once the login flow completes, the end user's browser is redirected here with only
transaction_idandstatusappended as query parameters — no identity data. The status value issuccessorfailed. Call Check login status from this page to get the actual data. If omitted, the browser is not redirected and displays Verifined's JSON response instead.
curl -X POST 'https://verifined.co/api/public/v1/thai-id/authenticate' \
--header 'Authorization: FINEMA <api-key>' \
--header 'Content-Type: application/json' \
--data '{
"scope": [
"pid",
"given_name",
"family_name",
"birthdate"
],
"redirect_url": "https://your-app.example.com"
}'Allowed scope values
Request only the fields you actually need for your use case — the list you request is what the end user is asked to consent to.
- pid
- name
- name_en
- given_name
- middle_name
- family_name
- given_name_en
- middle_name_en
- family_name_en
- smartcard_code
- title
- title_en
- ial
- date_of_issuance
- date_of_expiry
- birthdate
- gender
- address
- house_address
Response
{
"auth_url": "https://<thaid-authorization-page>...",
"status": "pending",
"transaction_id": "5f2e...-uuid",
"tr_id": "b1a0...-uuid"
}auth_urlstringRedirect or open the end user's browser to this URL so they can complete ThaID QR login.
statusstringAlways
pendingwhen a login is started. Use Check login status to follow the login to its outcome.transaction_idstringIdentifies this login attempt. Save it — you will need it to check its status.
tr_idstringA reference for this API call. Store it with your audit record and quote it when contacting Finema support.
Invalid scope
Returned with HTTP 400 when scope contains a value that is not an allowed scope value. The fields object names the offending key. Not charged.
{
"code": "INVALID_PARAMS",
"message": "Invalid parameters",
"fields": {
"scope": {
"code": "INVALID_STRING",
"message": "scope must be one of pid, name, name_en, birthdate, …"
}
}
}Check login status
Retrieves the outcome of a login started with Start a login, and the identity data once it has completed successfully. This is the only way your application obtains the identity attributes.
https://verifined.co/api/public/v1/thai-id/authenticateRequest header
AuthorizationstringRequiredYour API key.
x-transaction-idstringRequiredThe
transaction_idreturned by Start a login.
curl -X GET 'https://verifined.co/api/public/v1/thai-id/authenticate' \
--header 'Authorization: FINEMA <api-key>' \
--header 'x-transaction-id: 5f2e...-uuid'Response — success
{
"status": "success",
"data": {
"address": {
"formatted": "99 ถ.ตัวอย่าง แขวงตัวอย่าง เขตตัวอย่าง กรุงเทพมหานคร"
},
"birthdate": "1991-03-02",
"date_of_expiry": "2033-03-01",
"date_of_issuance": "2025-03-15",
"family_name": "ใจดี",
"family_name_en": "Jaidee",
"gender": "male",
"given_name": "สมชาย",
"given_name_en": "Somchai",
"house_address": {
"formatted": "99 ถนนตัวอย่าง แขวงตัวอย่าง เขตตัวอย่าง กรุงเทพมหานคร",
"id": "1008013xxxx",
"raw": "99####ตัวอย่าง#ตัวอย่าง#เขตตัวอย่าง#กรุงเทพมหานคร"
},
"ial": "2.3",
"middle_name": "",
"middle_name_en": "",
"name": "นาย สมชาย ใจดี",
"name_en": "Mr. Somchai Jaidee",
"pid": "1103700382xxx",
"smartcard_code": "1009-05-0315xxxx",
"title": "นาย",
"title_en": "Mr."
},
"resolved_at": "2026-09-23T11:06:53.631Z",
"expires_at": "2026-09-23T11:11:53.631Z"
}statusstringpendinguntil the end user completes the ThaID scan, thensuccess, orfailedif the user declined consent in the ThaID app. Keep polling whilepending.dataobjectPresent only when
statusissuccess. Contains the identity fields you requested inscope, keyed by field name.errorstringPresent only when
statusisfailed. A short description of why the login failed, for exampleUser denied the request (disapproved).error_descriptionstringPresent only when
statusisfailed. A machine-readable reason, for exampleuser_denied.resolved_atstringISO 8601 time the result became available (when the DOPA callback was received). Present once
statusissuccessorfailed.expires_atstringISO 8601 time after which the result can no longer be retrieved (
resolved_at+ 5 minutes). Later calls return 410THAID_RESULT_EXPIRED.
Response — failed
Returned when the end user declines consent in the ThaID app. The browser is redirected to your redirect_url with status=failed, and Check login status returns the result below. No identity data is returned.
{
"status": "failed",
"error": "User denied the request (disapproved)",
"error_description": "user_denied",
"resolved_at": "2026-09-23T11:06:53.631Z",
"expires_at": "2026-09-23T11:11:53.631Z"
}Status codes and charging
| HTTP | Description | Charged |
|---|---|---|
| 200 | Start a login — the login was started; status is pending. | Yes |
| 200 | Check login status — status is pending, success or failed. Not charged, however many times you poll. | No |
| 400 | INVALID_PARAMSscope is invalid, for example it contains an unsupported value. | No |
| 400 | INVALID_TOKENThe Authorization header is missing. | No |
| 400 | Bad request — the x-transaction-id header is missing from a Check login status call. | No |
| 401 | INVALID_TOKENThe API key is invalid or expired. | No |
| 404 | TRANSACTION_NOT_FOUNDThe x-transaction-id does not match any login. | No |
| 404 | URL_NOT_FOUNDThe request path does not exist. | No |
| 410 | THAID_RESULT_ALREADY_RETRIEVEDThe result for this transaction_id has already been retrieved. | No |
| 410 | THAID_RESULT_EXPIREDThe result expired 5 minutes after the login completed. | No |
| 500 | INTERNAL_SERVER_ERRORAn unexpected server-side error occurred. | No |
Integration notes
- Request only the
scopefields your use case actually needs — this keeps the consent screen simpler for end users and reduces the identity data you need to handle and store. - Handle all three status values: show a waiting state while
pending(the QR code is displayed on the ThaID page), complete your flow with the returned data onsuccess, and onfailedlet the user start a new login. - No action is needed when a login is abandoned — for example when the user closes the QR screen without scanning. Discard its
transaction_idand start a new login if the user tries again. - If the end user enters an incorrect ThaID PIN repeatedly, the ThaID app locks the user out for a period (currently 5 minutes) and the QR page cannot be reused. No result is reported to Verifined, so the status remains
pending. Treat a login that stayspendingbeyond your own timeout as abandoned. - Each Start a login call is counted against your usage plan. Contact Finema if you need to review your quota or billing plan.
