StyleJSON Endpoint
Use the Mappinest StyleJSON endpoint to load ready-to-use vector map styles in MapLibre GL JS, Mapbox GL JS, or OpenLayers.
What StyleJSON is
StyleJSON is the style document used by web clients such as Mapbox GL JS, MapLibre GL JS, and OpenLayers. It defines sources, layers, colors, labels, sprites, and glyph handling through one URL.
In Mappinest, StyleJSON is exposed from a style ID such as light or streets. That gives you a stable style URL you can pass directly into supported web map clients.
Use StyleJSON for ready-to-use map styles. For uploaded datasets and tilesets, use TileJSON instead.
StyleJSON endpoint
Replace styleId with one of the supported IDs from Mappinest Styles. The same endpoint shape works for streets, light, dark, and satellite.
curl "https://api.mappinest.com/styles/light/style.json?key=YOUR_KEY"What metadata it returns
| Field | Description |
|---|---|
version | Style specification version returned by the document. |
name | Human-readable style name exposed to the client. |
sources | Source definitions used by the style, including the vector source consumed by the layers. |
sprite | Sprite base URL used for icons inside the style. |
glyphs | Font glyph template used by label layers. |
layers | Ordered layer array that defines rendering rules and visual appearance. |
metadata | Additional style metadata when it is provided by the style document. |
id | Style identifier carried by the document when it is available. |
How clients use StyleJSON
Many vector map clients can load StyleJSON directly through the map style option. The client reads the document first and then resolves the referenced sources, sprites, glyphs, and layer rules automatically.
const map = new maplibregl.Map({
container: 'map',
style: 'https://api.mappinest.com/styles/light/style.json?key=YOUR_KEY',
center: [15, 45],
zoom: 5
});When to use StyleJSON
- Use StyleJSON when your client can load a full style document from a URL.
- Use StyleJSON when you want labels, sprites, glyphs, and layer order to come preconfigured.
- Default to StyleJSON for basemap integrations unless the client explicitly requires raster image tiles.
Sample StyleJSON
The following example shows a shortened excerpt from the light style document. It uses the same structure as the StyleJSON endpoint, but keeps only representative fields from the full document.
{
"version": 8,
"name": "Mappinest Light",
"sources": {
"planet": {
"type": "vector"
}
},
"sprite": "/sprites/mappinest-light",
"layers": [
{
"id": "background",
"type": "background",
"paint": {
"background-color": [
"interpolate",
["linear"],
["zoom"],
9,
"hsl(220, 3%, 99%)",
11,
"hsl(220, 1%, 97%)"
]
}
},
{
"id": "water",
"type": "fill",
"source": "planet",
"source-layer": "water",
"paint": {
"fill-color": "#dbdbdc"
}
}
],
"id": "light"
}The source-layer names used inside these styles broadly follow the OpenMapTiles schema. That helps when you inspect layer names or compare Mappinest style behavior with other OpenMapTiles-based styles.
Last updated: March 13, 2026