Resources
SDKs & Libraries
Official and community SDKs for the Cambodia Postal Code API
Official SDK
JavaScript / TypeScript
npm install @cambodiapostalcode/sdkimport { CambodiaPostalCode } from '@cambodiapostalcode/sdk';
const client = new CambodiaPostalCode({ apiKey: 'YOUR_API_KEY' });
const provinces = await client.provinces.list();
const result = await client.lookup('120101');Community Libraries
The base URL for all examples below is:
| Environment | Base URL |
|---|---|
| Production | https://api.cambodiapostalcode.com/v1 |
Python
import requests
headers = {"x-api-key": "YOUR_API_KEY"}
response = requests.get("BASE_URL/provinces", headers=headers)Replace BASE_URL with the base URL shown above.
PHP
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "BASE_URL/provinces");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["x-api-key: YOUR_API_KEY"]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);Replace BASE_URL with the base URL shown above.
cURL
No SDK needed — just use cURL or any HTTP client:
curl -H "x-api-key: YOUR_API_KEY" \
https://api.cambodiapostalcode.com/v1/provinces