Loading account...

StyleJSON Endpoint

Use the Mappinest StyleJSON endpoint to load available map styles in MapLibre GL JS, Mapbox GL JS, OpenLayers, or Leaflet.

What StyleJSON is

StyleJSON is the style document used by map clients such as MapLibre GL JS, Mapbox GL JS, and OpenLayers. It defines sources, layers, colors, labels, sprites, and glyph handling through one URL.

In Mappinest, StyleJSON is exposed for a map ID such as light or streets. That gives you a stable Maps API URL you can pass directly into supported web map clients.

Use StyleJSON for available map styles. For uploaded tilesets, use TileJSON instead.

StyleJSON endpoint

GET
https://api.mappinest.com/v1/maps/{mapId}/style.json?key=YOUR_KEY

Replace mapId with one of the supported map IDs from Available map styles. The same endpoint pattern works for streets, light, dark, and satellite.

Retrieve StyleJSON
curl "https://api.mappinest.com/v1/maps/light/style.json?key=YOUR_MAPPINEST_KEY"

What metadata it returns

FieldDescription
version
Style specification version returned by the document.
name
Human-readable style name exposed to the map 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 map clients use StyleJSON

Many vector map clients can load StyleJSON directly through the map style option. The map client reads the document first and then resolves the referenced sources, sprites, glyphs, and layer rules automatically.

MapLibre GL JS / Mapbox GL JS using the light style
const apiKey = 'YOUR_MAPPINEST_KEY';

const map = new maplibregl.Map({
  container: 'map',
  style: `https://api.mappinest.com/v1/maps/light/style.json?key=${apiKey}`,
  center: [15, 45],
  zoom: 5
});

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.

Light map style document excerpt
const lightStyle = {
    "version": 8,
    "name": "Mappinest Light (OMT 3.15)",
    "sources": {
        "planet": {
            "type": "vector",
            "url": `https://api.mappinest.com/v1/tiles/planet_20250911.json?key=${YOUR_MAPPINEST_KEY}`,
            "attribution": "© <a href='https://www.mappinest.com/copyright' target='_blank'>Mappinest</a>, © <a href='https://www.openstreetmap.org/copyright'>OpenStreetMap</a>"
        }
    },
    "sprite": `https://api.mappinest.com/v1/maps/light/sprite?key=${YOUR_MAPPINEST_KEY}`,
    "glyphs": "https://api.mappinest.com/v1/fonts/{fontstack}/{range}.pbf",
    "layers": [
        {
            "id": "background",
            "type": "background",
            "paint": {
                "background-color": [
                    "interpolate",
                    ["linear"],
                    ["zoom"],
                    9,"hsl(220, 3%, 99%)",
                    11,"hsl(220, 1%, 97%)"
                ]
            }
        },
        {
            "id": "park",
            "type": "fill",
            "source": "planet",
            "source-layer": "park",
            "filter": [
                "==",
                "$type",
                "Polygon"
            ],
            "layout": {
                "visibility": "visible"
            },
            "paint": {
                "fill-color": "#ededed",
                "fill-opacity": [
                    "interpolate",
                    ["linear"],
                    ["zoom"],
                    5, 0,
                    6,0.6,
                    12,0.2
                ]
            }
        },
        ...
     ]
};

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.

Maps API errors

Errors return JSON with error.code and error.message.

Error codeHTTP statusDescription
API_KEY_REQUIRED
401
Send the API key through ?key=YOUR_KEY.
API_KEY_FORBIDDEN / ACCESS_FORBIDDEN
403
Check the API key and its permissions.
API_KEY_ORIGIN_FORBIDDEN
403
Check allowed domains and the request Origin.
MAPS_READ_SCOPE_REQUIRED
403
Use a key with maps:read.
INVALID_API_KEY_POLICY
403
Use a key with valid scope settings.
INVALID_REQUEST / MAP_ID_REQUIRED
400
Check the map ID and request parameters.
RESOURCE_NOT_FOUND
404
Check the map ID and asset path against available map styles.
METHOD_NOT_ALLOWED
405
Use GET, HEAD, or OPTIONS.
MAPS_API_MOVED
410
Use the /v1/maps URL in the top-level replacement field.
UNSUPPORTED_MEDIA_TYPE
415
Use PNG for rendered map tiles.
RATE_LIMIT_EXCEEDED
429
Reduce concurrency and retry with backoff. Honor Retry-After when provided.
FREE_QUOTA_REACHED
429
Monthly quota exhausted. Enable PAYG or upgrade in Billing.
UNPAID_INVOICE_GRACE_EXPIRED
402
Pay the overdue invoice to resume serving.
AUTH_SERVICE_UNAVAILABLE
503
Authorization is temporarily unavailable. Retry later.

Last updated: November 7, 2026