API reference

Every route, its parameters, and a real response from each.

Basics

Base URL
https://communes.pages.dev. No key and no sign-up. Any site can call it from the browser.
Identifiers
A unit can be written 4 ways, and each finds it: 01.511.01.0, 001511010, 1511010, tanger.
Responses
Every answer is data, meta and links. A list adds page, perPage, total and totalPages to meta, and a search adds total.
Where it runs
A path ending in .json is a static file. The rest run in a Worker, and the X-Api-Tier header says which answered.
OpenAPI
This reference as an OpenAPI 3.1 document: /api/openapi.json

Routes

GET /api/search

Find any administrative unit by name

Matches French names, Arabic names and slugs. Accents, Arabic letter variants and vowel marks are folded, and places are also found by other names they go by, such as Fez for Fès.

qrequired
stringText to find, up to 100 characters.
levels
stringLevels to include, separated by commas. All levels when omitted.
limit10 by default
integer [1, 50]How many results to return, up to 50.
  • 200Matches, best first.
  • 400q is missing or too long, or a parameter is out of range.
Example · GET /api/search?q=fez&limit=2
{
  "data": [
    {
      "code": "03.231.01.0",
      "level": "commune",
      "name": {
        "fr": "Fès",
        "ar": "فاس"
      },
      "slug": "fes",
      "score": 1000,
      "matched": "alias"
    },
    {
      "code": "08.201.03.09",
      "level": "commune",
      "name": {
        "fr": "Fezna",
        "ar": "فزنا"
      },
      "slug": "fezna",
      "score": 498,
      "matched": "prefix"
    }
  ],
  "meta": {
    "datasetVersion": "1.8.0",
    "total": 2
  },
  "links": {
    "self": "/api/search?q=fez&limit=2",
    "prev": null,
    "next": null
  }
}

GET /api/communes/at

The commune that contains a point

Tested against each commune's boundary, stored on a grid of 2 to 6 m depending on the size of its région. In the 6 cities divided into arrondissements, arrondissement names the one the point is in; elsewhere it's null. Sidi Mohamed Benmansour has no boundary, and neither do about 88 km² between Ifrane and Boulemane.

latrequired
number [−90, 90]Latitude, in degrees.
lngrequired
number [−180, 180]Longitude, in degrees.
  • 200The commune, with the arrondissement the point is in.
  • 400A coordinate is missing or out of range.
  • 404No commune boundary contains the point: it's outside Morocco, at sea, or in one of the 2 places without one.
Example · GET /api/communes/at?lat=35.786&lng=-5.8125
{
  "data": {
    "code": "01.511.01.0",
    "codeDigits": "001511010",
    "slug": "tanger",
    "nameFrRaw": "Commune de Tanger",
    "name": {
      "fr": "Tanger",
      "ar": "طنجة"
    },
    "type": "urban",
    "parents": {
      "region": "01",
      "province": "01.511",
      "cercle": null
    },
    "population": {
      "2014": {
        "total": 947952,
        "households": 239243
      },
      "2024": {
        "total": 1275428,
        "moroccan": 1268512,
        "foreign": 6916,
        "households": 362062
      },
      "change": {
        "absolute": 327476,
        "pct": 34.55,
        "basis": "arrondissement_sum"
      }
    },
    "urbanCentres": [],
    "centroid": {
      "lat": 35.75623595957031,
      "lng": -5.832718404101565
    },
    "bbox": [-5.9484121, 35.6995621, -5.7135397, 35.8259979],
    "areaKm2": 149.41,
    "density": 8536.51,
    "osm": {
      "relationId": 2758781,
      "wikidata": "Q126148"
    },
    "provenance": {
      "name": "hcp-2024",
      "population2024": "hcp-2024",
      "population2014": "hcp-2014:arrondissement_sum",
      "geometry": "osm-odbl"
    },
    "arrondissement": {
      "code": "01.511.01.07",
      "name": {
        "fr": "Médina",
        "ar": "المدينة"
      }
    }
  },
  "meta": {
    "datasetVersion": "1.8.0"
  },
  "links": {
    "self": "/api/communes/01.511.01.0.json",
    "prev": null,
    "next": null
  }
}

GET /api/communes/near

Communes within a radius of a point

Distance is measured to each commune's centroid, nearest first.

latrequired
number [−90, 90]Latitude, in degrees.
lngrequired
number [−180, 180]Longitude, in degrees.
radius10 by default
number (0, 100]Distance in km, up to 100.
limit10 by default
integer [1, 50]How many results to return, up to 50.
  • 200Communes within the radius, nearest first.
  • 400A coordinate or the radius is missing or out of range.
Example · GET /api/communes/near?lat=33.5731&lng=-7.5898&radius=15&limit=2
{
  "data": [
    {
      "code": "06.141.01.81",
      "name": {
        "fr": "Méchouar de Casablanca",
        "ar": "مشور الدار البيضاء"
      },
      "slug": "mechouar-de-casablanca",
      "distanceKm": 1.627
    },
    {
      "code": "06.141.01.0",
      "name": {
        "fr": "Casablanca",
        "ar": "الدار البيضاء"
      },
      "slug": "casablanca",
      "distanceKm": 6.103
    }
  ],
  "meta": {
    "datasetVersion": "1.8.0",
    "total": 2
  },
  "links": {
    "self": "/api/communes/near?lat=33.5731&lng=-7.5898&radius=15&limit=2",
    "prev": null,
    "next": null
  }
}

GET /api/communes

List communes, optionally filtered

Paginated, 50 communes to a page. Filters combine. q searches communes by name instead, and can't be given with a filter or page.

region
stringA région, by code or slug.
province
stringA province or préfecture, by code or slug.
cercle
stringA cercle, by code or slug.
type
urban | ruralUrban or rural communes only.
min_population
integer [0, 10 000 000]Only communes with at least this many people in 2024.
max_population
integer [0, 10 000 000]Only communes with at most this many people in 2024.
sortcode by default
stringOrder by name, population in 2024, change since 2014, density or area, or by a census indicator's path, such as labour.unemploymentRate. Put 2014. before the path for the 2014 figure, or change. for how far it moved between the censuses, as in change.illiteracy.rate10Plus; both are offered for the figures the two censuses ask the same way. An establishment count goes under economy., as in economy.establishments.jobs, and 3 more are worked out from those counts rather than published: economy.per1000.establishments, economy.per1000.jobs and economy.perBusiness.jobs, which rank by how much of something a place has for its size. A leading minus puts the largest first, and a commune with no value comes last either way. Sorted by a figure, each commune carries indicator, its value, derived where the value came from a division, and basis where it was summed from a city's arrondissements.
page1 by default
integer [1, 10 000]Page number, from 1.
q
stringSearch communes by name, up to 100 characters, returning up to 10 matches. Takes no other parameter.
  • 200A page of communes, or search hits when q is given.
  • 400A filter isn't a valid code or names the wrong kind of unit, a parameter is out of range, or q is given with another parameter.
  • 404A filter names a unit that doesn't exist, or the page is past the last.
Example · GET /api/communes?type=urban&sort=-population
{
  "data": [
    {
      "code": "06.141.01.0",
      "codeDigits": "006141010",
      "slug": "casablanca",
      "nameFrRaw": "Commune de Casablanca",
      "name": {
        "fr": "Casablanca",
        "ar": "الدار البيضاء"
      },
      "type": "urban",
      "parents": {
        "region": "06",
        "province": "06.141",
        "cercle": null
      },
      "population": {
        "2014": {
          "total": 3357173,
          "households": 819309
        },
        "2024": {
          "total": 3215935,
          "moroccan": 3169978,
          "foreign": 45957,
          "households": 909228
        },
        "change": {
          "absolute": -141238,
          "pct": -4.21,
          "basis": "arrondissement_sum"
        }
      },
      "urbanCentres": [],
      "centroid": {
        "lat": 33.55246299128418,
        "lng": -7.650829588842771
      },
      "bbox": [-7.751238, 33.493342, -7.4574165, 33.6409103],
      "areaKm2": 216.76,
      "density": 14836.29,
      "osm": {
        "relationId": 4072985,
        "wikidata": "Q7903"
      },
      "provenance": {
        "name": "hcp-2024",
        "population2024": "hcp-2024",
        "population2014": "hcp-2014:arrondissement_sum",
        "geometry": "osm-odbl"
      }
    }
  ],
  "meta": {
    "datasetVersion": "1.8.0",
    "page": 1,
    "perPage": 50,
    "total": 242,
    "totalPages": 5
  },
  "links": {
    "self": "/api/communes?type=urban&sort=-population",
    "prev": null,
    "next": "/api/communes?type=urban&sort=-population&page=2"
  }
}

1 of 50 rows shown here.

GET /api/communes/{code}

One commune by any spelling of its identifier

coderequired
stringA dotted code, padded or unpadded digits, or a slug.
  • 200The commune.
  • 400Not an identifier.
  • 404No commune has that identifier.
Example · GET /api/communes/tanger
{
  "data": {
    "code": "01.511.01.0",
    "codeDigits": "001511010",
    "slug": "tanger",
    "nameFrRaw": "Commune de Tanger",
    "name": {
      "fr": "Tanger",
      "ar": "طنجة"
    },
    "type": "urban",
    "parents": {
      "region": "01",
      "province": "01.511",
      "cercle": null
    },
    "population": {
      "2014": {
        "total": 947952,
        "households": 239243
      },
      "2024": {
        "total": 1275428,
        "moroccan": 1268512,
        "foreign": 6916,
        "households": 362062
      },
      "change": {
        "absolute": 327476,
        "pct": 34.55,
        "basis": "arrondissement_sum"
      }
    },
    "urbanCentres": [],
    "centroid": {
      "lat": 35.75623595957031,
      "lng": -5.832718404101565
    },
    "bbox": [-5.9484121, 35.6995621, -5.7135397, 35.8259979],
    "areaKm2": 149.41,
    "density": 8536.51,
    "osm": {
      "relationId": 2758781,
      "wikidata": "Q126148"
    },
    "provenance": {
      "name": "hcp-2024",
      "population2024": "hcp-2024",
      "population2014": "hcp-2014:arrondissement_sum",
      "geometry": "osm-odbl"
    }
  },
  "meta": {
    "datasetVersion": "1.8.0"
  },
  "links": {
    "self": "/api/communes/01.511.01.0.json",
    "prev": null,
    "next": null
  }
}

GET /api/communes/{code}/arrondissements.json

The arrondissements of a commune

Only 6 communes have arrondissements; every other commune returns an empty list.

coderequired
stringThe dotted commune code.
  • 200The commune's arrondissements.
  • 404No commune has that code.
