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).

CodeRegionISO 3166-2Provinces / communes
01Tarapacá (TPCA)CL-TA2 / 7
02Antofagasta (ANTOF)CL-AN3 / 9
03Atacama (ATCMA)CL-AT3 / 9
04Coquimbo (COQ)CL-CO3 / 15
05Valparaíso (VALPO)CL-VS8 / 38
06Libertador General Bernardo O'Higgins (LGBO)CL-LI3 / 33
07Maule (MAULE)CL-ML4 / 30
08Biobío (BBIO)CL-BI3 / 33
09La Araucanía (ARAUC)CL-AR2 / 32
10Los Lagos (LAGOS)CL-LL4 / 30
11Aysén del General Carlos Ibáñez del Campo (AYSEN)CL-AI4 / 10
12Magallanes y de la Antártica Chilena (MAG)CL-MA4 / 11
13Metropolitana de Santiago (RM)CL-RM6 / 52
14Los Ríos (RIOS)CL-LR2 / 12
15Arica y Parinacota (AyP)CL-AP2 / 4
16Ñuble (NUBLE)CL-NB3 / 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
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):

json
{
  "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:

python
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):

output
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íso

In JavaScript (Node.js 18 or later, as an .mjs module), the provinces of the Santiago Metropolitan Region:

javascript
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:

output
131 Santiago 32
132 Cordillera 3
133 Chacabuco 3
134 Maipo 4
135 Melipilla 5
136 Talagante 5

Step 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 valueTypeReal result
RMAbbreviation6 provinces of Metropolitana de Santiago
CL-VSISO 3166-28 provinces of Valparaíso
XVIRoman numeral3 provinces of Ñuble
ValparaísoName8 provinces of Valparaíso
99Nonexistent codeError: Región no reconocida: "99". Usa el código (13), la sigla (RM) o el nombre.
  • search matches inside the name, with or without accents and ñ: nunoa and Ñuñoa both return Ñuñoa, and Concepción returns commune 08101. A partial text such as san returned 30 communes, from San Pedro de Atacama to San Nicolás.
  • search only matches names: 16101 returned 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 comuna parameter is for communal public holidays, not for filtering the list: with operation comunas and comuna 16101 the 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.

Cursor · mcp.json
{
  "mcpServers": {
    "better-llama": {
      "url": "https://mcp.betterllama.com/mcp"
    }
  }
}
Claude Code
claude mcp add --transport http better-llama https://mcp.betterllama.com/mcp

Setup 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

Other guides

This guide is also available en español.