Free Maps API for Websites, With Directions
Put a world map on your website at no charge, and add walk, bike, drive and transit directions free with a generous a monthly allowance.
Put a world map on your website at no charge, and add walk, bike, drive and transit directions free with a generous a monthly allowance.
Language models guess at distances and travel times. Give your AI agent a routing tool and a travel-time tool instead, with code for both.
CarpathianBot is the crawler behind Carpathian Search. What it fetches, the robots.txt rules it follows, how to block it, and how results are ranked.
Let your AI agent search the web: tool calling with a free web search API for LLMs, the agent loop, prompt injection defenses, and the limits to plan for.
Everywhere you can reach in 15 minutes, drawn as a shape. How isochrones are computed, what changes them, and how to put one on a map.
Carpathian Maps is a free maps API for websites. You embed a world map on your site, and the map files it loads are never billed. When you want directions or travel times, your backend asks the directions API, and those requests are free up to a monthly allowance and billed per 1,000 after it. Everything is served from Carpathian's own map server, built on OpenStreetMap data, so a map on your site doesn't hand your visitors' browsing to a third-party map provider.
You'll need a Carpathian account with a payment card on file, since the free allowance sits on a billing account. The rest of this piece covers how to embed the map, how directions work, how keys are protected, and what the API doesn't do.
The map and the directions are billed separately, which is what keeps the map free.
A spend cap on your organization pauses your keys when it's reached instead of letting usage run past it, and the Maps page shows this month's requests against the allowance as they happen.
The map is drawn in the browser with MapLibre GL JS, an open-source map library, using the Protomaps basemap style. Install both:
npm install maplibre-gl @protomaps/basemaps
Then point the map at Carpathian's map files:
import maplibregl from "maplibre-gl";
import "maplibre-gl/dist/maplibre-gl.css";
import { layers, namedFlavor } from "@protomaps/basemaps";
const base = "https://maps.carpathian.ai/map";
const map = new maplibregl.Map({
container: "map",
center: [-93.625, 41.5868],
zoom: 12,
style: {
version: 8,
glyphs: base + "/fonts/{fontstack}/{range}.pbf",
sprite: base + "/sprites/v4/light",
sources: {
protomaps: {
type: "vector",
url: base + "/tiles.json",
attribution:
'<a href="https://protomaps.com">Protomaps</a> © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
},
},
layers: layers("protomaps", namedFlavor("light"), { lang: "en" }),
},
});
For a dark map, use sprites/v4/dark and namedFlavor("dark"). Each tile is cached in the browser for a day, so a second visit draws from the cache instead of fetching the map again.
Before the map loads on your site, list your website on an app in Carpathian, such as . A browser on a website that isn't listed is refused, so another site can't embed your map and run up your usage. Add every address the map appears on, including a address if you develop locally.
https://www.example.comhttp://localhostKeep the OpenStreetMap credit visible. The data's license, the Open Database License, requires it, as the OpenStreetMap copyright page sets out, and the attribution line above shows it.
Directions come from your backend, never from the browser, because they need a key. Your visitor's browser asks your server, and your server asks Carpathian Maps:
async function route(origin, destination, mode) {
const res = await fetch("https://maps.carpathian.ai/v1/route", {
method: "POST",
headers: {
Authorization: "Bearer " + process.env.MAPS_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({ origin, destination, mode }),
});
const body = await res.json();
if (!res.ok) throw new Error(body.error);
return body.route;
}
mode is walk, bike, drive or transit. The answer has the time in seconds, the distance in meters, the path to draw and one step per instruction. To draw the path, swap each [lat, lng] pair to [lng, lat] and add it as a GeoJSON line on the map. The Connect guide has the full example.
The travel-time API, POST /v1/isochrone, returns the area someone can reach from a point in up to four travel times, as GeoJSON you can fill on the map. It's what you'd use for "stores within 15 minutes of you" or a delivery zone.
Each app gets its own key, starting cmk_. It's shown once, when you create the app, and Carpathian keeps only a hash of it.
429 with a time to retry, so a bug can't run up a bill.If you build turn-by-turn navigation on Carpathian Maps, that navigation contributes anonymous traffic data, with no account, device, start or destination. The usage policy and section 24 of the Terms of Service describe it, and your site's privacy notice should mention it.
There's no address search. Carpathian Maps turns coordinates into routes and areas, so if your visitors type addresses, you'll need a geocoder to turn them into latitude and longitude first.
Transit covers the DART bus system in the Des Moines metro. A transit request anywhere else answers that no route was found. Walk, bike and drive directions cover the areas in the coverage list on the documentation overview, while the map itself covers the whole planet.
The map's labels are in English, and the styles are the Protomaps basemap's own: light, dark, white, grayscale and black. You can restyle further in your own MapLibre code, but that style is then yours to maintain.
Create an account, enable Carpathian Maps from Services, and create an app with your website listed. Paste the map code above and it draws on the next page load. The Connect guide has the full example, and Give Your AI Agent a Maps API puts the same directions inside an AI assistant.