Wilayas & Communes d'Algérie
Code Géographique National - Juin 2021 — 58 wilayas, 1 541 communes — Voir la carte interactive
| Code ONS | Code Postal | Wilaya | Commune | Commune (Arabe) |
|---|---|---|---|---|
| 341173 | 34016 | BORDJ BOU ARRERIDJ برج بوعريريج | DJAAFRA | جعافرة |
| 341174 | 34029 | BORDJ BOU ARRERIDJ برج بوعريريج | EL EUCH | العش |
| 341175 | 34006 | BORDJ BOU ARRERIDJ برج بوعريريج | EL ACHIR | الياشير |
| 341176 | 34030 | BORDJ BOU ARRERIDJ برج بوعريريج | EL ANNASSEUR | العناصر |
| 341177 | BORDJ BOU ARRERIDJ برج بوعريريج | ELHAMMADIA | الحمادية | |
| 341178 | 34018 | BORDJ BOU ARRERIDJ برج بوعريريج | EL MAIN | الماين |
| 341179 | 34019 | BORDJ BOU ARRERIDJ برج بوعريريج | EL M'HIR | المهير |
| 341180 | 34031 | BORDJ BOU ARRERIDJ برج بوعريريج | GHAILASA | غيلاسة |
| 341181 | 34047 | BORDJ BOU ARRERIDJ برج بوعريريج | HARAZA | حرازة |
| 341182 | 34068 | BORDJ BOU ARRERIDJ برج بوعريريج | HASNAOUA | حسناوة |
| 341183 | 34028 | BORDJ BOU ARRERIDJ برج بوعريريج | KHELIL | خليل |
| 341184 | 34048 | BORDJ BOU ARRERIDJ برج بوعريريج | KSOUR | القصور |
| 341185 | 34008 | BORDJ BOU ARRERIDJ برج بوعريريج | MANSOURA | المنصورة |
| 341186 | 00000 | BORDJ BOU ARRERIDJ برج بوعريريج | MEDJANA | مجانة |
| 341187 | 34032 | BORDJ BOU ARRERIDJ برج بوعريريج | OULED BRAHEM | أولاد أبراهم |
| 341188 | 34033 | BORDJ BOU ARRERIDJ برج بوعريريج | OULED DAHMANE | أولاد دحمان |
| 341189 | 34052 | BORDJ BOU ARRERIDJ برج بوعريريج | OULED SIDI-BRAHIM | أولاد سيدي ابراهيم |
| 341190 | 34035 | BORDJ BOU ARRERIDJ برج بوعريريج | RABTA | الرابطة |
| 341191 | 00000 | BORDJ BOU ARRERIDJ برج بوعريريج | RAS EL OUED | رأس الوادي |
| 341192 | 34020 | BORDJ BOU ARRERIDJ برج بوعريريج | SIDI-EMBAREK | سيدي أمبارك |
DJAAFRA
جعافرة
341173
34016
BORDJ BOU ARRERIDJ — برج بوعريريج
EL EUCH
العش
341174
34029
BORDJ BOU ARRERIDJ — برج بوعريريج
EL ACHIR
الياشير
341175
34006
BORDJ BOU ARRERIDJ — برج بوعريريج
EL ANNASSEUR
العناصر
341176
34030
BORDJ BOU ARRERIDJ — برج بوعريريج
ELHAMMADIA
الحمادية
341177
BORDJ BOU ARRERIDJ — برج بوعريريج
EL MAIN
الماين
341178
34018
BORDJ BOU ARRERIDJ — برج بوعريريج
EL M'HIR
المهير
341179
34019
BORDJ BOU ARRERIDJ — برج بوعريريج
GHAILASA
غيلاسة
341180
34031
BORDJ BOU ARRERIDJ — برج بوعريريج
HARAZA
حرازة
341181
34047
BORDJ BOU ARRERIDJ — برج بوعريريج
HASNAOUA
حسناوة
341182
34068
BORDJ BOU ARRERIDJ — برج بوعريريج
KHELIL
خليل
341183
34028
BORDJ BOU ARRERIDJ — برج بوعريريج
KSOUR
القصور
341184
34048
BORDJ BOU ARRERIDJ — برج بوعريريج
MANSOURA
المنصورة
341185
34008
BORDJ BOU ARRERIDJ — برج بوعريريج
MEDJANA
مجانة
341186
00000
BORDJ BOU ARRERIDJ — برج بوعريريج
OULED BRAHEM
أولاد أبراهم
341187
34032
BORDJ BOU ARRERIDJ — برج بوعريريج
OULED DAHMANE
أولاد دحمان
341188
34033
BORDJ BOU ARRERIDJ — برج بوعريريج
OULED SIDI-BRAHIM
أولاد سيدي ابراهيم
341189
34052
BORDJ BOU ARRERIDJ — برج بوعريريج
RABTA
الرابطة
341190
34035
BORDJ BOU ARRERIDJ — برج بوعريريج
RAS EL OUED
رأس الوادي
341191
00000
BORDJ BOU ARRERIDJ — برج بوعريريج
SIDI-EMBAREK
سيدي أمبارك
341192
34020
BORDJ BOU ARRERIDJ — برج بوعريريج
Documentation API
GET /api/wilayas
GET /api/wilayas/{code}
GET /api/communes
GET
/api/wilayas
Retourne la liste des 58 wilayas d'Algérie. Chaque wilaya contient son code (sur 2 chiffres), son nom en français et son nom en arabe.
Un paramètre de recherche optionnel permet de filtrer par code, nom français ou nom arabe.
Paramètres
| Nom | Type | Description |
|---|---|---|
| q optionnel | string | Recherche sur le code, le nom français ou le nom arabe de la wilaya |
Réponse 200 OK
[ { "code": "16", "name": "ALGER", "name_ar": "الجزائر" }, { "code": "31", "name": "ORAN", "name_ar": "وهران" } // ... ]
PHP
Python
cURL
// Lister toutes les wilayas $response = file_get_contents('https://data.dz-immo.com/api/wilayas'); $wilayas = json_decode($response, true); foreach ($wilayas as $w) { echo $w['code'] . ' - ' . $w['name'] . ' (' . $w['name_ar'] . ")\n"; } // Rechercher une wilaya par nom $q = urlencode('alger'); $results = json_decode( file_get_contents("https://data.dz-immo.com/api/wilayas?q={$q}"), true ); // Avec cURL (gestion d'erreurs) $ch = curl_init('https://data.dz-immo.com/api/wilayas'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['Accept: application/json'], ]); $response = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($status === 200) { $wilayas = json_decode($response, true); }
import requests # Lister toutes les wilayas response = requests.get("https://data.dz-immo.com/api/wilayas") wilayas = response.json() for w in wilayas: print(f"{w['code']} - {w['name']} ({w['name_ar']})") # Rechercher une wilaya response = requests.get( "https://data.dz-immo.com/api/wilayas", params={"q": "alger"} ) results = response.json() # Construire un dictionnaire code -> nom wilaya_map = {w["code"]: w["name"] for w in wilayas} print(wilaya_map["16"]) # ALGER
# Toutes les wilayas curl https://data.dz-immo.com/api/wilayas # Rechercher par nom curl "https://data.dz-immo.com/api/wilayas?q=oran" # Rechercher en arabe curl "https://data.dz-immo.com/api/wilayas?q=وهران"
GET
/api/wilayas/{code}
Retourne le détail d'une wilaya identifiée par son code (2 chiffres), accompagnée de la liste complète de ses communes.
Si le code n'existe pas, l'API retourne une erreur 404.
Paramètres d'URL
| Nom | Type | Description |
|---|---|---|
| code | string | Code de la wilaya sur 2 chiffres (ex: 16 pour Alger, 31 pour Oran) |
Réponse 200 OK
{ "code": "16", "name": "ALGER", "name_ar": "الجزائر", "communes": [ { "code": "01", "name": "ALGER CENTRE", "name_ar": "الجزائر الوسطى" }, { "code": "05", "name": "BAB EL OUED", "name_ar": "باب الوادي" } // ... 57 communes au total ] }
Erreur 404
{ "error": "Wilaya not found" }
PHP
Python
cURL
// Récupérer Alger (code 16) avec toutes ses communes $code = '16'; $response = file_get_contents("https://data.dz-immo.com/api/wilayas/{$code}"); $wilaya = json_decode($response, true); echo $wilaya['name'] . " contient " . count($wilaya['communes']) . " communes\n"; // Afficher chaque commune foreach ($wilaya['communes'] as $c) { echo sprintf( " %s-%s %-25s %s\n", $wilaya['code'], $c['code'], $c['name'], $c['name_ar'] ); } // Construire un select HTML $html = '<select name="commune">'; foreach ($wilaya['communes'] as $c) { $html .= "<option value=\"{$c['code']}\">" . "{$c['name']} ({$c['name_ar']})</option>"; } $html .= '</select>';
import requests # Récupérer une wilaya et ses communes code = "16" response = requests.get(f"https://data.dz-immo.com/api/wilayas/{code}") response.raise_for_status() # lève une exception si 404 wilaya = response.json() print(f"{wilaya['name']} : {len(wilaya['communes'])} communes") # Créer un DataFrame pandas import pandas as pd df = pd.DataFrame(wilaya["communes"]) print(df.to_string(index=False)) # Exporter en CSV df.to_csv(f"communes_wilaya_{code}.csv", index=False)
# Détail de la wilaya d'Alger curl https://data.dz-immo.com/api/wilayas/16 # Détail de la wilaya d'Oran curl https://data.dz-immo.com/api/wilayas/31 # Formatter la sortie avec jq curl -s https://data.dz-immo.com/api/wilayas/16 | jq '.communes[] | .name'
GET
/api/communes
Retourne la liste des communes avec des filtres combinables : recherche textuelle et/ou filtrage par code de wilaya.
Sans filtre, retourne les 1 541 communes. Chaque commune inclut les informations de sa wilaya parente.
Paramètres
| Nom | Type | Description |
|---|---|---|
| q optionnel | string | Recherche sur le code, le nom français ou le nom arabe de la commune |
| wilaya optionnel | string | Code de la wilaya pour filtrer les communes (2 chiffres, ex: 16) |
Réponse 200 OK
[ { "wilaya_code": "16", "wilaya_name": "ALGER", "wilaya_name_ar": "الجزائر", "code": "05", "name": "BAB EL OUED", "name_ar": "باب الوادي" } // ... ]
PHP
Python
cURL
// Communes d'une wilaya $wilayaCode = '16'; $response = file_get_contents( "https://data.dz-immo.com/api/communes?wilaya={$wilayaCode}" ); $communes = json_decode($response, true); // Rechercher une commune par nom dans une wilaya $q = urlencode('bab'); $response = file_get_contents( "https://data.dz-immo.com/api/communes?wilaya=16&q={$q}" ); $results = json_decode($response, true); // Rechercher dans toutes les wilayas $response = file_get_contents( "https://data.dz-immo.com/api/communes?q=ain" ); $communes = json_decode($response, true); echo count($communes) . " communes contiennent 'ain'\n"; // Regrouper les communes par wilaya $grouped = []; foreach ($communes as $c) { $grouped[$c['wilaya_name']][] = $c['name']; }
import requests # Communes d'une wilaya response = requests.get( "https://data.dz-immo.com/api/communes", params={"wilaya": "16"} ) communes = response.json() # Rechercher + filtrer par wilaya response = requests.get( "https://data.dz-immo.com/api/communes", params={"q": "bab", "wilaya": "16"} ) # Charger toutes les communes dans un DataFrame import pandas as pd all_communes = requests.get("https://data.dz-immo.com/api/communes").json() df = pd.DataFrame(all_communes) # Nombre de communes par wilaya print(df.groupby("wilaya_name").size().sort_values(ascending=False)) # Exporter tout en CSV df.to_csv("communes_algerie.csv", index=False)
# Toutes les communes curl https://data.dz-immo.com/api/communes # Communes de la wilaya 16 (Alger) curl "https://data.dz-immo.com/api/communes?wilaya=16" # Rechercher "bab" dans Alger curl "https://data.dz-immo.com/api/communes?wilaya=16&q=bab" # Rechercher dans toutes les wilayas + compter curl -s "https://data.dz-immo.com/api/communes?q=ain" | jq 'length'