Guide · Chile utilities
Chile communes API: regions, provinces and CUT codes as JSON for your code and your AI agents
How to get Chile's administrative divisions from your code or an AI agent: the 16 regions, 56 provinces and 346 communes (comunas, the municipalities) with their official CUT code, filtered by region or searched by name, as JSON. With Better Llama's MCP tool, no key or sign-up.
What is a commune's CUT code?
The Single Territorial Code (CUT, Código Único Territorial) identifies every region, province and commune in Chile. It is set by the Undersecretariat for Regional and Administrative Development (SUBDERE), and the current version is the one in Exempt Decree No. 1,115 of 2018, which includes the Ñuble Region. A commune code has 5 digits: the first 2 are the region, the third completes the province and the last 2 are the commune. In 13120 (Ñuñoa), 13 is the Santiago Metropolitan Region and 131 the province of Santiago.
Using the CUT instead of the name avoids the usual problems: accents and the letter ñ (Ñuñoa, Concepción), names shared by a commune and a province (Valparaíso, Concepción, San Antonio) and spreadsheets that spell the same commune in several ways. It is the code used by Chile's statistics office (INE), its electoral service (Servel) and many government systems to join data.
Our tool chile_calendar_and_rut serves the full list with no external calls, through the operations regiones, provincias and comunas. In the query of Monday, November 23, 2026 at 16:20 (Chile time) it returned 16 regions, 56 provinces and 346 communes.
Chile's 16 regions with their codes
Real response of operation regiones: CUT code, name, abbreviation, ISO 3166-2 code and how many provinces and communes each one has. Each region also comes with its Roman numeral (romanNumeral).
| Code | Region | ISO 3166-2 | Provinces / communes |
|---|---|---|---|
01 | Tarapacá (TPCA) | CL-TA | 2 / 7 |
02 | Antofagasta (ANTOF) | CL-AN | 3 / 9 |
03 | Atacama (ATCMA) | CL-AT | 3 / 9 |
04 | Coquimbo (COQ) | CL-CO | 3 / 15 |
05 | Valparaíso (VALPO) | CL-VS | 8 / 38 |
06 | Libertador General Bernardo O'Higgins (LGBO) | CL-LI | 3 / 33 |
07 | Maule (MAULE) | CL-ML | 4 / 30 |
08 | Biobío (BBIO) | CL-BI | 3 / 33 |
09 | La Araucanía (ARAUC) | CL-AR | 2 / 32 |
10 | Los Lagos (LAGOS) | CL-LL | 4 / 30 |
11 | Aysén del General Carlos Ibáñez del Campo (AYSEN) | CL-AI | 4 / 10 |
12 | Magallanes y de la Antártica Chilena (MAG) | CL-MA | 4 / 11 |
13 | Metropolitana de Santiago (RM) | CL-RM | 6 / 52 |
14 | Los Ríos (RIOS) | CL-LR | 2 / 12 |
15 | Arica y Parinacota (AyP) | CL-AP | 2 / 4 |
16 | Ñuble (NUBLE) | CL-NB | 3 / 21 |
Codes are 2-digit strings with a leading zero (01, 05), and so are commune codes (05101). If your spreadsheet stored them as numbers and lost the zero, pad them before joining, as in the Python example below.
Step by step: Chile's communes by API
Step 1. Choose the operation
Use operation regiones, provincias or comunas. To narrow it down, add region (code, abbreviation, ISO 3166-2, Roman numeral or name) or search by name with search.
Step 2. Connect the MCP server
Use the MCP https://mcp.betterllama.com/mcp in your client (setup below) or call it over HTTP with JSON-RPC. No key or sign-up is needed during the beta.
Step 3. Call the tool
With curl, find a commune by name (it also works without accents):
curl -s https://mcp.betterllama.com/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "chile_calendar_and_rut", "arguments": {"operation": "comunas", "search": "nunoa"}}}'Real, complete response (November 23, 2026, 16:20 Chile time):
{
"tool": "chile_calendar_and_rut",
"count": 1,
"results": [
{
"kind": "comuna",
"code": "13120",
"name": "Ñuñoa",
"provinceCode": "131",
"provinceName": "Santiago",
"regionCode": "13",
"regionName": "Metropolitana de Santiago",
"regionIso3166_2": "CL-RM",
"source": "SUBDERE – Códigos Únicos Territoriales (Decreto Exento N° 1.115 de 2018, actualizado al 06-09-2018)",
"sourceUrl": "https://www.subdere.gov.cl/documentacion/c%C3%B3digos-%C3%BAnicos-territoriales-actualizados-al-06-de-septiembre-2018"
}
],
"warnings": [],
"stopReason": "completed",
"attribution": "Calculado por Better Llama a partir de leyes de feriados y la División Político-Administrativa publicadas por el Estado de Chile.",
"source": "https://betterllama.com/",
"retrievedAt": "2026-11-23T19:20:35.210Z"
}In Python, get all 346 communes in a single call and index them by CUT code to complete a spreadsheet:
import json
import requests
MCP = "https://mcp.betterllama.com/mcp"
HEADERS = {"Accept": "application/json, text/event-stream"}
def call(arguments):
body = {"jsonrpc": "2.0", "id": 1, "method": "tools/call",
"params": {"name": "chile_calendar_and_rut", "arguments": arguments}}
r = requests.post(MCP, json=body, headers=HEADERS, timeout=60)
r.raise_for_status()
return json.loads(r.json()["result"]["content"][0]["text"])
# All 346 communes in one call, indexed by CUT code
data = call({"operation": "comunas", "maxItems": 1000})
by_cut = {c["code"]: c for c in data["results"]}
print(len(by_cut), "communes")
# Codes as they come in a spreadsheet (sometimes without the leading zero)
sheet = ["13120", "8101", "16101", "5101"]
for code in sheet:
c = by_cut[code.zfill(5)]
print(code.zfill(5), c["name"], "|", c["provinceName"], "|", c["regionName"])Real output (November 23, 2026, 16:21 Chile time):
346 communes
13120 Ñuñoa | Santiago | Metropolitana de Santiago
08101 Concepción | Concepción | Biobío
16101 Chillán | Diguillín | Ñuble
05101 Valparaíso | Valparaíso | ValparaísoIn JavaScript (Node.js 18 or later, as an .mjs module), the provinces of the Santiago Metropolitan Region:
const MCP = "https://mcp.betterllama.com/mcp";
async function call(args) {
const r = await fetch(MCP, {
method: "POST",
headers: { "Content-Type": "application/json", Accept: "application/json, text/event-stream" },
body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "tools/call",
params: { name: "chile_calendar_and_rut", arguments: args } }),
});
const json = await r.json();
return JSON.parse(json.result.content[0].text);
}
// Provinces of the Santiago Metropolitan Region, with their number of communes
const { results } = await call({ operation: "provincias", region: "RM" });
for (const p of results) console.log(p.code, p.name, p.comunaCount);Real output:
131 Santiago 32
132 Cordillera 3
133 Chacabuco 3
134 Maipo 4
135 Melipilla 5
136 Talagante 5Step 4. Use the result
Each commune comes back with code (5-digit CUT), name, provinceCode, provinceName, regionCode, regionName, regionIso3166_2, source and sourceUrl. Provinces also include comunaCount, and regions provinceCount and comunaCount.
Filter by region and search by name
The region parameter accepts several ways of writing the same region. Real results with operation provincias:
| region value | Type | Real result |
|---|---|---|
RM | Abbreviation | 6 provinces of Metropolitana de Santiago |
CL-VS | ISO 3166-2 | 8 provinces of Valparaíso |
XVI | Roman numeral | 3 provinces of Ñuble |
Valparaíso | Name | 8 provinces of Valparaíso |
99 | Nonexistent code | Error: Región no reconocida: "99". Usa el código (13), la sigla (RM) o el nombre. |
searchmatches inside the name, with or without accents and ñ:nunoaandÑuñoaboth return Ñuñoa, andConcepciónreturns commune08101. A partial text such assanreturned 30 communes, from San Pedro de Atacama to San Nicolás.searchonly matches names:16101returned no results. To go from a code to its commune, fetch the list (once) and look it up there, as in the Python example; the first 2 digits tell you the region.- The
comunaparameter is for communal public holidays, not for filtering the list: withoperationcomunasandcomuna16101the response returned the 21 communes of its region, Ñuble.
How many results each call returns
The response returns at most maxItems results: 50 by default and up to 1000. Without maxItems, the list of communes for all of Chile returned 50 communes and "stopReason": "maxItems"; with "maxItems": 1000 it returned all 346 and "stopReason": "completed". Always check stopReason.
The list changes very rarely (the last change was the creation of Ñuble), so you can store it in your system and refresh it now and then. If a region does not exist, the tool answers with an error (isError) and the message Región no reconocida: "99". Usa el código (13), la sigla (RM) o el nombre.
Communes in forms and public holidays
In an address form, ask for the region first and then the commune, with visible labels (not just placeholder text inside the field). With 346 communes, a field that suggests options as the user types is easier than a long list; use search without accents and, when nothing matches, show a suggestion instead of an empty list. Store the CUT code, not the name.
The commune also changes the calendar: with operation es_feriado, the date 2026-08-20 and comuna 16101 (Chillán), the real response was "isHoliday": true because of the holiday Nacimiento del Prócer de la Independencia (Bernardo O'Higgins)
. More in the Chile public holidays API guide.
Chile's communes from your AI agent (MCP)
Add Better Llama's MCP server to your client (Claude, Cursor, VS Code or any other with remote MCP). One MCP brings chile_calendar_and_rut and the rest of the catalog, with no sign-up during the beta.
{
"mcpServers": {
"better-llama": {
"url": "https://mcp.betterllama.com/mcp"
}
}
}claude mcp add --transport http better-llama https://mcp.betterllama.com/mcpSetup for Claude, Codex, Gemini CLI, Windsurf, VS Code and other clients: connect your agent.
Ready-to-run Python and Node.js examples, with config files for each client: examples repository on GitHub.
Then ask, for example: “Add the CUT code and the region of each commune to this spreadsheet.” or “How many communes does the province of Santiago have, and which are they?” The agent uses the official list instead of recalling it from memory, where it is easy to miss or invent a commune.
Beta: free and with no sign-up while we test the service.
Pricing
Free during the beta, no sign-up, with a limit of 60 requests per minute per IP. If paid plans come later, we will announce them on betterllama.com first.
Frequently asked questions
How many communes does Chile have?
According to SUBDERE's Single Territorial Codes (Exempt Decree No. 1,115 of 2018), Chile has 346 communes, 56 provinces and 16 regions. The chile_calendar_and_rut tool returns the full list with maxItems 1000.
What is a commune's CUT code?
It is the 5-digit Single Territorial Code set by SUBDERE: the first 2 digits are the region, the third completes the province and the last 2 the commune. For example, 13120 is Ñuñoa, in province 131 (Santiago) of region 13 (Metropolitan).
Is there a free API for Chile's communes?
Yes. The chile_calendar_and_rut tool on Better Llama's MCP returns regions, provinces and communes with their CUT code for free during the beta, with no sign-up, over MCP or JSON-RPC, with a limit of 60 requests per minute per IP.
How do I filter the communes of a region?
Use operation comunas with region: it accepts the code (13), the abbreviation (RM), the ISO 3166-2 code (CL-RM), the Roman numeral or the name. The Santiago Metropolitan Region has 52 communes, so ask for maxItems 100 or more to get them all.
Can I search for a commune without accents?
Yes. search matches inside the name with or without accents and ñ: nunoa and Ñuñoa both return Ñuñoa. To look up a CUT code, fetch the full list and find it there.
Why does the code start with a zero?
Regions 1 to 9 have 2-digit codes with a leading zero (01 to 09), so their communes start with 0, like 05101 (Valparaíso). Treat them as strings; if a spreadsheet dropped the zero, pad them to 5 digits.
How often does the list of communes change?
Very rarely: only when a law creates or changes regions, provinces or communes. The current version of the codes is the one in Exempt Decree No. 1,115 of 2018, which added the Ñuble Region.
Is Better Llama affiliated with SUBDERE?
No. Better Llama is an independent project, not affiliated with, sponsored by or endorsed by SUBDERE or the Government of Chile. The codes come from SUBDERE's official publication.
Keep going
- Chile public holidays API guide: national, regional and communal holidays and business days with the same tool.
- Chile business days API guide: business-day deadlines with regional and local holidays.
- Chile RUT validation API guide: check digit, formats and batches with the same tool.
- Chile fuel prices API guide: prices by station and commune.
- Chilexpress API guide: coverage by commune, quotes and shipment tracking.
- Chile utilities tool page: parameters, example and FAQ.
Other guides
- Chile open data APIs: official sources by API and MCP — map of the official Chilean sources available by API and MCP, how to find the tool with search_tools, one real call per family and an index of every guide.
- Chile public holidays API: 2026 holidays, business days and RUT — National, regional and local holidays with no key, curl and Python examples, and MCP usage.
- Chile business days API: deadlines and business-day counts — business-day deadlines from a notice date, Saturdays as business days, calendar days, business days per month, regional holidays and edge cases, with curl, Python and JavaScript, and MCP usage.
- Chile RUT validation API: check digit as JSON — the modulo 11 algorithm, accepted formats, computing the check digit, batches and privacy, curl, Python and JavaScript examples, and MCP usage.
- Chile public procurement API: Mercado Público tenders and purchase orders — ChileCompra ticket, curl and Python examples, and MCP usage.
- Chile economic indicators API: UF, dollar, euro, CPI and TPM — One real call per indicator (UF, dollar, euro, UTM, CPI, TMC, TIP, TPM, Imacec, GDP, unemployment and real exchange rate), from the CMF or the Central Bank, with curl, Python, JavaScript and MCP.
- Chile UF API: the Unidad de Fomento value as JSON — today's UF, full month, next month's days already published, range or year, with CMF data and a Central Bank cross-check, curl, Python and JavaScript examples, and MCP usage.
- Chile USD/CLP exchange rate API: the observed dollar as JSON — today's rate, daily series by month, range or year and the warning for values published in advance, with CMF data, curl, Python and JavaScript examples, and MCP usage.
- Central Bank of Chile API: BDE series as JSON — dollar, UF, policy rate, CPI, Imacec, GDP, unemployment and any series by code, series search, curl, Python and JavaScript examples, and MCP usage.
- Chile CMF API: UF value, dollar, UTM and maximum conventional rate — the seven API CMF Bancos series with no API key to request, curl and Python examples, and MCP usage.
- Chile fuel prices API: gasoline 93, 95, 97, diesel and LPG from Bencina en Línea — CNE data with no sign-up, the cheapest by comuna or near a point, curl, Python and JavaScript examples, and MCP usage.
- Chilexpress API: coverage by comuna, shipping quotes and tracking — covered comunas and sectors with their code and no key, names that differ from the official ones, quotes and tracking with your free keys, and MCP usage.
- Chile earthquakes API: latest quake, magnitude, depth and alerts — Public-domain USGS data with Chile local time, no USGS key, curl and Python examples, and MCP usage.
- Chile Official Gazette API: laws, decrees and new companies — Laws, decrees, notices and company incorporations with CVE and official PDF, no key, curl and Python examples, and MCP usage.
- Chile electricity market API: marginal cost, generation and demand — Coordinador Eléctrico Nacional grid data with no user_key to request, curl and Python examples, and MCP usage.
- Colombia SECOP II API: public procurement contracts and processes — Open data from datos.gov.co with no key, curl and Python examples, and MCP usage.
- Colombia TRM API: today's TRM and the COP/USD rate — Superintendencia Financiera data via datos.gov.co with no key, curl and Python examples, and MCP usage.
- Peru BCRP API: exchange rate, inflation and rates — BCRPData series with no key, curl and Python examples, and MCP usage.
- Banxico API: Mexico's FIX exchange rate, UDIS and TIIE — Banco de México SIE indicators with no token to request, curl and Python examples, and MCP usage.
This guide is also available en español.