Example · GET /api/communes/01.511.01.0/arrondissements.json
{
  "data": [
    {
      "code": "01.511.01.05",
      "codeDigits": "015110105",
      "name": {
        "fr": "Mghogha",
        "ar": "مغوغة"
      },
      "population": {
        "2024": {
          "total": 252656,
          "moroccan": 251850,
          "foreign": 806,
          "households": 70679
        }
      },
      "provenance": {
        "name": "hcp-2024",
        "population2024": "hcp-2024",
        "geometry": "osm-odbl"
      },
      "communeCode": "01.511.01.0",
      "prefectureOfArrondissementsCode": null,
      "centroid": {
        "lat": 35.76514231191407,
        "lng": -5.752523938476561
      },
      "bbox": [-5.8129665, 35.7226626, -5.7135397, 35.8259979],
      "areaKm2": 43.81,
      "density": 5767.67,
      "osm": {
        "relationId": 3544604,
        "wikidata": null
      }
    },
    {
      "code": "01.511.01.06",
      "codeDigits": "015110106",
      "name": {
        "fr": "Souani",
        "ar": "السواني"
      },
      "population": {
        "2024": {
          "total": 111772,
          "moroccan": 111120,
          "foreign": 652,
          "households": 33489
        }
      },
      "provenance": {
        "name": "hcp-2024",
        "population2024": "hcp-2024",
        "geometry": "osm-odbl"
      },
      "communeCode": "01.511.01.0",
      "prefectureOfArrondissementsCode": null,
      "centroid": {
        "lat": 35.76715592148438,
        "lng": -5.8238295160156275
      },
      "bbox": [-5.8411056, 35.7515914, -5.8021143, 35.7789764],
      "areaKm2": 5.09,
      "density": 21972.47,
      "osm": {
        "relationId": 3544606,
        "wikidata": null
      }
    }
  ],
  "meta": {
    "datasetVersion": "1.8.0",
    "total": 4
  },
  "links": {
    "self": "/api/communes/01.511.01.0/arrondissements.json",
    "prev": null,
    "next": null
  }
}

2 of 4 rows shown here.

GET /api/{collection}/{code}/indicators

A unit's figures from the 2024 and 2014 censuses

HCP's indicators for a région, province, cercle, commune or arrondissement: age, marital status, fertility, disability, schooling, literacy and languages, education and work, and each household's dwelling, amenities, wastewater, waste and cooking fuel. For the whole unit, its urban and its rural part, and for men and women. Shares and rates are percentages. Most come from the long questionnaire, which went to a random 20% of households in communes of 2,000 households or more, so there they're estimates. The 2024 figures are at the top level and the 2014 census is under 2014, null for a unit it didn't count. A commune's file carries its urban centres' figures too. /data/v1/indicators/fields.json names every field with HCP's heading, and /data/v1/indicators/2014/fields.json names the 2014 fields and which of them can be read against 2024.

collectionrequired
regions | provinces | cercles | communes | arrondissementsThe unit's level.
coderequired
stringA dotted code, padded or unpadded digits, or a slug.
  • 200The unit's indicators.
  • 400Not an identifier.
  • 404No unit has that identifier, or it's in another collection.
Example · GET /api/communes/tanger/indicators
{
  "data": {
    "2014": null,
    "code": "01.511.01.0",
    "codeDigits": "001511010",
    "level": "commune",
    "name": {
      "fr": "Tanger",
      "ar": "طنجة"
    },
    "fromLocalAdministration": false,
    "people": {
      "total": {
        "all": {
          "population": {
            "legal": 1275428,
            "municipal": 1272718
          },
          "labour": {
            "population15Plus": 940063,
            "active": 489284,
            "inactive": 449985,
            "activityRate": 52.1,
            "unemploymentRate": 15.3,
            "employed": 414399
          }
        },
        "male": {
          "population": {
            "municipal": 644380
          },
          "labour": {
            "population15Plus": 472773,
            "active": 350602,
            "inactive": 121457,
            "activityRate": 74.3,
            "unemploymentRate": 14.4,
            "employed": 300274
          }
        },
        "female": {
          "population": {
            "municipal": 628338
          },
          "labour": {
            "population15Plus": 467290,
            "active": 138682,
            "inactive": 328528,
            "activityRate": 29.7,
            "unemploymentRate": 17.7,
            "employed": 114125
          }
        }
      },
      "urban": {
        "all": {
          "population": {
            "legal": 1275428,
            "municipal": 1272718
          },
          "labour": {
            "population15Plus": 940063,
            "active": 489284,
            "inactive": 449985,
            "activityRate": 52.1,
            "unemploymentRate": 15.3,
            "employed": 414399
          }
        },
        "male": {
          "population": {
            "municipal": 644380
          },
          "labour": {
            "population15Plus": 472773,
            "active": 350602,
            "inactive": 121457,
            "activityRate": 74.3,
            "unemploymentRate": 14.4,
            "employed": 300274
          }
        },
        "female": {
          "population": {
            "municipal": 628338
          },
          "labour": {
            "population15Plus": 467290,
            "active": 138682,
            "inactive": 328528,
            "activityRate": 29.7,
            "unemploymentRate": 17.7,
            "employed": 114125
          }
        }
      },
      "rural": null
    },
    "households": {
      "total": {
        "amenities": {
          "kitchen": 98.7,
          "toilet": 99.8,
          "bathroom": 73.7,
          "electricity": 99.4,
          "runningWater": 98.8
        }
      },
      "urban": {
        "amenities": {
          "kitchen": 98.7,
          "toilet": 99.8,
          "bathroom": 73.7,
          "electricity": 99.4,
          "runningWater": 98.8
        }
      },
      "rural": null
    },
    "urbanCentres": []
  },
  "meta": {
    "datasetVersion": "1.8.0"
  },
  "links": {
    "self": "/api/communes/01.511.01.0/indicators.json",
    "prev": null,
    "next": null
  }
}

Cut here to a few topics. The file has them all.

GET /api/indicators.json

Morocco's figures from the 2024 and 2014 censuses

The same indicators for the country as a whole.

  • 200Morocco's indicators.
