x402 · USDC on Base · no API key
Indonesian reference data for AI agents
Official region codes and KBLI 2025 business classification as a pay-per-request JSON API. Your agent pays per call over HTTP 402, from $0.002. No account, no subscription, no key to manage.
What it covers
Two datasets that Indonesian business, logistics and government workflows depend on, cleaned up and searchable.
Wilayah: administrative regions
Every province, regency/city, district and village with its official code and full hierarchy, based on Kepmendagri No. 300.2.2-2430/2025. Search by name, or resolve a code to its name. Prefixes like "Kab.", "Kota" and "Kec." are handled.
KBLI 2025: business classification
Find the right 5-digit KBLI 2025 code from a business description in Indonesian or English. KBLI 2025 has been mandatory in OSS licensing since 15 June 2026. Old KBLI 2020 codes convert via the official BPS table, and one-to-many splits are flagged.
Endpoints and pricing
Prices in USD, paid in USDC on Base mainnet. You pay per successful request.
| Route | Price | Returns |
|---|---|---|
| GET /v1/wilayah/search?q=&level=&parent=&limit= | $0.005 | Regions matching a name, with code and hierarchy. Filter by level or parent code. |
| GET /v1/wilayah/{kode} | $0.002 | Name, type and hierarchy for a code such as 34.71. |
| GET /v1/kbli/search?q=&level=&limit= | $0.02 | KBLI 2025 codes for a business activity, with official titles and descriptions. |
| GET /v1/kbli/convert?code= | $0.02 | KBLI 2025 equivalent(s) of a KBLI 2020 code. |
| GET / · /health · /llms.txt | free | Endpoint index, status, agent-readable docs. |
Error responses (4xx/5xx) are never charged. Payment settles only after a successful response.
How payment works
lokalapi uses x402, an open standard for payments over plain HTTP. All endpoints are listed in the Coinbase x402 Bazaar, so x402-aware agents can find them on their own.
- Your agent calls an endpoint. The API replies
402 Payment Requiredwith the price, network and receiving address in thePAYMENT-REQUIREDheader. - An x402 client signs a USDC transfer authorization for exactly that amount with the agent's wallet. No gas is needed on the client side.
- The client retries with the signature attached. The API responds with the data, and the transfer settles on Base. The receipt is returned in the
PAYMENT-RESPONSEheader.
Client libraries: @x402/fetch, @x402/axios, @x402/mcp (JavaScript), x402 (Python), and other x402-compatible agent frameworks.
Example
Without payment you get the 402 offer. With an x402 client, the same request returns data.
1 · Check the price
curl -i "https://api.lokalapi.com/v1/wilayah/34.04.12" HTTP/2 402 payment-required: eyJ4NDAyVmVyc2lvbiI6Mi... # base64 JSON: amount, asset, network, payTo
2 · Pay and fetch (Node.js)
import { x402Client } from "@x402/core/client"; import { registerExactEvmScheme } from "@x402/evm/exact/client"; import { wrapFetchWithPayment } from "@x402/fetch"; import { privateKeyToAccount } from "viem/accounts"; const client = new x402Client(); registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.AGENT_KEY) }); const pay = wrapFetchWithPayment(fetch, client); const res = await pay("https://api.lokalapi.com/v1/wilayah/34.04.12"); console.log(await res.json());
Response
{
"kode": "34.04.12",
"nama": "Ngaglik",
"level": "kecamatan",
"jenis": "Kecamatan",
"hierarchy": {
"provinsi": { "kode": "34", "nama": "Daerah Istimewa Yogyakarta", ... },
"kabupaten_kota": { "kode": "34.04", "nama": "Kabupaten Sleman", ... },
"kecamatan": { "kode": "34.04.12", "nama": "Ngaglik", ... }
},
"jumlah_wilayah_di_bawahnya": 6,
"source": { "legal_basis": "Kepmendagri No. 300.2.2-2430 Tahun 2025", ... }
}
Sources
Every response carries a source field. The data comes from:
Region codes
Keputusan Menteri Dalam Negeri (Kemendagri) No. 300.2.2-2430 Tahun 2025, compiled by cahyadsn/wilayah (MIT License).
KBLI 2025 and conversion table
Badan Pusat Statistik (BPS-Statistics Indonesia), bps.go.id. Reused under the BPS terms of use, with attribution.
Reference data, not legal advice. Verify licensing requirements on oss.go.id.