Open Government, Thailand API

Government / API Key Intermediate HTTPS
Varies by plan (check documentation)

Overview

Thailand Open Government Data API (data.go.th) provides access to datasets published by Thai government agencies on topics like economy, environment, health, and infrastructure. An API key is required and can be obtained free of charge after registration on the portal. It supports JSON responses and is useful for research, civic apps, or learning to work with Southeast Asian public data.

💡

Beginner Tip

Register for a free API key at data.go.th, then include it as the api_key query parameter; start with the /api/3/action/package_search endpoint to discover available datasets.

Available Data

Use case: Integrate thailand government open data data into web and mobile applications
Open Government, Thailand data via REST API
JSON-formatted response data
Requires API key authentication

Example Response

JSON Response
{
  "status": "success",
  "data": {
    "result": "Data from Open Government, Thailand",
    "description": "Thailand Government Open Data",
    "timestamp": "2025-01-15T10:00:00Z"
  }
}

Field Reference

success True if the CKAN action executed without errors
result.results List of dataset metadata objects matching the search
result.count Total number of matching datasets in the portal
result.results[].title Dataset title, typically in Thai
result.results[].resources Available file downloads including format and direct URL

Implementation Example

const url = "https://data.go.th/";
// Replace headers or query params with the values required by this API.
const response = await fetch(url, {
  headers: {
  "X-API-Key": "YOUR_API_KEY"
  }
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

Authorization error or 403 Forbidden The api_key parameter is missing or the key is invalid
Register at data.go.th to get a free API key and pass it as ?api_key=YOUR_KEY in the query string
Thai characters appear as question marks or boxes The response is UTF-8 encoded but the client is using a different charset
Ensure your HTTP client or JSON parser explicitly uses UTF-8 encoding when reading the response
Empty records array despite valid resource_id The dataset exists but data has not been loaded into the CKAN datastore
Download the file directly using the resource URL and parse it locally if the datastore API returns no records

Matrix Score Breakdown

🌐 Reachability 0/30
⚡ Speed 5/20
🔒 Security 15/15
🛠 Developer XP 12/20
✓ Reliability 0/15

Partially tested on Apr 5, 2026

Technical Specifications

Auth API Key
HTTPS REQUIRED
CORS UNKNOWN
Category Government
Difficulty Intermediate
Verified: 2026-04-04

Similar APIs

View All →