Example · GET /api/indicators.json
{
  "data": {
    "2014": {
      "people": {
        "total": {
          "all": {
            "population": {
              "legal": 33848242,
              "municipal": 33610084
            },
            "age": {
              "0-4": 10.2,
              "5-9": 9,
              "10-14": 9,
              "15-19": 8.9,
              "20-24": 9.1,
              "25-29": 8.3,
              "30-34": 7.8,
              "35-39": 7,
              "40-44": 6.4,
              "45-49": 5.4,
              "50-54": 5.3,
              "55-59": 4.1,
              "60-64": 3.4,
              "65-69": 1.9,
              "70-74": 1.7,
              "75+": 2.5
            },
            "maritalStatus": {
              "single": 53.2,
              "married": 41.4,
              "divorced": 1.6,
              "widowed": 3.9,
              "singulateMeanAgeAtMarriage": 28.5
            },
            "disability": {
              "prevalence": 5.1
            },
            "fertility": {
              "completedFertility": 3.46,
              "totalFertilityRate": 2.22
            },
            "schooling": {
              "rate7to12": 95.1
            },
            "illiteracy": {
              "rate10Plus": 32.2
            },
            "languageCombinations": {
              "arabicOnly": 30.9,
              "arabicAndFrench": 45.4,
              "arabicFrenchEnglish": 18.4,
              "other": 5.2
            },
            "education": {
              "none": 36.9,
              "preschool": 4.7,
              "primary": 28,
              "lowerSecondary": 14.3,
              "upperSecondary": 10,
              "higher": 6.1
            },
            "localLanguages": {
              "darija": 90.9,
              "tachelhit": 14.1,
              "tamazight": 7.9,
              "tarifit": 4,
              "hassania": 0.8
            },
            "labour": {
              "active": 11548464,
              "inactive": 22061620,
              "activityRate": 47.6,
              "unemploymentRate": 16.2
            },
            "employmentStatus": {
              "employer": 2.9,
              "selfEmployed": 29.8,
              "publicSector": 10.2,
              "privateSector": 47.6,
              "familyWorker": 6.5,
              "apprentice": 0.9,
              "cooperativeMember": 1.8,
              "other": 0.4
            },
            "commute": {
              "employed": 9619080,
              "walking": 47.1,
              "bikeOrMotorcycle": 9.1,
              "privateCar": 10.4,
              "bus": 8.2,
              "taxi": 10.7,
              "employerTransport": 4.5,
              "train": 0.4,
              "tram": 0.3,
              "other": 2.7,
              "worksAtHome": 3.1,
              "undetermined": 3.4
            },
            "workplace": {
              "atHome": 3.1,
              "ownNeighbourhood": 36.4,
              "otherNeighbourhood": 18.3,
              "otherCommune": 13.7,
              "otherProvince": 10.4,
              "noFixedPlace": 13.9,
              "elsewhere": 0.9,
              "undetermined": 3.3
            },
            "study": {
              "students": 8392290,
              "ownNeighbourhood": 48.9,
              "otherNeighbourhood": 26.7,
              "otherCommune": 8.8,
              "otherProvince": 5.3,
              "elsewhere": 0.2,
              "undetermined": 10.1
            },
            "studyCommute": {
              "walking": 69.3,
              "bikeOrMotorcycle": 2.5,
              "privateCar": 2.8,
              "bus": 6.3,
              "taxi": 3.4,
              "schoolTransport": 4.6,
              "train": 0.3,
              "tram": 0.3,
              "other": 0.9,
              "undetermined": 9.7
            },
            "profession": {
              "employed": 9627341,
              "managersAndProfessionals": 7,
              "technicians": 3.3,
              "clerks": 13.9,
              "traders": 7.6,
              "farmers": 10.4,
              "artisans": 22.5,
              "farmLabourers": 12.7,
              "machineOperators": 4,
              "labourers": 16.6,
              "unclassified": 1.9
            },
            "workSector": {
              "agriculture": 23.5,
              "industry": 11.8,
              "utilities": 0.6,
              "construction": 14.4,
              "commerce": 16,
              "transport": 5.2,
              "marketServices": 14,
              "publicServices": 11.6,
              "other": 2.8
            },
            "diploma": {
              "population10Plus": 27172768,
              "primary": 21.1,
              "lowerSecondary": 12.2,
              "upperSecondary": 6.6,
              "bachelor": 3.1,
              "masterOrDoctorate": 1.1,
              "undeclared": 0,
              "none": 55.9
            },
            "vocationalDiploma": {
              "specialisedTechnician": 1.7,
              "technician": 2.1,
              "qualification": 2.4,
              "specialisation": 0.6,
              "initiation": 0.6,
              "undeclared": 0,
              "none": 92.5
            }
          },
          "male": {
            "population": {
              "municipal": 16747522
            },
            "age": {
              "0-4": 10.4,
              "5-9": 9.2,
              "10-14": 9.3,
              "15-19": 8.9,
              "20-24": 9,
              "25-29": 8.2,
              "30-34": 7.7,
              "35-39": 6.8,
              "40-44": 6.3,
              "45-49": 5.3,
              "50-54": 5.3,
              "55-59": 4.2,
              "60-64": 3.4,
              "65-69": 1.9,
              "70-74": 1.6,
              "75+": 2.4
            },
            "maritalStatus": {
              "single": 57.9,
              "married": 40.8,
              "divorced": 0.7,
              "widowed": 0.6,
              "singulateMeanAgeAtMarriage": 31.3
            },
            "disability": {
              "prevalence": 5
            },
            "fertility": {
              "completedFertility": null,
              "totalFertilityRate": null
            },
            "schooling": {
              "rate7to12": 95.7
            },
            "illiteracy": {
              "rate10Plus": 22.2
            },
            "languageCombinations": {
              "arabicOnly": 31.8,
              "arabicAndFrench": 45.4,
              "arabicFrenchEnglish": 17.3,
              "other": 5.5
            },
            "education": {
              "none": 28.5,
              "preschool": 6.4,
              "primary": 30.6,
              "lowerSecondary": 16.7,
              "upperSecondary": 11,
              "higher": 6.8
            },
            "localLanguages": {
              "darija": 92.2,
              "tachelhit": 14.2,
              "tamazight": 7.9,
              "tarifit": 4,
              "hassania": 0.8
            },
            "labour": {
              "active": 9030773,
              "inactive": 7716749,
              "activityRate": 75.5,
              "unemploymentRate": 12.4
            },
            "employmentStatus": {
              "employer": 3.1,
              "selfEmployed": 33.4,
              "publicSector": 9.3,
              "privateSector": 45.3,
              "familyWorker": 5.6,
              "apprentice": 1,
              "cooperativeMember": 1.9,
              "other": 0.4
            },
            "commute": {
              "employed": 7862051,
              "walking": 48.4,
              "bikeOrMotorcycle": 10.8,
              "privateCar": 10.4,
              "bus": 8,
              "taxi": 10,
              "employerTransport": 3.6,
              "train": 0.4,
              "tram": 0.2,
              "other": 3,
              "worksAtHome": 2,
              "undetermined": 3.1
            },
            "workplace": {
              "atHome": 2,
              "ownNeighbourhood": 37.7,
              "otherNeighbourhood": 17.3,
              "otherCommune": 12.8,
              "otherProvince": 10.5,
              "noFixedPlace": 15.7,
              "elsewhere": 1,
              "undetermined": 3
            },
            "study": {
              "students": 4451894,
              "ownNeighbourhood": 48.5,
              "otherNeighbourhood": 26.8,
              "otherCommune": 9.5,
              "otherProvince": 5.6,
              "elsewhere": 0.2,
              "undetermined": 9.3
            },
            "studyCommute": {
              "walking": 69,
              "bikeOrMotorcycle": 3.4,
              "privateCar": 2.7,
              "bus": 6.3,
              "taxi": 3.6,
              "schoolTransport": 4.5,
              "train": 0.3,
              "tram": 0.3,
              "other": 1,
              "undetermined": 8.9
            },
            "profession": {
              "employed": 7868873,
              "managersAndProfessionals": 5.6,
              "technicians": 2.5,
              "clerks": 13.1,
              "traders": 8.7,
              "farmers": 12.1,
              "artisans": 22.9,
              "farmLabourers": 12.5,
              "machineOperators": 4.9,
              "labourers": 16,
              "unclassified": 1.7
            },
            "workSector": {
              "agriculture": 25,
              "industry": 9.7,
              "utilities": 0.6,
              "construction": 17.4,
              "commerce": 17.7,
              "transport": 5.9,
              "marketServices": 11.7,
              "publicServices": 9.4,
              "other": 2.5
            },
            "diploma": {
              "population10Plus": 13458638,
              "primary": 24.4,
              "lowerSecondary": 13.6,
              "upperSecondary": 7.1,
              "bachelor": 3.4,
              "masterOrDoctorate": 1.4,
              "undeclared": 0,
              "none": 50
            },
            "vocationalDiploma": {
              "specialisedTechnician": 1.8,
              "technician": 2.6,
              "qualification": 3,
              "specialisation": 0.8,
              "initiation": 0.6,
              "undeclared": 0,
              "none": 91.2
            }
          },
          "female": {
            "population": {
              "municipal": 16862562
            },
            "age": {
              "0-4": 9.9,
              "5-9": 8.8,
              "10-14": 8.8,
              "15-19": 8.8,
              "20-24": 9.1,
              "25-29": 8.4,
              "30-34": 8,
              "35-39": 7.2,
              "40-44": 6.5,
              "45-49": 5.6,
              "50-54": 5.4,
              "55-59": 4,
              "60-64": 3.3,
              "65-69": 1.9,
              "70-74": 1.8,
              "75+": 2.6
            },
            "maritalStatus": {
              "single": 48.4,
              "married": 42,
              "divorced": 2.4,
              "widowed": 7.1,
              "singulateMeanAgeAtMarriage": 25.7
            },
            "disability": {
              "prevalence": 5.1
            },
            "fertility": {
              "completedFertility": 3.46,
              "totalFertilityRate": 2.22
            },
            "schooling": {
              "rate7to12": 94.4
            },
            "illiteracy": {
              "rate10Plus": 42.1
            },
            "languageCombinations": {
              "arabicOnly": 29.7,
              "arabicAndFrench": 45.4,
              "arabicFrenchEnglish": 20,
              "other": 4.9
            },
            "education": {
              "none": 45.2,
              "preschool": 3,
              "primary": 25.4,
              "lowerSecondary": 12,
              "upperSecondary": 8.9,
              "higher": 5.4
            },
            "localLanguages": {
              "darija": 89.7,
              "tachelhit": 14.1,
              "tamazight": 8,
              "tarifit": 4.1,
              "hassania": 0.8
            },
            "labour": {
              "active": 2517691,
              "inactive": 14344871,
              "activityRate": 20.4,
              "unemploymentRate": 29.6
            },
            "employmentStatus": {
              "employer": 2,
              "selfEmployed": 14.5,
              "publicSector": 14,
              "privateSector": 57.3,
              "familyWorker": 10.3,
              "apprentice": 0.4,
              "cooperativeMember": 1,
              "other": 0.5
            },
            "commute": {
              "employed": 1757029,
              "walking": 41.4,
              "bikeOrMotorcycle": 1.5,
              "privateCar": 10.6,
              "bus": 9.1,
              "taxi": 13.4,
              "employerTransport": 8.3,
              "train": 0.5,
              "tram": 0.6,
              "other": 1.4,
              "worksAtHome": 8.4,
              "undetermined": 4.6
            },
            "workplace": {
              "atHome": 8.4,
              "ownNeighbourhood": 30.4,
              "otherNeighbourhood": 22.9,
              "otherCommune": 17.5,
              "otherProvince": 10,
              "noFixedPlace": 5.5,
              "elsewhere": 0.6,
              "undetermined": 4.6
            },
            "study": {
              "students": 3940396,
              "ownNeighbourhood": 49.4,
              "otherNeighbourhood": 26.7,
              "otherCommune": 8,
              "otherProvince": 4.9,
              "elsewhere": 0.2,
              "undetermined": 10.9
            },
            "studyCommute": {
              "walking": 69.6,
              "bikeOrMotorcycle": 1.4,
              "privateCar": 2.9,
              "bus": 6.3,
              "taxi": 3.2,
              "schoolTransport": 4.7,
              "train": 0.3,
              "tram": 0.4,
              "other": 0.7,
              "undetermined": 10.5
            },
            "profession": {
              "employed": 1758468,
              "managersAndProfessionals": 13.5,
              "technicians": 6.6,
              "clerks": 17.6,
              "traders": 2.7,
              "farmers": 2.8,
              "artisans": 20.4,
              "farmLabourers": 14,
              "machineOperators": 0.3,
              "labourers": 19.1,
              "unclassified": 3
            },
            "workSector": {
              "agriculture": 16.8,
              "industry": 21.3,
              "utilities": 0.6,
              "construction": 1.1,
              "commerce": 8.4,
              "transport": 1.8,
              "marketServices": 24.5,
              "publicServices": 21.4,
              "other": 4.1
            },
            "diploma": {
              "population10Plus": 13714130,
              "primary": 17.9,
              "lowerSecondary": 10.8,
              "upperSecondary": 6,
              "bachelor": 2.8,
              "masterOrDoctorate": 0.8,
              "undeclared": 0,
              "none": 61.6
            },
            "vocationalDiploma": {
              "specialisedTechnician": 1.6,
              "technician": 1.5,
              "qualification": 1.9,
              "specialisation": 0.4,
              "initiation": 0.6,
              "undeclared": 0,
              "none": 93.9
            }
          }
        },
        "urban": {
          "all": {
            "population": {
              "legal": null,
              "municipal": 20284436
            },
            "age": {
              "0-4": 9.4,
              "5-9": 8.4,
              "10-14": 8.3,
              "15-19": 8.4,
              "20-24": 9.1,
              "25-29": 8.5,
              "30-34": 8.1,
              "35-39": 7.3,
              "40-44": 6.9,
              "45-49": 6,
              "50-54": 5.9,
              "55-59": 4.5,
              "60-64": 3.5,
              "65-69": 1.9,
              "70-74": 1.6,
              "75+": 2.3
            },
            "maritalStatus": {
              "single": 52.5,
              "married": 41.6,
              "divorced": 2,
              "widowed": 4,
              "singulateMeanAgeAtMarriage": 29.2
            },
            "disability": {
              "prevalence": 4.8
            },
            "fertility": {
              "completedFertility": 2.93,
              "totalFertilityRate": 2.03
            },
            "schooling": {
              "rate7to12": 97.8
            },
            "illiteracy": {
              "rate10Plus": 22.6
            },
            "languageCombinations": {
              "arabicOnly": 25.6,
              "arabicAndFrench": 46.4,
              "arabicFrenchEnglish": 23.1,
              "other": 4.9
            },
            "education": {
              "none": 27.7,
              "preschool": 5.2,
              "primary": 26.6,
              "lowerSecondary": 17.2,
              "upperSecondary": 14.2,
              "higher": 9.2
            },
            "localLanguages": {
              "darija": 96.3,
              "tachelhit": 11.5,
              "tamazight": 5.1,
              "tarifit": 3.8,
              "hassania": 1.2
            },
            "labour": {
              "active": 7369399,
              "inactive": 12915037,
              "activityRate": 49.1,
              "unemploymentRate": 19.3
            },
            "employmentStatus": {
              "employer": 3.7,
              "selfEmployed": 25.2,
              "publicSector": 14.4,
              "privateSector": 52.3,
              "familyWorker": 1.2,
              "apprentice": 0.9,
              "cooperativeMember": 1.8,
              "other": 0.4
            },
            "commute": {
              "employed": 5932706,
              "walking": 38,
              "bikeOrMotorcycle": 9.7,
              "privateCar": 14.8,
              "bus": 8.5,
              "taxi": 12.3,
              "employerTransport": 6.6,
              "train": 0.6,
              "tram": 0.4,
              "other": 2.1,
              "worksAtHome": 3.1,
              "undetermined": 3.8
            },
            "workplace": {
              "atHome": 3.1,
              "ownNeighbourhood": 22.5,
              "otherNeighbourhood": 26.9,
              "otherCommune": 16.7,
              "otherProvince": 10.6,
              "noFixedPlace": 15.5,
              "elsewhere": 0.9,
              "undetermined": 3.7
            },
            "study": {
              "students": 5586730,
              "ownNeighbourhood": 46.1,
              "otherNeighbourhood": 31.8,
              "otherCommune": 6.8,
              "otherProvince": 5.5,
              "elsewhere": 0.2,
              "undetermined": 9.6
            },
            "studyCommute": {
              "walking": 68.7,
              "bikeOrMotorcycle": 1.7,
              "privateCar": 3.8,
              "bus": 7,
              "taxi": 2.6,
              "schoolTransport": 5.7,
              "train": 0.5,
              "tram": 0.5,
              "other": 0.4,
              "undetermined": 9.1
            },
            "profession": {
              "employed": 5932706,
              "managersAndProfessionals": 10.7,
              "technicians": 5,
              "clerks": 19,
              "traders": 9.4,
              "farmers": 1.3,
              "artisans": 26.3,
              "farmLabourers": 2.9,
              "machineOperators": 4.7,
              "labourers": 18.1,
              "unclassified": 2.5
            },
            "workSector": {
              "agriculture": 4.4,
              "industry": 15.7,
              "utilities": 0.9,
              "construction": 13.1,
              "commerce": 20.3,
              "transport": 6.5,
              "marketServices": 18.7,
              "publicServices": 16.8,
              "other": 3.6
            },
            "diploma": {
              "population10Plus": 16684508,
              "primary": 23.2,
              "lowerSecondary": 16.5,
              "upperSecondary": 9.5,
              "bachelor": 4.6,
              "masterOrDoctorate": 1.8,
              "undeclared": 0,
              "none": 44.4
            },
            "vocationalDiploma": {
              "specialisedTechnician": 2.6,
              "technician": 3.1,
              "qualification": 3.6,
              "specialisation": 0.9,
              "initiation": 0.9,
              "undeclared": 0,
              "none": 88.9
            }
          },
          "male": {
            "population": {
              "municipal": 10034689
            },
            "age": {
              "0-4": 9.7,
              "5-9": 8.6,
              "10-14": 8.6,
              "15-19": 8.5,
              "20-24": 9,
              "25-29": 8.3,
              "30-34": 7.9,
              "35-39": 7.1,
              "40-44": 6.7,
              "45-49": 5.8,
              "50-54": 5.8,
              "55-59": 4.7,
              "60-64": 3.7,
              "65-69": 1.9,
              "70-74": 1.5,
              "75+": 2.1
            },
            "maritalStatus": {
              "single": 57.2,
              "married": 41.4,
              "divorced": 0.8,
              "widowed": 0.6,
              "singulateMeanAgeAtMarriage": 32.1
            },
            "disability": {
              "prevalence": 4.6
            },
            "fertility": {
              "completedFertility": null,
              "totalFertilityRate": null
            },
            "schooling": {
              "rate7to12": 97.8
            },
            "illiteracy": {
              "rate10Plus": 14
            },
            "languageCombinations": {
              "arabicOnly": 26,
              "arabicAndFrench": 46.8,
              "arabicFrenchEnglish": 21.9,
              "other": 5.3
            },
            "education": {
              "none": 20.4,
              "preschool": 6.5,
              "primary": 29,
              "lowerSecondary": 19,
              "upperSecondary": 15.3,
              "higher": 10
            },
            "localLanguages": {
              "darija": 96.7,
              "tachelhit": 12,
              "tamazight": 5.1,
              "tarifit": 3.7,
              "hassania": 1.2
            },
            "labour": {
              "active": 5390506,
              "inactive": 4644183,
              "activityRate": 73.4,
              "unemploymentRate": 15.2
            },
            "employmentStatus": {
              "employer": 4.1,
              "selfEmployed": 28.9,
              "publicSector": 13.7,
              "privateSector": 48.4,
              "familyWorker": 1.2,
              "apprentice": 1.1,
              "cooperativeMember": 2.1,
              "other": 0.4
            },
            "commute": {
              "employed": 4559158,
              "walking": 39,
              "bikeOrMotorcycle": 12.2,
              "privateCar": 15.2,
              "bus": 8,
              "taxi": 11.3,
              "employerTransport": 5.6,
              "train": 0.6,
              "tram": 0.3,
              "other": 2.4,
              "worksAtHome": 2,
              "undetermined": 3.4
            },
            "workplace": {
              "atHome": 2,
              "ownNeighbourhood": 22.9,
              "otherNeighbourhood": 26.4,
              "otherCommune": 15.6,
              "otherProvince": 10.5,
              "noFixedPlace": 18.3,
              "elsewhere": 1,
              "undetermined": 3.4
            },
            "study": {
              "students": 2872466,
              "ownNeighbourhood": 46.2,
              "otherNeighbourhood": 32.1,
              "otherCommune": 6.9,
              "otherProvince": 5.6,
              "elsewhere": 0.3,
              "undetermined": 9
            },
            "studyCommute": {
              "walking": 69.1,
              "bikeOrMotorcycle": 2.4,
              "privateCar": 3.8,
              "bus": 6.7,
              "taxi": 2.4,
              "schoolTransport": 5.6,
              "train": 0.5,
              "tram": 0.4,
              "other": 0.4,
              "undetermined": 8.5
            },
            "profession": {
              "employed": 4559158,
              "managersAndProfessionals": 8.9,
              "technicians": 4.1,
              "clerks": 18.4,
              "traders": 11.4,
              "farmers": 1.6,
              "artisans": 27.5,
              "farmLabourers": 2.9,
              "machineOperators": 6,
              "labourers": 17.1,
              "unclassified": 2.3
            },
            "workSector": {
              "agriculture": 4.8,
              "industry": 13.3,
              "utilities": 0.9,
              "construction": 16.6,
              "commerce": 23.5,
              "transport": 7.8,
              "marketServices": 15.7,
              "publicServices": 14,
              "other": 3.3
            },
            "diploma": {
              "population10Plus": 8195220,
              "primary": 26,
              "lowerSecondary": 17.9,
              "upperSecondary": 10.1,
              "bachelor": 5,
              "masterOrDoctorate": 2.3,
              "undeclared": 0,
              "none": 38.7
            },
            "vocationalDiploma": {
              "specialisedTechnician": 2.8,
              "technician": 3.8,
              "qualification": 4.2,
              "specialisation": 1.1,
              "initiation": 0.8,
              "undeclared": 0,
              "none": 87.2
            }
          },
          "female": {
            "population": {
              "municipal": 10249747
            },
            "age": {
              "0-4": 9.1,
              "5-9": 8.1,
              "10-14": 8.1,
              "15-19": 8.4,
              "20-24": 9.2,
              "25-29": 8.6,
              "30-34": 8.3,
              "35-39": 7.6,
              "40-44": 7,
              "45-49": 6.1,
              "50-54": 5.9,
              "55-59": 4.3,
              "60-64": 3.3,
              "65-69": 1.9,
              "70-74": 1.7,
              "75+": 2.4
            },
            "maritalStatus": {
              "single": 47.9,
              "married": 41.8,
              "divorced": 3.1,
              "widowed": 7.3,
              "singulateMeanAgeAtMarriage": 26.4
            },
            "disability": {
              "prevalence": 5
            },
            "fertility": {
              "completedFertility": 2.93,
              "totalFertilityRate": 2.03
            },
            "schooling": {
              "rate7to12": 97.9
            },
            "illiteracy": {
              "rate10Plus": 31
            },
            "languageCombinations": {
              "arabicOnly": 25,
              "arabicAndFrench": 46,
              "arabicFrenchEnglish": 24.5,
              "other": 4.5
            },
            "education": {
              "none": 34.9,
              "preschool": 4.1,
              "primary": 24.2,
              "lowerSecondary": 15.4,
              "upperSecondary": 13.1,
              "higher": 8.4
            },
            "localLanguages": {
              "darija": 95.9,
              "tachelhit": 11,
              "tamazight": 5.2,
              "tarifit": 3.8,
              "hassania": 1.2
            },
            "labour": {
              "active": 1978893,
              "inactive": 8270854,
              "activityRate": 25.8,
              "unemploymentRate": 30.5
            },
            "employmentStatus": {
              "employer": 2.3,
              "selfEmployed": 13.2,
              "publicSector": 16.9,
              "privateSector": 64.5,
              "familyWorker": 1.2,
              "apprentice": 0.4,
              "cooperativeMember": 0.9,
              "other": 0.5
            },
            "commute": {
              "employed": 1373548,
              "walking": 34.8,
              "bikeOrMotorcycle": 1.7,
              "privateCar": 13.2,
              "bus": 10.5,
              "taxi": 15.7,
              "employerTransport": 9.9,
              "train": 0.6,
              "tram": 0.8,
              "other": 1.2,
              "worksAtHome": 6.9,
              "undetermined": 4.9
            },
            "workplace": {
              "atHome": 6.9,
              "ownNeighbourhood": 21.2,
              "otherNeighbourhood": 28.4,
              "otherCommune": 20.5,
              "otherProvince": 11.2,
              "noFixedPlace": 6.2,
              "elsewhere": 0.7,
              "undetermined": 4.9
            },
            "study": {
              "students": 2714264,
              "ownNeighbourhood": 46,
              "otherNeighbourhood": 31.5,
              "otherCommune": 6.6,
              "otherProvince": 5.4,
              "elsewhere": 0.2,
              "undetermined": 10.2
            },
            "studyCommute": {
              "walking": 68.2,
              "bikeOrMotorcycle": 1,
              "privateCar": 3.9,
              "bus": 7.3,
              "taxi": 2.8,
              "schoolTransport": 5.8,
              "train": 0.5,
              "tram": 0.5,
              "other": 0.4,
              "undetermined": 9.7
            },
            "profession": {
              "employed": 1373548,
              "managersAndProfessionals": 16.6,
              "technicians": 8.1,
              "clerks": 21.3,
              "traders": 3,
              "farmers": 0.3,
              "artisans": 22.5,
              "farmLabourers": 2.7,
              "machineOperators": 0.4,
              "labourers": 21.7,
              "unclassified": 3.3
            },
            "workSector": {
              "agriculture": 3.1,
              "industry": 23.7,
              "utilities": 0.8,
              "construction": 1.2,
              "commerce": 9.8,
              "transport": 2.2,
              "marketServices": 28.7,
              "publicServices": 26,
              "other": 4.6
            },
            "diploma": {
              "population10Plus": 8489288,
              "primary": 20.5,
              "lowerSecondary": 15.2,
              "upperSecondary": 9,
              "bachelor": 4.2,
              "masterOrDoctorate": 1.3,
              "undeclared": 0,
              "none": 49.8
            },
            "vocationalDiploma": {
              "specialisedTechnician": 2.5,
              "technician": 2.4,
              "qualification": 3,
              "specialisation": 0.7,
              "initiation": 1,
              "undeclared": 0,
              "none": 90.6
            }
          }
        },
        "rural": {
          "all": {
            "population": {
              "legal": null,
              "municipal": 13325648
            },
            "age": {
              "0-4": 11.3,
              "5-9": 10,
              "10-14": 10.1,
              "15-19": 9.5,
              "20-24": 9.1,
              "25-29": 8.1,
              "30-34": 7.4,
              "35-39": 6.5,
              "40-44": 5.6,
              "45-49": 4.6,
              "50-54": 4.5,
              "55-59": 3.5,
              "60-64": 3.1,
              "65-69": 1.9,
              "70-74": 1.9,
              "75+": 2.8
            },
            "maritalStatus": {
              "single": 54.2,
              "married": 41.2,
              "divorced": 0.9,
              "widowed": 3.7,
              "singulateMeanAgeAtMarriage": 27.5
            },
            "disability": {
              "prevalence": 5.5
            },
            "fertility": {
              "completedFertility": 4.53,
              "totalFertilityRate": 2.53
            },
            "schooling": {
              "rate7to12": 91.6
            },
            "illiteracy": {
              "rate10Plus": 47.5
            },
            "languageCombinations": {
              "arabicOnly": 43.5,
              "arabicAndFrench": 43,
              "arabicFrenchEnglish": 7.5,
              "other": 6
            },
            "education": {
              "none": 50.9,
              "preschool": 3.8,
              "primary": 30.2,
              "lowerSecondary": 10,
              "upperSecondary": 3.6,
              "higher": 1.5
            },
            "localLanguages": {
              "darija": 82.7,
              "tachelhit": 18.2,
              "tamazight": 12.2,
              "tarifit": 4.4,
              "hassania": 0.3
            },
            "labour": {
              "active": 4179065,
              "inactive": 9146583,
              "activityRate": 45.1,
              "unemploymentRate": 10.5
            },
            "employmentStatus": {
              "employer": 1.5,
              "selfEmployed": 37.5,
              "publicSector": 3.2,
              "privateSector": 39.7,
              "familyWorker": 15.4,
              "apprentice": 0.7,
              "cooperativeMember": 1.6,
              "other": 0.5
            },
            "commute": {
              "employed": 3686374,
              "walking": 61.8,
              "bikeOrMotorcycle": 8.2,
              "privateCar": 3.5,
              "bus": 7.7,
              "taxi": 8,
              "employerTransport": 1.1,
              "train": 0.2,
              "tram": 0,
              "other": 3.7,
              "worksAtHome": 3.2,
              "undetermined": 2.7
            },
            "workplace": {
              "atHome": 3.2,
              "ownNeighbourhood": 58.7,
              "otherNeighbourhood": 4.6,
              "otherCommune": 8.8,
              "otherProvince": 10,
              "noFixedPlace": 11.3,
              "elsewhere": 0.8,
              "undetermined": 2.6
            },
            "study": {
              "students": 2805560,
              "ownNeighbourhood": 54.5,
              "otherNeighbourhood": 16.6,
              "otherCommune": 12.8,
              "otherProvince": 4.9,
              "elsewhere": 0.2,
              "undetermined": 11
            },
            "studyCommute": {
              "walking": 70.4,
              "bikeOrMotorcycle": 4,
              "privateCar": 0.6,
              "bus": 5,
              "taxi": 4.9,
              "schoolTransport": 2.4,
              "train": 0.1,
              "tram": 0,
              "other": 1.8,
              "undetermined": 10.7
            },
            "profession": {
              "employed": 3694635,
              "managersAndProfessionals": 1.1,
              "technicians": 0.6,
              "clerks": 5.6,
              "traders": 4.7,
              "farmers": 25.1,
              "artisans": 16.2,
              "farmLabourers": 28.6,
              "machineOperators": 3,
              "labourers": 14.1,
              "unclassified": 1
            },
            "workSector": {
              "agriculture": 54.3,
              "industry": 5.7,
              "utilities": 0.2,
              "construction": 16.6,
              "commerce": 9,
              "transport": 3.1,
              "marketServices": 6.5,
              "publicServices": 3.2,
              "other": 1.5
            },
            "diploma": {
              "population10Plus": 10488260,
              "primary": 17.9,
              "lowerSecondary": 5.3,
              "upperSecondary": 1.8,
              "bachelor": 0.7,
              "masterOrDoctorate": 0.1,
              "undeclared": 0,
              "none": 74.2
            },
            "vocationalDiploma": {
              "specialisedTechnician": 0.2,
              "technician": 0.4,
              "qualification": 0.6,
              "specialisation": 0.2,
              "initiation": 0.2,
              "undeclared": 0,
              "none": 98.3
            }
          },
          "male": {
            "population": {
              "municipal": 6712833
            },
            "age": {
              "0-4": 11.5,
              "5-9": 10.1,
              "10-14": 10.2,
              "15-19": 9.6,
              "20-24": 9.1,
              "25-29": 8.1,
              "30-34": 7.4,
              "35-39": 6.5,
              "40-44": 5.6,
              "45-49": 4.5,
              "50-54": 4.4,
              "55-59": 3.5,
              "60-64": 3.1,
              "65-69": 1.9,
              "70-74": 1.8,
              "75+": 2.8
            },
            "maritalStatus": {
              "single": 59,
              "married": 40,
              "divorced": 0.4,
              "widowed": 0.6,
              "singulateMeanAgeAtMarriage": 30.1
            },
            "disability": {
              "prevalence": 5.6
            },
            "fertility": {
              "completedFertility": null,
              "totalFertilityRate": null
            },
            "schooling": {
              "rate7to12": 93
            },
            "illiteracy": {
              "rate10Plus": 34.9
            },
            "languageCombinations": {
              "arabicOnly": 43.8,
              "arabicAndFrench": 42.5,
              "arabicFrenchEnglish": 7.7,
              "other": 5.9
            },
            "education": {
              "none": 40.6,
              "preschool": 6.4,
              "primary": 33,
              "lowerSecondary": 13.4,
              "upperSecondary": 4.7,
              "higher": 2
            },
            "localLanguages": {
              "darija": 85.4,
              "tachelhit": 17.5,
              "tamazight": 12.2,
              "tarifit": 4.3,
              "hassania": 0.3
            },
            "labour": {
              "active": 3640267,
              "inactive": 3072566,
              "activityRate": 78.8,
              "unemploymentRate": 8.3
            },
            "employmentStatus": {
              "employer": 1.6,
              "selfEmployed": 39.7,
              "publicSector": 3.2,
              "privateSector": 40.8,
              "familyWorker": 11.9,
              "apprentice": 0.7,
              "cooperativeMember": 1.6,
              "other": 0.5
            },
            "commute": {
              "employed": 3302893,
              "walking": 61.4,
              "bikeOrMotorcycle": 9,
              "privateCar": 3.8,
              "bus": 8.1,
              "taxi": 8.3,
              "employerTransport": 0.9,
              "train": 0.2,
              "tram": 0,
              "other": 3.9,
              "worksAtHome": 1.9,
              "undetermined": 2.6
            },
            "workplace": {
              "atHome": 1.9,
              "ownNeighbourhood": 58.2,
              "otherNeighbourhood": 4.8,
              "otherCommune": 9,
              "otherProvince": 10.5,
              "noFixedPlace": 12.3,
              "elsewhere": 0.8,
              "undetermined": 2.5
            },
            "study": {
              "students": 1579428,
              "ownNeighbourhood": 52.7,
              "otherNeighbourhood": 17.2,
              "otherCommune": 14.3,
              "otherProvince": 5.8,
              "elsewhere": 0.2,
              "undetermined": 9.9
            },
            "studyCommute": {
              "walking": 68.8,
              "bikeOrMotorcycle": 5.2,
              "privateCar": 0.7,
              "bus": 5.5,
              "taxi": 5.6,
              "schoolTransport": 2.5,
              "train": 0.1,
              "tram": 0,
              "other": 2.1,
              "undetermined": 9.6
            },
            "profession": {
              "employed": 3309715,
              "managersAndProfessionals": 1,
              "technicians": 0.5,
              "clerks": 5.8,
              "traders": 5.1,
              "farmers": 26.6,
              "artisans": 16.6,
              "farmLabourers": 25.6,
              "machineOperators": 3.3,
              "labourers": 14.6,
              "unclassified": 0.9
            },
            "workSector": {
              "agriculture": 52.9,
              "industry": 4.8,
              "utilities": 0.2,
              "construction": 18.4,
              "commerce": 9.6,
              "transport": 3.4,
              "marketServices": 6.1,
              "publicServices": 3.1,
              "other": 1.4
            },
            "diploma": {
              "population10Plus": 5263418,
              "primary": 22,
              "lowerSecondary": 6.9,
              "upperSecondary": 2.4,
              "bachelor": 1,
              "masterOrDoctorate": 0.1,
              "undeclared": 0,
              "none": 67.4
            },
            "vocationalDiploma": {
              "specialisedTechnician": 0.3,
              "technician": 0.6,
              "qualification": 1,
              "specialisation": 0.3,
              "initiation": 0.2,
              "undeclared": 0,
              "none": 97.5
            }
          },
          "female": {
            "population": {
              "municipal": 6612815
            },
            "age": {
              "0-4": 11.1,
              "5-9": 9.9,
              "10-14": 9.9,
              "15-19": 9.5,
              "20-24": 9,
              "25-29": 8.2,
              "30-34": 7.5,
              "35-39": 6.6,
              "40-44": 5.7,
              "45-49": 4.7,
              "50-54": 4.7,
              "55-59": 3.5,
              "60-64": 3.2,
              "65-69": 1.9,
              "70-74": 1.9,
              "75+": 2.8
            },
            "maritalStatus": {
              "single": 49.3,
              "married": 42.5,
              "divorced": 1.4,
              "widowed": 6.8,
              "singulateMeanAgeAtMarriage": 24.8
            },
            "disability": {
              "prevalence": 5.3
            },
            "fertility": {
              "completedFertility": 4.53,
              "totalFertilityRate": 2.53
            },
            "schooling": {
              "rate7to12": 90.1
            },
            "illiteracy": {
              "rate10Plus": 60.1
            },
            "languageCombinations": {
              "arabicOnly": 43.1,
              "arabicAndFrench": 43.8,
              "arabicFrenchEnglish": 7,
              "other": 6.1
            },
            "education": {
              "none": 61.3,
              "preschool": 1.3,
              "primary": 27.4,
              "lowerSecondary": 6.6,
              "upperSecondary": 2.5,
              "higher": 0.9
            },
            "localLanguages": {
              "darija": 80,
              "tachelhit": 18.9,
              "tamazight": 12.3,
              "tarifit": 4.5,
              "hassania": 0.3
            },
            "labour": {
              "active": 538798,
              "inactive": 6074017,
              "activityRate": 11.4,
              "unemploymentRate": 26.2
            },
            "employmentStatus": {
              "employer": 0.9,
              "selfEmployed": 19.1,
              "publicSector": 3.1,
              "privateSector": 30.2,
              "familyWorker": 44.4,
              "apprentice": 0.3,
              "cooperativeMember": 1.7,
              "other": 0.3
            },
            "commute": {
              "employed": 383481,
              "walking": 65.2,
              "bikeOrMotorcycle": 1.1,
              "privateCar": 1.4,
              "bus": 4.4,
              "taxi": 5.2,
              "employerTransport": 2.8,
              "train": 0.2,
              "tram": 0,
              "other": 2.3,
              "worksAtHome": 13.9,
              "undetermined": 3.7
            },
            "workplace": {
              "atHome": 13.9,
              "ownNeighbourhood": 63.4,
              "otherNeighbourhood": 3.3,
              "otherCommune": 6.9,
              "otherProvince": 5.8,
              "noFixedPlace": 3,
              "elsewhere": 0.4,
              "undetermined": 3.5
            },
            "study": {
              "students": 1226132,
              "ownNeighbourhood": 56.9,
              "otherNeighbourhood": 15.8,
              "otherCommune": 10.9,
              "otherProvince": 3.8,
              "elsewhere": 0.1,
              "undetermined": 12.5
            },
            "studyCommute": {
              "walking": 72.5,
              "bikeOrMotorcycle": 2.4,
              "privateCar": 0.6,
              "bus": 4.3,
              "taxi": 4.1,
              "schoolTransport": 2.3,
              "train": 0.1,
              "tram": 0,
              "other": 1.5,
              "undetermined": 12.2
            },
            "profession": {
              "employed": 384920,
              "managersAndProfessionals": 2.3,
              "technicians": 1.3,
              "clerks": 4.2,
              "traders": 1.4,
              "farmers": 11.9,
              "artisans": 12.8,
              "farmLabourers": 54.1,
              "machineOperators": 0.2,
              "labourers": 9.9,
              "unclassified": 1.8
            },
            "workSector": {
              "agriculture": 65.9,
              "industry": 12.7,
              "utilities": 0.1,
              "construction": 1,
              "commerce": 3.4,
              "transport": 0.3,
              "marketServices": 9.6,
              "publicServices": 4.7,
              "other": 2.2
            },
            "diploma": {
              "population10Plus": 5224842,
              "primary": 13.7,
              "lowerSecondary": 3.7,
              "upperSecondary": 1.3,
              "bachelor": 0.4,
              "masterOrDoctorate": 0,
              "undeclared": 0,
              "none": 80.9
            },
            "vocationalDiploma": {
              "specialisedTechnician": 0.2,
              "technician": 0.2,
              "qualification": 0.2,
              "specialisation": 0.1,
              "initiation": 0.1,
              "undeclared": 0,
              "none": 99.2
            }
          }
        }
      },
      "households": {
        "total": {
          "households": {
            "municipalPopulation": 33610084,
            "count": 7313806,
            "averageSize": 4.6,
            "peoplePerRoom": 1.4,
            "distanceToPavedRoadKm": 3
          },
          "dwellingType": {
            "villa": 3.2,
            "apartment": 11.6,
            "moroccanHouse": 56.8,
            "basicOrSlum": 4.5,
            "rural": 22.8,
            "other": 1
          },
          "occupancy": {
            "owner": 71.9,
            "tenant": 18.8,
            "other": 9.2
          },
          "dwellingAge": {
            "under10": 20.1,
            "10-19": 22.2,
            "20-49": 37.4,
            "50+": 20.3
          },
          "amenities": {
            "kitchen": 93.5,
            "toilet": 93.7,
            "bathroom": 54,
            "electricity": 91.6,
            "runningWater": 73
          },
          "wastewater": {
            "publicSewer": 58.9,
            "septicTank": 23.2,
            "other": 17.9
          },
          "householdWaste": {
            "municipalBin": 46.1,
            "truck": 19.3,
            "otherOrOpen": 34.6
          },
          "cookingFuel": {
            "gas": 96.9,
            "electricity": 4.8,
            "charcoal": 1.5,
            "firewood": 10.2,
            "animalWaste": 4.3
          },
          "equipment": {
            "television": 92.5,
            "radio": 52.6,
            "mobilePhone": 94.3,
            "landline": 13.5,
            "internet": 19.3,
            "computer": 25.4,
            "satelliteDish": 84,
            "refrigerator": 85.1
          }
        },
        "urban": {
          "households": {
            "municipalPopulation": 20284436,
            "count": 4807743,
            "averageSize": 4.2,
            "peoplePerRoom": 1.3,
            "distanceToPavedRoadKm": null
          },
          "dwellingType": {
            "villa": 4.5,
            "apartment": 17.5,
            "moroccanHouse": 70.4,
            "basicOrSlum": 5.2,
            "rural": 1.3,
            "other": 1
          },
          "occupancy": {
            "owner": 62.7,
            "tenant": 27.6,
            "other": 9.6
          },
          "dwellingAge": {
            "under10": 20.7,
            "10-19": 23.6,
            "20-49": 40.8,
            "50+": 14.9
          },
          "amenities": {
            "kitchen": 94.9,
            "toilet": 99,
            "bathroom": 58.3,
            "electricity": 95.2,
            "runningWater": 91.3
          },
          "wastewater": {
            "publicSewer": 88.2,
            "septicTank": 9.6,
            "other": 2.2
          },
          "householdWaste": {
            "municipalBin": 68.3,
            "truck": 26.6,
            "otherOrOpen": 5.1
          },
          "cookingFuel": {
            "gas": 99.6,
            "electricity": 6.5,
            "charcoal": 1.1,
            "firewood": 1.4,
            "animalWaste": 0.8
          },
          "equipment": {
            "television": 96.1,
            "radio": 55.4,
            "mobilePhone": 96.5,
            "landline": 19.7,
            "internet": 27.5,
            "computer": 35.7,
            "satelliteDish": 90.4,
            "refrigerator": 91.4
          }
        },
        "rural": {
          "households": {
            "municipalPopulation": 13325648,
            "count": 2506063,
            "averageSize": 5.3,
            "peoplePerRoom": 1.6,
            "distanceToPavedRoadKm": 3
          },
          "dwellingType": {
            "villa": 0.8,
            "apartment": 0.3,
            "moroccanHouse": 30.7,
            "basicOrSlum": 3.1,
            "rural": 64.1,
            "other": 1
          },
          "occupancy": {
            "owner": 89.6,
            "tenant": 1.9,
            "other": 8.5
          },
          "dwellingAge": {
            "under10": 19,
            "10-19": 19.3,
            "20-49": 30.9,
            "50+": 30.7
          },
          "amenities": {
            "kitchen": 90.8,
            "toilet": 83.4,
            "bathroom": 45.9,
            "electricity": 84.6,
            "runningWater": 37.8
          },
          "wastewater": {
            "publicSewer": 2.9,
            "septicTank": 49.2,
            "other": 47.9
          },
          "householdWaste": {
            "municipalBin": 3.4,
            "truck": 5.3,
            "otherOrOpen": 91.3
          },
          "cookingFuel": {
            "gas": 91.7,
            "electricity": 1.7,
            "charcoal": 2.3,
            "firewood": 27.1,
            "animalWaste": 11.2
          },
          "equipment": {
            "television": 85.7,
            "radio": 47.3,
            "mobilePhone": 90.3,
            "landline": 1.5,
            "internet": 3.6,
            "computer": 5.7,
            "satelliteDish": 71.8,
            "refrigerator": 73
          }
        }
      }
    },
    "code": null,
    "codeDigits": null,
    "level": "country",
    "name": {
      "fr": "Maroc",
      "ar": "المغرب"
    },
    "fromLocalAdministration": false,
    "people": {
      "total": {
        "all": {
          "fertility": {
            "totalFertilityRate": 1.97,
            "completedFertility": 2.8
          },
          "localLanguages": {
            "darija": 91.9,
            "tachelhit": 14.2,
            "tamazight": 7.4,
            "tarifit": 3.2,
            "hassania": 0.8
          }
        },
        "male": {
          "localLanguages": {
            "darija": 92.7,
            "tachelhit": 14.2,
            "tamazight": 7.4,
            "tarifit": 3.1,
            "hassania": 0.8
          }
        },
        "female": {
          "fertility": {
            "totalFertilityRate": 1.97,
            "completedFertility": 2.8
          },
          "localLanguages": {
            "darija": 91.1,
            "tachelhit": 14.2,
            "tamazight": 7.5,
            "tarifit": 3.3,
            "hassania": 0.8
          }
        }
      },
      "urban": {
        "all": {
          "fertility": {
            "totalFertilityRate": 1.77,
            "completedFertility": 2.5
          },
          "localLanguages": {
            "darija": 96.3,
            "tachelhit": 11.7,
            "tamazight": 5.1,
            "tarifit": 3,
            "hassania": 1.1
          }
        },
        "male": {
          "localLanguages": {
            "darija": 96.6,
            "tachelhit": 11.9,
            "tamazight": 5.1,
            "tarifit": 2.9,
            "hassania": 1.1
          }
        },
        "female": {
          "fertility": {
            "totalFertilityRate": 1.77,
            "completedFertility": 2.5
          },
          "localLanguages": {
            "darija": 95.9,
            "tachelhit": 11.5,
            "tamazight": 5.2,
            "tarifit": 3.1,
            "hassania": 1.1
          }
        }
      },
      "rural": {
        "all": {
          "fertility": {
            "totalFertilityRate": 2.37,
            "completedFertility": 3.4
          },
          "localLanguages": {
            "darija": 84.5,
            "tachelhit": 18.5,
            "tamazight": 11.3,
            "tarifit": 3.5,
            "hassania": 0.3
          }
        },
        "male": {
          "localLanguages": {
            "darija": 86.3,
            "tachelhit": 18,
            "tamazight": 11.2,
            "tarifit": 3.3,
            "hassania": 0.3
          }
        },
        "female": {
          "fertility": {
            "totalFertilityRate": 2.37,
            "completedFertility": 3.4
          },
          "localLanguages": {
            "darija": 82.7,
            "tachelhit": 19,
            "tamazight": 11.5,
            "tarifit": 3.6,
            "hassania": 0.3
          }
        }
      }
    },
    "households": {
      "total": {
        "households": {
          "municipalPopulation": 36490591,
          "count": 9275038,
          "averageSize": 3.9,
          "sedentary": 9263270,
          "peoplePerRoom": 1.4,
          "distanceToPavedRoadKm": 1.5
        }
      },
      "urban": {
        "households": {
          "municipalPopulation": 22921202,
          "count": 6173930,
          "averageSize": 3.7,
          "sedentary": 6166796,
          "peoplePerRoom": 1.3,
          "distanceToPavedRoadKm": null
        }
      },
      "rural": {
        "households": {
          "municipalPopulation": 13569389,
          "count": 3101108,
          "averageSize": 4.4,
          "sedentary": 3096474,
          "peoplePerRoom": 1.7,
          "distanceToPavedRoadKm": 1.5
        }
      }
    }
  },
  "meta": {
    "datasetVersion": "1.8.0"
  },
  "links": {
    "self": "/api/indicators.json",
    "prev": null,
    "next": null
  }
}

