PDPA Platform
|Documentation
API v1.0

PDPA Platform API

A comprehensive REST API for integrating PDPA compliance features into your application. Manage consent, cookie preferences, and data subject requests with simple HTTP requests.

Introduction

The PDPA Platform API provides a simple and secure way to integrate Thailand's Personal Data Protection Act compliance features into your web applications. All endpoints return JSON responses and follow RESTful conventions.

RESTful

Standard HTTP methods and status codes for easy integration.

CORS Enabled

Public endpoints support cross-origin requests from any domain.

Type Safe

Fully typed with TypeScript and OpenAPI documentation.

Base URL

All API requests should be made to the following base URL:

tsx

API Keys

Navigate to the API Keys section in your admin dashboard to generate API keys for authenticated endpoints. Public endpoints do not require authentication.

Authentication

The API uses API keys for authentication on protected endpoints. Include your API key in the Authorization header:

tsx

Security Best Practices

  • Never expose secret API keys in client-side code
  • Use Public API endpoints for browser-based consent collection
  • Rotate API keys periodically for enhanced security
  • Store API keys in environment variables, never in code

Public vs Authenticated Endpoints

Most Public endpoints (/public/*) do not require authentication and are designed to be called directly from browsers for data submission. However, the GET /public/consent/:websiteId/:userId endpoint will require a valid API key starting April 4, 2026. All other non-public endpoints require a valid API key.

Public API

The Public API allows external websites to submit consent data, cookie preferences, data subject requests, and form submissions without requiring authentication. All endpoints are CORS-enabled and accept requests from any origin.

Important

All Public API endpoints require a valid websiteId parameter. The website ID is used to validate and route data to the correct project. You can find your Website ID in the admin dashboard under Website Settings.

Base URL

tsx

Available Endpoints

EndpointMethodDescription
/consent/submitPOSTSubmit generic consent logs (terms, privacy policy, etc.)
/cookie-consent/submitPOSTSubmit detailed cookie consent records
/data-subject-request/submitPOSTSubmit data subject access requests (DSAR)
/form/submitPOSTSubmit custom form data
/form/:formIdGETRetrieve public form configuration
/consent/:websiteId/:userIdGETGet latest consent data for a user (API key required after 2026-04-04)

CORS Support

All Public API endpoints support Cross-Origin Resource Sharing (CORS) and accept requests from any domain. This allows you to embed consent collection directly on your websites without proxying through your backend.

tsx

Data Subject Requests

Allow users to submit data subject access requests (DSAR) directly from your website. This creates a new request in your PDPA Platform dashboard for processing.

Submit Data Subject Request

POST /public/data-subject-request/submit

tsx

Request Types

The data_subject field accepts an array of the following values:

CodeEnglishThai
withdraw_consentWithdraw Consentถอนความยินยอม
accessAccessขอเข้าถึงข้อมูล
data_portabilityData Portabilityถ่ายโอนข้อมูล
deletionDeletionลบหรือทำลาย
correctionCorrectionแก้ไขข้อมูล
restrictionRestrictionระงับการใช้
objectionObjectionคัดค้าน
source_disclosureSource Disclosureเปิดเผยแหล่งที่มา

DSR Form Component (React)

Complete React component for submitting data subject requests with multiple types.

tsx

Form Submission

Submit data to custom consent forms created in your PDPA Platform dashboard. You can also retrieve form configuration to dynamically render forms on your website.

Get Form Configuration

GET /public/form/:formId?websiteId=:websiteId

tsx

Response Fields

FieldTypeDescription
idstringForm ID
eventNamestringForm name/event name
fieldsConfigobjectForm field configuration
contentobjectBilingual content (en, th)
retentionDaysnumberData retention period

Submit Form Data

POST /public/form/submit

tsx

Request Parameters

FieldTypeRequiredDescription
formIdstringYesForm ID
websiteIdstringYesWebsite ID
formDataobjectYesDynamic form field data
languagestringYesLanguage code (en or th)
ipAddressstringNoClient IP (auto-detected)
userAgentstringNoUser agent (auto-detected)
deviceTypestringNoDevice type (auto-detected)
browserInfostringNoBrowser info (auto-detected)

Complete Form Integration

Dynamic form rendering and submission example.

tsx

Form Security

The form endpoint validates that the form exists, is published, and belongs to the specified website. Submissions are only accepted for PUBLISHED forms. Draft or non-existent forms will return a 400/404 error.

Response Format

All API responses follow a consistent JSON structure with a discriminated union pattern for success and error states.

Success Response

tsx

Error Response

tsx

HTTP Status Codes

StatusDescription
200 OKRequest succeeded
400 Bad RequestInvalid request parameters
401 UnauthorizedMissing or invalid API key
404 Not FoundResource not found
500 Server ErrorInternal server error

Ready to integrate?

Get started with the PDPA Platform API today and ensure your application is fully compliant with Thailand's data protection regulations.