# Thai e-GP Procurement Contracts (`artisan27/thai-egp-procurement`) Actor

Scrape Thai Government Procurement System (e-GP) contracts via the official opend.data.go.th API. Returns English field names, ISO 8601 dates, THB + USD amounts, department hierarchy, and winner TIN — ready for compliance, due diligence, and market intelligence use cases.

- **URL**: https://apify.com/artisan27/thai-egp-procurement.md
- **Developed by:** [Nitirat Thaploi](https://apify.com/artisan27) (community)
- **Categories:** Other
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-usage

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Thai Government Procurement Contracts (e-GP)

Scrape **4.6 million+** Thai government procurement contracts from the official e-GP system via the [opend.data.go.th](https://opend.data.go.th) API.

Returns clean, analysis-ready JSON: English field names, ISO 8601 dates, THB + USD amounts, department hierarchy, winner TIN — ready for compliance screening, market intelligence, and due diligence workflows.

### What you get

Each record includes:

| Field | Example |
|-------|---------|
| `projectId` | `"67039549408"` |
| `projectName` | `"Double-track railway Khon Kaen–Nong Khai (e-bidding)"` |
| `contractNumber` | `"กส.14/ทค./2567"` |
| `contractDateISO` | `"2024-12-12"` |
| `contractFinishDateISO` | `"2028-03-31"` |
| `contractStatus` | `"In progress"` |
| `budgetYearBE` | `2568` |
| `budgetYearCE` | `2025` |
| `awardedAmountTHB` | `28759000000` |
| `awardedAmountUSDApprox` | `787917808.22` |
| `department` | `"State Railway of Thailand"` |
| `departmentSub` | `"Special Projects Division"` |
| `province` | `"Bangkok"` |
| `procurementMethod` | `"e-bidding"` |
| `winner` | `"CH. Karnchang – AS Construction JV"` |
| `winnerTin` | `"0993000510631"` |

### Input

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `apiKey` | string | **required** | Free API key from [opend.data.go.th](https://opend.data.go.th/register_api/signup.php) |
| `year` | integer | current Thai fiscal year | Buddhist Era year (e.g. `2568` = FY 2025) |
| `keyword` | string | — | Search project names, e.g. `"hospital"` or `"โรงพยาบาล"` |
| `deptCode` | string | — | Government department code, e.g. `"0806"` |
| `budgetStart` | integer | — | Minimum contract value in THB |
| `budgetEnd` | integer | — | Maximum contract value in THB |
| `winnerTin` | string | — | Filter by winning company tax ID |
| `maxPages` | integer | `50` | Pages to fetch (100 records/page) |
| `thbPerUsd` | number | `36.5` | FX rate for USD conversion |

### Getting your free API key

1. Register at [opend.data.go.th/register_api/signup.php](https://opend.data.go.th/register_api/signup.php)
2. Confirm email and log in
3. Copy your API key from the dashboard
4. Paste it into the `apiKey` input field

### Use cases

- **Vendor intelligence** — find which companies win government contracts in specific sectors
- **Compliance & due diligence** — screen counterparties against Thai procurement winners by TIN
- **Market research** — identify spending trends by ministry, province, or procurement method
- **Investment research** — track large infrastructure contracts (railways, highways, hospitals)

### Data source

Official Thai Government Procurement System (e-GP) via `api-govspending.data.go.th`. Updated daily. Coverage: FY 2558 – present (4.6M+ contracts).

# Actor input Schema

## `apiKey` (type: `string`):

Your API key from opend.data.go.th (register free at https://opend.data.go.th/register_api/signup.php)
## `year` (type: `integer`):

Thai Buddhist Era year, e.g. 2567 = 2024 CE. Leave blank to use the current year.
## `deptCode` (type: `string`):

Government department code for filtering, e.g. '0205'. Leave blank for all departments.
## `budgetStart` (type: `integer`):

Minimum contract value in Thai Baht. e.g. 10000000 = 10 million THB.
## `budgetEnd` (type: `integer`):

Maximum contract value in Thai Baht. Leave blank for no upper limit.
## `keyword` (type: `string`):

Thai or English keyword to search in project names, e.g. 'โรงพยาบาล' (hospital).
## `winnerTin` (type: `string`):

Tax ID number of the winning company to filter by, e.g. '0105550016345'.
## `maxPages` (type: `integer`):

Maximum number of API pages to fetch. Each page contains up to 100 records. Default: 50.
## `thbPerUsd` (type: `number`):

Approximate exchange rate for USD conversion. Default: 36.5

## Actor input object example

```json
{
  "maxPages": 50,
  "thbPerUsd": 36.5
}
````

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("artisan27/thai-egp-procurement").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("artisan27/thai-egp-procurement").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call artisan27/thai-egp-procurement --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=artisan27/thai-egp-procurement",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Thai e-GP Procurement Contracts",
        "description": "Scrape Thai Government Procurement System (e-GP) contracts via the official opend.data.go.th API. Returns English field names, ISO 8601 dates, THB + USD amounts, department hierarchy, and winner TIN — ready for compliance, due diligence, and market intelligence use cases.",
        "version": "0.1",
        "x-build-id": "L1504JE9pnIuE8PqS"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/artisan27~thai-egp-procurement/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-artisan27-thai-egp-procurement",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/artisan27~thai-egp-procurement/runs": {
            "post": {
                "operationId": "runs-sync-artisan27-thai-egp-procurement",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/artisan27~thai-egp-procurement/run-sync": {
            "post": {
                "operationId": "run-sync-artisan27-thai-egp-procurement",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "apiKey"
                ],
                "properties": {
                    "apiKey": {
                        "title": "API Key",
                        "type": "string",
                        "description": "Your API key from opend.data.go.th (register free at https://opend.data.go.th/register_api/signup.php)"
                    },
                    "year": {
                        "title": "Budget Year (Buddhist Era)",
                        "minimum": 2550,
                        "maximum": 2600,
                        "type": "integer",
                        "description": "Thai Buddhist Era year, e.g. 2567 = 2024 CE. Leave blank to use the current year."
                    },
                    "deptCode": {
                        "title": "Department Code",
                        "type": "string",
                        "description": "Government department code for filtering, e.g. '0205'. Leave blank for all departments."
                    },
                    "budgetStart": {
                        "title": "Budget Min (THB)",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Minimum contract value in Thai Baht. e.g. 10000000 = 10 million THB."
                    },
                    "budgetEnd": {
                        "title": "Budget Max (THB)",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Maximum contract value in Thai Baht. Leave blank for no upper limit."
                    },
                    "keyword": {
                        "title": "Keyword",
                        "type": "string",
                        "description": "Thai or English keyword to search in project names, e.g. 'โรงพยาบาล' (hospital)."
                    },
                    "winnerTin": {
                        "title": "Winner TIN",
                        "type": "string",
                        "description": "Tax ID number of the winning company to filter by, e.g. '0105550016345'."
                    },
                    "maxPages": {
                        "title": "Max Pages",
                        "minimum": 1,
                        "maximum": 500,
                        "type": "integer",
                        "description": "Maximum number of API pages to fetch. Each page contains up to 100 records. Default: 50.",
                        "default": 50
                    },
                    "thbPerUsd": {
                        "title": "THB per USD (FX rate)",
                        "minimum": 20,
                        "maximum": 60,
                        "type": "number",
                        "description": "Approximate exchange rate for USD conversion. Default: 36.5",
                        "default": 36.5
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