Cut here to a few topics. The file has them all.

GET /api/{collection}/{code}/economy

A unit's economic establishments, counted during the 2024 census

How many establishments HCP's field teams mapped in a région, province, cercle, commune or arrondissement, how many are public services, associations or businesses, and how many permanent jobs those businesses hold. The businesses are split by sector, by how many people work there and by when they were founded, each split covering all of them. The weekly souks in use are counted beside them. Farming is out: every sector but agriculture is counted. The 6 cities with arrondissements are counted by arrondissement, so their figures are the sum of those, marked basis. /data/v1/economy/fields.json names every field with HCP's heading.

collectionrequired
regions | provinces | cercles | communes | arrondissementsThe unit's level.
coderequired
stringA dotted code, padded or unpadded digits, or a slug.
  • 200The unit's establishments.
  • 400Not an identifier.
  • 404No unit has that identifier, or it's in another collection.
Example · GET /api/communes/tiznit/economy
{
  "data": {
    "code": "09.581.01.07",
    "codeDigits": "095810107",
    "level": "commune",
    "name": {
      "fr": "Tiznit",
      "ar": "تيزنيت"
    },
    "topics": {
      "establishments": {
        "total": 5079,
        "publicServices": 211,
        "nonProfit": 137,
        "weeklySouks": 1,
        "business": 4731,
        "jobs": 8219
      },
      "sector": {
        "industry": 503,
        "construction": 256,
        "commerce": 2600,
        "services": 1372
      },
      "size": {
        "1": 3391,
        "2-3": 1081,
        "4-9": 205,
        "10-49": 47,
        "50+": 7
      },
      "founded": {
        "before1956": 2,
        "1956-1980": 131,
        "1981-1990": 211,
        "1991-2000": 440,
        "2001-2010": 801,
        "2011-2019": 1816,
        "2020+": 1330
      }
    }
  },
  "meta": {
    "datasetVersion": "1.8.0"
  },
  "links": {
    "self": "/api/communes/09.581.01.07/economy.json",
    "prev": null,
    "next": null
  }
}

