Import Map Style Endpoint
const url = 'https://example.com/maps/import';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"version":1,"name":"example","metadata":{},"center":[1],"zoom":1,"bearing":1,"pitch":1,"sources":{},"sprite":[{"id":"example","url":"example"}],"glyphs":"example","terrain":{},"layers":[{}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/maps/import \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "version": 1, "name": "example", "metadata": {}, "center": [ 1 ], "zoom": 1, "bearing": 1, "pitch": 1, "sources": {}, "sprite": [ { "id": "example", "url": "example" } ], "glyphs": "example", "terrain": {}, "layers": [ {} ] }'Import a MapLibre style JSON document into a new GeoLens map.
The request body is a typed Pydantic model rather than a bare dict. MapStyleImportRequest mirrors the MapLibre style
spec top-level keys with extra="allow", so existing payloads keep
working byte-identically while the OpenAPI schema gains a named class
and the auto-generated SDKs stop emitting an opaque Mapping[str, Any]
request type.
Authorizations
Section titled “ Authorizations ”Request Body required
Section titled “ Request Body required ”Typed request body for POST /maps/import.
Mirrors the top-level keys of the MapLibre Style Specification that
parse_maplibre_style_import actually reads. extra="allow" keeps
forward-compatibility with future MapLibre fields (e.g. projection,
light, transition) so adding a new key on the client side
doesn’t require a server release.
Replacing the previous bare-dict body parameter removes
additionalProperties: true from the OpenAPI schema and lets
openapi-python-client generate a navigable named model class.
object
One entry of the MapLibre array-form sprite ({id, url}).
object
object
Example generated
{ "version": 1, "name": "example", "metadata": {}, "center": [ 1 ], "zoom": 1, "bearing": 1, "pitch": 1, "sources": {}, "sprite": [ { "id": "example", "url": "example" } ], "glyphs": "example", "terrain": {}, "layers": [ {} ]}Responses
Section titled “ Responses ”Successful Response
object
object
object
Basemap label prominence.
Road and transit sublayer visibility where supported.
Administrative boundary sublayer visibility where supported.
Whether supported building/3D building basemap layers are shown.
Land and water color treatment where supported.
Master basemap opacity 0.0-1.0
object
Per-sublayer style override for a single basemap sublayer.
All fields are nullable — a None value means “use the basemap default”.
Only #RRGGBB hex strings are accepted for color fields; None means
the basemap default color is preserved. Numeric ranges are clamped at
validation time (Pydantic ge/le constraints).
The key set of BasemapConfig.sublayer_overrides is treated as opaque
(forward-compatible with future sublayer IDs).
Security: extra=“forbid” locks the scope guardrail: unknown style axes such as dash patterns, line caps, halo blur, and text-font are rejected at validation time.
object
Whether the basemap renders below (‘bottom’, default) or above (‘top’) data layers.
Map projection. ‘mercator’ (default) or experimental ‘globe’.
object
object
object
object
Per-layer popup configuration: enable/disable + custom title template
- ordered visible-fields allowlist. Persisted as JSONB on map_layers.
object
object
Warnings produced beyond the reported list
Example
{ "map": { "basemap_config": { "label_mode": "full", "road_visibility": "full", "boundary_visibility": "full", "building_visibility": true, "land_water_tone": "default", "relief_contrast": "soft", "opacity": 1, "basemap_position": "bottom", "projection": "mercator" }, "terrain_config": { "enabled": false, "exaggeration": 1 }, "visibility": "private", "layers": [ { "layer_type": "vector_geolens", "show_in_legend": true } ] }, "summary": { "sources_matched": 0, "sources_unsupported": 0, "layers_imported": 0, "layers_skipped": 0, "warnings_truncated": 0 }}Bad request — invalid payload
Unauthorized — missing or invalid credentials
Forbidden — caller lacks write access
Not found
Conflict — resource state prevents the operation
Validation error
Too many requests — retry after the advertised interval
Headers
Section titled “ Headers ”Seconds until the request may be retried
Internal server error
Service unavailable — the database could not serve the request