hexplace data for your site or app

Town data for Portugal, soon Spain and more: a JSON API without a key, widgets to embed, and plain pages for AI tools. Free, also for commercial use, with a credit and a link to hexplace.

The API

JSON over plain GET requests. No key and no sign-up; any site may call it from the browser. Every answer carries its licence and the credit to show.

AddressWhat it returns
/api/v1/Countries, their release dates and the endpoints
/api/v1/portugal/townsEvery town with its key values (climate, costs, access) and links
/api/v1/portugal/towns/taviraOne town: climate by month, best months, housing, amenities, hazards, who it suits
/api/v1/portugal/towns/tavira/months/08One town in one month (01 to 12)
/api/v1/portugal/rankingsThe rankings
/api/v1/portugal/rankings/warmest-wintersOne ranking, top 100
/api/v1/portugal/where/08The warmest towns in a month
/api/v1/openapi.jsonThis API as an OpenAPI 3.1 description, for client generators and AI tools

Data is rebuilt every week. Please cache answers for an hour or more and keep to a few requests a second.

Example

const res = await fetch("https://hexplace.org/api/v1/portugal/towns/tavira");
const data = await res.json();
console.log(data.summary);
// show the credit the licence asks for:
document.querySelector("#credit").innerHTML = data.attribution.credit_html;

Every value names its dataset and precision in the town's full measures (data.json, also as CSV).

Every town of Portugal in one file: portugal/towns.csv. The columns after the town's own are the API's measure ids; an empty cell means the town has no value precise enough to publish.

Widgets

A town card, a climate chart or a ranking, kept up to date. Pick one in the embed builder and paste the code.

<iframe src="https://hexplace.org/embed/portugal/tavira/card/" width="340" height="300"
  style="border:0;max-width:100%" loading="lazy" title="Tavira by hexplace"></iframe>
<p><a href="https://hexplace.org/portugal/tavira/">Tavira in numbers</a> by hexplace</p>

Editors that read oEmbed (Ghost, Notion and others) show the widget when you paste a town or ranking link. The endpoint is https://hexplace.org/oembed?url=….

Ranking badges

A town in the top 25 of a ranking, or the top 10 of its region, has a badge for its website: an image linked to the ranking, showing the current rank.

Town halls, tourist offices, hotels and estate agents can show where their town ranks. Each town's badges and their code are on its badges page, for example /portugal/tavira/badges/.

For AI tools

Every town page has a plain Markdown twin with its facts, sources and how to cite it.

Licence and credit

The data is published under CC BY 4.0: use it freely, also commercially, as long as you credit hexplace with a link to the page the data comes from, for example Data: hexplace (https://hexplace.org/portugal/tavira/). Values from OpenStreetMap stay under the ODbL. Each dataset and its licence is listed in the methodology.