GET /api/economy.json

Morocco's economic establishments, counted during the 2024 census

The same counts for the country as a whole.

  • 200Morocco's establishments.
Example · GET /api/economy.json
{
  "data": {
    "code": null,
    "codeDigits": null,
    "level": "country",
    "name": {
      "fr": "Maroc",
      "ar": "المغرب"
    },
    "topics": {
      "establishments": {
        "total": 1304564,
        "publicServices": 147062,
        "nonProfit": 27481,
        "weeklySouks": 1022,
        "business": 1130021,
        "jobs": 3585475
      },
      "sector": {
        "industry": 154979,
        "construction": 39522,
        "commerce": 587177,
        "services": 348343
      },
      "size": {
        "1": 637834,
        "2-3": 371110,
        "4-9": 90677,
        "10-49": 24961,
        "50+": 5439
      },
      "founded": {
        "before1956": 7446,
        "1956-1980": 32106,
        "1981-1990": 34954,
        "1991-2000": 84809,
        "2001-2010": 191285,
        "2011-2019": 416003,
        "2020+": 363418
      }
    }
  },
  "meta": {
    "datasetVersion": "1.8.0"
  },
  "links": {
    "self": "/api/economy.json",
    "prev": null,
    "next": null
  }
}

GET /api/{collection}/{code}/housing

