Start here
Each path reaches the same capabilities, authentication model and usage limits. Pick the interface that matches what you are building.
Authenticated server request
Keep the subscription key in a server environment or secret manager. Your backend owns credentials; browsers and mobile clients receive only the data they are allowed to use.
Keep credentials on the server
This request returns current OpenStreetMap features. Convert the response to GeoJSON when the next step is an interactive map.
npm i mapsource- 01Read the key from server-side configuration.
- 02Send it only in the Bearer header.
- 03Handle non-2xx responses before reading data.
const response = await fetch("https://api.mapsource.io/interpreter", {
method: "POST",
headers: {
Authorization: "Bearer " + process.env.MAPSOURCE_API_KEY,
"Content-Type": "text/plain"
},
body: '[out:json][timeout:30];nwr["amenity"="cafe"](47.60,-122.34,47.62,-122.31);out geom 100;'
});
if (!response.ok) {
throw new Error("Mapsource request failed: " + response.status);
}
const data = await response.json();MapLibre GL JS integration
MapLibre owns the renderer and interaction model. Mapsource supplies tiles, compiled styles and the geospatial services around the map.
MapLibre requests a style and visible resources.
Allow-lists Mapsource paths and attaches the service key.
Returns tiles, glyphs and service responses.
import maplibregl from "maplibre-gl";
import "maplibre-gl/dist/maplibre-gl.css";
import { installMapsourceUI } from "https://mapsource.io/map-ui/v1/map-ui.mjs";
const mapsourceOrigin = "https://api.mapsource.io";
const map = new maplibregl.Map({
container: "map",
center: [-122.68, 45.52],
zoom: 11,
attributionControl: { compact: true },
style: `${mapsourceOrigin}/styles/mapsource/style.json`,
transformRequest: (url) => {
const request = new URL(url, window.location.href);
if (request.origin !== mapsourceOrigin) return { url };
// Your backend validates this path and adds the service key.
return { url: `/mapsource-proxy?path=${encodeURIComponent(
request.pathname + request.search
)}` };
}
});
const disposeMapUI = installMapsourceUI(map);
// On teardown: disposeMapUI(); map.remove();Add Mapsource services
Customize the basemap
Change roads, land, water, buildings, labels, fonts and POIs without authoring raw style JSON. Compiled styles include metadata["mapsource:ui"] for the shared attribution and label helper.
API capabilities
Compose operations behind the same API key. The generated reference remains the source for request shapes, limits and errors.
OpenStreetMap / Overpass queries
Query global roads, buildings, infrastructure, amenities, boundaries and other tagged map features with Overpass QL.
Raster & vector basemaps
Add maps with ready-to-use raster tiles or styleable OpenMapTiles vector tiles, discovered through the live basemap catalog.
Custom basemaps
Control road classes, labels, land use, fonts and visual styling. Generate from intent, save profiles and reuse revisions.
Routing
Calculate routes between locations with turn-by-turn directions, travel profiles and optional elevation.
Travel-time matrices
Calculate travel times and distances across multiple origins and destinations.
Isochrones
Map the area reachable within one or more travel-time limits, such as 15 or 30 minutes.
Map matching & snapping
Fit noisy GPS traces to the road network and snap individual coordinates to nearby roads.
Route optimization
Optimize the visit order for a set of stops and return the resulting route.
Address & business search
Find addresses, businesses and brands, autocomplete places, discover regional POIs and reverse geocode coordinates.
Terrain / elevation
Sample ground elevation, render Terrarium terrain tiles in 3D and generate elevation contours.
Spatial analysis
Buffer, measure, intersect, combine and simplify geometries on the server.
Compute pipelines & result handles
Run dependent search, navigation and analysis steps together, then pass or retrieve typed results without moving intermediate payloads.
Static map rendering
Render basemaps and geospatial overlays to images for reports, previews and sharing.
Developer resources
Use generated contracts instead of maintaining a second description of the service in your application or agent.
Client generation and request tooling.
AgentsMCP server cardHosted tool discovery and connection metadata.
Agentsllms.txtCompact machine-readable service guidance.
CodeExamples repositoryTypeScript, Python and a protected local map demo.
Preparing an agent integration?