Skip to content

Authentication API

Offer “Log in with ThaID” without registering with DOPA as a Relying Party.

v1.0 Released 10 Sept 2026 DOPA · Verifined Database
Authentication API
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. 1

    The user clicks "Log in with ThaID"

    In your own web page or app.

  2. 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 an auth_url and a transaction_id.

  3. 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. 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_url with only transaction_id and status attached — no identity data.

  5. 5

    Your backend fetches the result

    It calls Check login status with the transaction_id to 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.

POSThttps://verifined.co/api/public/v1/thai-id/authenticate

Request header

  • AuthorizationstringRequired

    Your API key, in the FINEMA <api-key> format.

  • Content-TypestringOptional

    Media type of the request body: application/json.

Request body

  • scopestring[]Required

    The identity fields you want returned. At least one value is required. See allowed scope values.

  • redirect_urlstring (URL)Recommended

    A page on your own site or app. Once the login flow completes, the end user's browser is redirected here with only transaction_id and status appended as query parameters — no identity data. The status value is success or failed. 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.

Example request
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

200JSON
{
  "auth_url": "https://<thaid-authorization-page>...",
  "status": "pending",
  "transaction_id": "5f2e...-uuid",
  "tr_id": "b1a0...-uuid"
}
  • auth_urlstring

    Redirect or open the end user's browser to this URL so they can complete ThaID QR login.

  • statusstring

    Always pending when a login is started. Use Check login status to follow the login to its outcome.

  • transaction_idstring

    Identifies this login attempt. Save it — you will need it to check its status.

  • tr_idstring

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

400JSON
{
  "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.

GEThttps://verifined.co/api/public/v1/thai-id/authenticate

Request header

  • AuthorizationstringRequired

    Your API key.

  • x-transaction-idstringRequired

    The transaction_id returned by Start a login.

Example request
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

200JSON
{
  "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"
}
  • statusstring

    pending until the end user completes the ThaID scan, then success, or failed if the user declined consent in the ThaID app. Keep polling while pending.

  • dataobject

    Present only when status is success. Contains the identity fields you requested in scope, keyed by field name.

  • errorstring

    Present only when status is failed. A short description of why the login failed, for example User denied the request (disapproved).

  • error_descriptionstring

    Present only when status is failed. A machine-readable reason, for example user_denied.

  • resolved_atstring

    ISO 8601 time the result became available (when the DOPA callback was received). Present once status is success or failed.

  • expires_atstring

    ISO 8601 time after which the result can no longer be retrieved (resolved_at + 5 minutes). Later calls return 410 THAID_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.

200JSON
{
  "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

HTTPDescriptionCharged
200Start a login — the login was started; status is pending. Yes
200Check login status — status is pending, success or failed. Not charged, however many times you poll. No
400INVALID_PARAMSscope is invalid, for example it contains an unsupported value. No
400INVALID_TOKENThe Authorization header is missing. No
400Bad request — the x-transaction-id header is missing from a Check login status call. No
401INVALID_TOKENThe API key is invalid or expired. No
404TRANSACTION_NOT_FOUNDThe x-transaction-id does not match any login. No
404URL_NOT_FOUNDThe request path does not exist. No
410THAID_RESULT_ALREADY_RETRIEVEDThe result for this transaction_id has already been retrieved. No
410THAID_RESULT_EXPIREDThe result expired 5 minutes after the login completed. No
500INTERNAL_SERVER_ERRORAn unexpected server-side error occurred. No

Integration notes

  • Request only the scope fields 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 on success, and on failed let 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_id and 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 stays pending beyond 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.