A unit's urban housing stock, counted at the 2024 census

How many urban dwellings a unit has, how many are occupied, vacant or second homes, what kind they are, how old, what their walls and roofs are made of, how many are on the public electricity, water and sewerage networks, and HCP's housing shortfall. Every figure but the count is a percentage of that unit's urban dwellings. This counts dwellings rather than households: a vacant flat is here and in nobody's census record. A unit with no urban area has no file. /data/v1/housing/fields.json names every field with the workbook's own wording.

collectionrequired
regions | provinces | cercles | communes | arrondissementsThe unit's level.
coderequired
stringA dotted code, padded or unpadded digits, or a slug.
  • 200The unit's urban housing stock.
  • 400Not an identifier.
  • 404No unit has that identifier, it's in another collection, or it has no urban dwellings.
Example · GET /api/communes/tiznit/housing
{
  "data": {
    "code": "09.581.01.07",
    "codeDigits": "095810107",
    "level": "commune",
    "name": {
      "fr": "Tiznit",
      "ar": "تيزنيت"
    },
    "topics": {
      "dwellings": {
        "total": 34570,
        "deficitRate": 0.9
      },
      "occupancy": {
        "occupied": 67.2,
        "vacant": 15.2,
        "seasonal": 17.6,
        "unoccupied": 32.8
      },
      "type": {
        "villa": 1.7,
        "apartment": 10.1,
        "traditional": 1.9,
        "modern": 85.7,
        "sound": 99.4,
        "slum": 0.1,
        "ruralType": 0.1,
        "other": 0.3,
        "precarious": 0.6
      },
      "age": {
        "under20": 55.9,
        "20-49": 40.7,
        "50+": 3.3
      },
      "ageByType": {
        "villaUnder20": 76.7,
        "villa20to49": 23.1,
        "villa50Plus": 0.2,
        "apartmentUnder20": 59.2,
        "apartment20to49": 39.5,
        "apartment50Plus": 1.3,
        "traditionalUnder20": 24.8,
        "traditional20to49": 46.6,
        "traditional50Plus": 28.6,
        "modernUnder20": 56,
        "modern20to49": 41,
        "modern50Plus": 3,
        "soundUnder20": 56,
        "sound20to49": 40.7,
        "sound50Plus": 3.3,
        "slumUnder20": 83.3,
        "slum20to49": 16.7,
        "slum50Plus": 0,
        "ruralTypeUnder20": 10.7,
        "ruralType20to49": 89.3,
        "ruralType50Plus": 0,
        "otherUnder20": 40.2,
        "other20to49": 47.4,
        "other50Plus": 12.3,
        "precariousUnder20": 39.1,
        "precarious20to49": 53.6,
        "precarious50Plus": 7.3
      },
      "walls": {
        "concreteOrBrick": 99.1,
        "stone": 0.8,
        "other": 0.1
      },
      "roofs": {
        "slab": 98.4,
        "woodOrTiles": 1.5,
        "sheetMetal": 0,
        "other": 0
      },
      "networks": {
        "electricity": 95,
        "water": 96,
        "sewerage": 84.9
      }
    },
    "urbanCentres": []
  },
  "meta": {
    "datasetVersion": "1.8.0"
  },
  "links": {
    "self": "/api/communes/09.581.01.07/housing.json",
    "prev": null,
    "next": null
  }
}

GET /api/communes/{code}/neighbours

The communes that border a commune

Each with its names and the length of the border the two share, in km, measured along their OpenStreetMap boundaries. Sidi Mohamed Benmansour has no boundary, so its list is empty.

coderequired
stringA dotted code, padded or unpadded digits, or a slug.
  • 200The communes it borders.
  • 400Not an identifier.
  • 404No commune has that identifier.
Example · GET /api/communes/tiznit/neighbours
{
  "data": [
    {
      "code": "09.581.11.07",
      "name": {
        "fr": "El Maader El Kabir",
        "ar": "المعدر الكبير"
      },
      "km": 4.38
    },
    {
      "code": "09.581.11.09",
      "name": {
        "fr": "Ouijjane",
        "ar": "وجان"
      },
      "km": 9.83
    },
    {
      "code": "09.581.11.11",
      "name": {
        "fr": "Reggada",
        "ar": "الركادة"
      },
      "km": 5.98
    },
    {
      "code": "09.581.11.15",
      "name": {
        "fr": "Tnine Aglou",
        "ar": "اثنين أكلو"
      },
      "km": 20.76
    }
  ],
  "meta": {
    "datasetVersion": "1.8.0",
    "total": 4
  },
  "links": {
    "self": "/api/communes/09.581.01.07/neighbours.json",
    "prev": null,
    "next": null
  }
}

GET /api/housing.json

Morocco's urban housing stock, counted at the 2024 census

The same figures for every town in the country together.

  • 200Morocco's urban housing stock.
Example · GET /api/housing.json
{
  "data": {
    "code": null,
    "codeDigits": null,
    "level": "country",
    "name": {
      "fr": "Maroc",
      "ar": "المغرب"
    },
    "topics": {
      "dwellings": {
        "total": 8336782,
        "deficitRate": 4.9
      },
      "occupancy": {
        "occupied": 71.1,
        "vacant": 13.4,
        "seasonal": 15.5,
        "unoccupied": 28.9
      },
      "type": {
        "villa": 3.2,
        "apartment": 31.7,
        "traditional": 2.5,
        "modern": 59.2,
        "sound": 96.6,
        "slum": 2.2,
        "ruralType": 0.6,
        "other": 0.6,
        "precarious": 3.4
      },
      "age": {
        "under20": 59.8,
        "20-49": 33.9,
        "50+": 6.2
      },
      "ageByType": {
        "villaUnder20": 60.3,
        "villa20to49": 34.2,
        "villa50Plus": 5.5,
        "apartmentUnder20": 77.5,
        "apartment20to49": 20,
        "apartment50Plus": 2.5,
        "traditionalUnder20": 22,
        "traditional20to49": 40.7,
        "traditional50Plus": 37.4,
        "modernUnder20": 53.5,
        "modern20to49": 40.2,
        "modern50Plus": 6.3,
        "soundUnder20": 60.8,
        "sound20to49": 33.4,
        "sound50Plus": 5.8,
        "slumUnder20": 28.5,
        "slum20to49": 53,
        "slum50Plus": 18.5,
        "ruralTypeUnder20": 30.7,
        "ruralType20to49": 46.1,
        "ruralType50Plus": 23.2,
        "otherUnder20": 46.2,
        "other20to49": 40.7,
        "other50Plus": 13.1,
        "precariousUnder20": 32,
        "precarious20to49": 49.6,
        "precarious50Plus": 18.4
      },
      "walls": {
        "concreteOrBrick": 98.2,
        "stone": 1.2,
        "other": 0.6
      },
      "roofs": {
        "slab": 96.7,
        "woodOrTiles": 1.6,
        "sheetMetal": 0.8,
        "other": 0.9
      },
      "networks": {
        "electricity": 96.3,
        "water": 95.2,
        "sewerage": 92.6
      }
    }
  },
  "meta": {
    "datasetVersion": "1.8.0"
  },
  "links": {
    "self": "/api/housing.json",
    "prev": null,
    "next": null
  }
}

GET /api/regions.json

All 12 régions

  • 200Every région.
Example · GET /api/regions.json
{
  "data": [
    {
      "code": "01",
      "codeDigits": "01",
      "name": {
        "fr": "Tanger-Tétouan-Al Hoceima",
        "ar": "طنجة-تطوان-الحسيمة"
      },
      "population": {
        "2024": {
          "total": 4030222,
          "moroccan": 4020545,
          "foreign": 9677,
          "households": 1048860
        }
      },
      "provenance": {
        "name": "hcp-2024",
        "population2024": "hcp-2024"
      },
      "provinceCount": 8,
      "communeCount": 146
    },
    {
      "code": "02",
      "codeDigits": "02",
      "name": {
        "fr": "Oriental",
        "ar": "الشرق"
      },
      "population": {
        "2024": {
          "total": 2294665,
          "moroccan": 2291040,
          "foreign": 3625,
          "households": 575015
        }
      },
      "provenance": {
        "name": "hcp-2024",
        "population2024": "hcp-2024"
      },
      "provinceCount": 8,
      "communeCount": 124
    }
  ],
  "meta": {
    "datasetVersion": "1.8.0",
    "total": 12
  },
  "links": {
    "self": "/api/regions.json",
    "prev": null,
    "next": null
  }
}

2 of 12 rows shown here.

GET /api/provinces.json

All provinces and préfectures

  • 200Every province and préfecture.
Example · GET /api/provinces.json
{
  "data": [
    {
      "code": "01.511",
      "codeDigits": "01511",
      "name": {
        "fr": "Tanger-Assilah",
        "ar": "طنجة-أصيلة"
      },
      "population": {
        "2024": {
          "total": 1494413,
          "moroccan": 1487175,
          "foreign": 7238,
          "households": 418844
        }
      },
      "provenance": {
        "name": "hcp-2024",
        "population2024": "hcp-2024"
      },
      "type": "prefecture",
      "regionCode": "01",
      "cercleCount": 2,
      "communeCount": 12
    },
    {
      "code": "01.573",
      "codeDigits": "01573",
      "name": {
        "fr": "M'diq-Fnideq",
        "ar": "المضيق-الفنيدق"
      },
      "population": {
        "2024": {
          "total": 254064,
          "moroccan": 253388,
          "foreign": 676,
          "households": 67797
        }
      },
      "provenance": {
        "name": "hcp-2024",
        "population2024": "hcp-2024"
      },
      "type": "prefecture",
      "regionCode": "01",
      "cercleCount": 0,
      "communeCount": 5
    }
  ],
  "meta": {
    "datasetVersion": "1.8.0",
    "total": 83
  },
  "links": {
    "self": "/api/provinces.json",
    "prev": null,
    "next": null
  }
}

2 of 83 rows shown here.

GET /api/cercles.json

All cercles

  • 200Every cercle.
Example · GET /api/cercles.json
{
  "data": [
    {
      "code": "01.511.05",
      "codeDigits": "0151105",
      "name": {
        "fr": "Tanger",
        "ar": "طنجة"
      },
      "population": {
        "2024": {
          "total": 60807,
          "moroccan": 60765,
          "foreign": 42,
          "households": 14102
        }
      },
      "provenance": {
        "name": "hcp-2024",
        "population2024": "hcp-2024"
      },
      "regionCode": "01",
      "provinceCode": "01.511",
      "communeCount": 5
    },
    {
      "code": "01.511.03",
      "codeDigits": "0151103",
      "name": {
        "fr": "Assilah",
        "ar": "أصيلة"
      },
      "population": {
        "2024": {
          "total": 33463,
          "moroccan": 33434,
          "foreign": 29,
          "households": 7896
        }
      },
      "provenance": {
        "name": "hcp-2024",
        "population2024": "hcp-2024"
      },
      "regionCode": "01",
      "provinceCode": "01.511",
      "communeCount": 4
    }
  ],
  "meta": {
    "datasetVersion": "1.8.0",
    "total": 213
  },
  "links": {
    "self": "/api/cercles.json",
    "prev": null,
    "next": null
  }
}

2 of 213 rows shown here.

GET /api/version.json

Dataset version, record counts and the vintage of every source

  • 200The version document.
Example · GET /api/version.json
{
  "data": {
    "api": "v1",
    "counts": {
      "regions": 12,
      "provinces": 83,
      "cercles": 213,
      "communes": 1503,
      "arrondissements": 41
    },
    "sources": {
      "datasetVersion": "1.8.0",
      "sources": [
        {
          "id": "hcp-2024",
          "url": "https://www.hcp.ma/file/242341/",
          "licence": "Haut-Commissariat au Plan, RGPH 2024. Reusable, commercially too, on CC BY 4.0 terms: credit HCP and say what was changed. https://www.hcp.ma/Conditions-generales-d-utilisation-Version-1-0_a2194.html",
          "sha256": "7e9d3d402cc2fd0d9c4fc941c4f23c6a5e5ddcbefbba80b7540267f8e2728dca",
          "retrievedAt": "2026-09-17"
        },
        {
          "id": "hcp-2024-indicators",
          "url": "https://www.hcp.ma/file/242671/",
          "licence": "Haut-Commissariat au Plan, RGPH 2024, Indicateurs démographiques et socioéconomiques. Reusable, commercially too, on CC BY 4.0 terms: credit HCP and say what was changed. https://www.hcp.ma/Conditions-generales-d-utilisation-Version-1-0_a2194.html",
          "sha256": "f3d96fcae3c10a2c194b2fe97ee8352a242fb3f36b1b63d4d2a7006176dc7c3e",
          "retrievedAt": "2026-09-19"
        },
        {
          "id": "hcp-2014",
          "url": "https://www.hcp.ma/file/230057/",
          "licence": "Haut-Commissariat au Plan, RGPH 2014. Reusable, commercially too, on CC BY 4.0 terms: credit HCP and say what was changed. https://www.hcp.ma/Conditions-generales-d-utilisation-Version-1-0_a2194.html",
          "sha256": "e0a7e308c0c1e185e5bec0c080d10635b19e83216d0bf91656554c707bbf0709",
          "retrievedAt": "2026-09-17"
        },
        {
          "id": "hcp-2014-indicators-people",
          "url": "https://www.hcp.ma/file/230045/",
          "licence": "Haut-Commissariat au Plan, RGPH 2014, Indicateurs démographiques et socioéconomiques de la population. Reusable, commercially too, on CC BY 4.0 terms: credit HCP and say what was changed. https://www.hcp.ma/Conditions-generales-d-utilisation-Version-1-0_a2194.html",
          "sha256": "c20c1f7d08c1089bf4610f81a0eac89516a278fddb24b8577588284e2fc9a2d0",
          "retrievedAt": "2026-09-19"
        },
        {
          "id": "hcp-2014-indicators-households",
          "url": "https://www.hcp.ma/file/230042/",
          "licence": "Haut-Commissariat au Plan, RGPH 2014, Indicateurs sur les ménages et les conditions d'habitation. Reusable, commercially too, on CC BY 4.0 terms: credit HCP and say what was changed. https://www.hcp.ma/Conditions-generales-d-utilisation-Version-1-0_a2194.html",
          "sha256": "2fde794a15d0d98889875316666d918f1044f8055610bfb909d056a15fe878a1",
          "retrievedAt": "2026-09-19"
        },
        {
          "id": "hcp-2024-commute",
          "url": "https://www.hcp.ma/file/248301/",
          "licence": "Haut-Commissariat au Plan, RGPH 2024, Indicateurs communaux sur le mode de transport domicile-lieu de travail des actifs occupés. Reusable, commercially too, on CC BY 4.0 terms: credit HCP and say what was changed. https://www.hcp.ma/Conditions-generales-d-utilisation-Version-1-0_a2194.html",
          "sha256": "30e8fc0047fe7ada2cb1db36e127e8d31966da2e775183b9bb0c7eeffd540027",
          "retrievedAt": "2026-09-19"
        },
        {
          "id": "hcp-2014-mobility",
          "url": "https://www.hcp.ma/file/230011/",
          "licence": "Haut-Commissariat au Plan, RGPH 2014, Indicateurs sur la mobilité et le transport par commune. Reusable, commercially too, on CC BY 4.0 terms: credit HCP and say what was changed. https://www.hcp.ma/Conditions-generales-d-utilisation-Version-1-0_a2194.html",
          "sha256": "ed3c24c0c9dba69cac98c03bf27235211ffdf66e6edd97a84b61d9f0c64aa957",
          "retrievedAt": "2026-09-19"
        },
        {
          "id": "hcp-2024-establishments",
          "url": "https://www.hcp.ma/file/242672/",
          "licence": "Haut-Commissariat au Plan, RGPH 2024, Cartographie des établissements économiques. Reusable, commercially too, on CC BY 4.0 terms: credit HCP and say what was changed. https://www.hcp.ma/Conditions-generales-d-utilisation-Version-1-0_a2194.html",
          "sha256": "33887f36154129e9fc8eceb6d5393d5b26fae0851f153cdb1ed6358e0aed38ee",
          "retrievedAt": "2026-09-20"
        },
        {
          "id": "hcp-2014-professions",
          "url": "https://www.hcp.ma/file/230028/",
          "licence": "Haut-Commissariat au Plan, RGPH 2014, Indicateurs sur les professions et les secteurs d'activité de la population active occupée. Reusable, commercially too, on CC BY 4.0 terms: credit HCP and say what was changed. https://www.hcp.ma/Conditions-generales-d-utilisation-Version-1-0_a2194.html",
          "sha256": "c3b94173217e306fa14ce628269bd6b1f0855ccf03eb3503e5da08340c58c644",
          "retrievedAt": "2026-09-20"
        },
        {
          "id": "hcp-2014-diplomas",
          "url": "https://www.hcp.ma/file/230031/",
          "licence": "Haut-Commissariat au Plan, RGPH 2014, Indicateurs sur les diplômes de la population. Reusable, commercially too, on CC BY 4.0 terms: credit HCP and say what was changed. https://www.hcp.ma/Conditions-generales-d-utilisation-Version-1-0_a2194.html",
          "sha256": "5b6e4785caa3ef42265d4af4b4e1390195d7c114bbf58a1d9867866826329ad6",
          "retrievedAt": "2026-09-20"
        },
        {
          "id": "hcp-2024-housing",
          "url": "https://www.hcp.ma/file/246208/",
          "licence": "Haut-Commissariat au Plan, RGPH 2024, Indicateurs communaux du parc logement urbain. Reusable, commercially too, on CC BY 4.0 terms: credit HCP and say what was changed. https://www.hcp.ma/Conditions-generales-d-utilisation-Version-1-0_a2194.html",
          "sha256": "c5ca0d86eef04cac4692cc0fff691e81f77e73726515b12eb17a0d7f3a8ff421",
          "retrievedAt": "2026-09-20"
        },
        {
          "id": "osm",
          "via": "Overpass API",
          "licence": "ODbL-1.0",
          "attribution": "© OpenStreetMap contributors, opendatacommons.org/licenses/odbl/1-0/",
          "snapshot": {
            "earliest": "2026-09-17T16:53:06.964Z",
            "latest": "2026-09-19T02:18:14.612Z",
            "regions": 12
          }
        }
      ]
    }
  },
  "meta": {
    "datasetVersion": "1.8.0"
  },
  "links": {
    "self": "/api/version.json",
    "prev": null,
    "next": null
  }
}

Other files

Static files for the questions the routes above don’t cover. Like every .json path, they cost nothing to call.

PathHolds
/api/regions/{code}.jsonOne région
/api/regions/{code}/provinces.jsonA région’s provinces and préfectures
/api/regions/{code}/communes/page/{n}.jsonA région’s communes, 50 to a page
/api/provinces/{code}.jsonOne province or préfecture
/api/provinces/{code}/cercles.jsonA province’s cercles
/api/provinces/{code}/communes/page/{n}.jsonA province’s communes, 50 to a page
/api/cercles/{code}.jsonOne cercle
/api/cercles/{code}/communes/page/{n}.jsonA cercle’s communes, 50 to a page
/api/communes/page/{n}.jsonEvery commune, 50 to a page
/api/communes/type/{type}/page/{n}.jsonUrban or rural communes, by page
/api/communes/{code}.jsonOne commune, by dotted code
/api/arrondissements.jsonEvery arrondissement
/api/arrondissements/{code}.jsonOne arrondissement
/api/communes/{code}/boundary.geojsonOne commune’s boundary, as a GeoJSON Feature
/api/communes/{code}/neighbours.jsonThe communes one borders, and how much boundary each shares
/api/communes/{code}/arrondissements.geojsonA city’s arrondissements, as a GeoJSON FeatureCollection
/api/arrondissements/{code}/boundary.geojsonOne arrondissement’s boundary
/api/provinces/{code}/boundary.geojsonA province’s outline, merged from its communes
/api/regions/{code}/boundary.geojsonA région’s outline, merged from its communes
/api/regions/indicators.jsonEvery région’s census figures, to compare them
/api/provinces/indicators.jsonEvery province’s census figures, to compare them
/api/regions/economy.jsonEvery région’s establishments, to compare them
/api/provinces/economy.jsonEvery province’s establishments, to compare them
/api/arrondissements/indicators.jsonEvery arrondissement’s census figures, the level the 6 cities are counted at
/api/arrondissements/economy.jsonEvery arrondissement’s establishments, the same way
/api/regions/housing.jsonEvery région’s urban housing stock, to compare them
/api/provinces/housing.jsonEvery province’s urban housing stock, to compare them
/api/tiles/{z}/{x}/{y}.jsonThe boundaries cut into tiles, which /api/communes/at reads

Errors

An error comes back as an RFC 9457 problem document, typed application/problem+json. Its type links to its entry below, and detail says what went wrong in words.

not-found 404
Resource not found. The identifier is well formed but names nothing, the page is past the last, or the path isn’t a route.
invalid-code 400
Malformed code or slug. The identifier can’t be read as a code or a slug.
invalid-query 400
Invalid query parameter. A parameter is missing, out of range, or can’t go with another one.
What one looks like
{
  "type": "https://<host>/docs/api/#not-found",
  "title": "Resource not found",
  "status": 404,
  "detail": "no unit has code 99.999",
  "instance": "/api/communes/99.999"
}