Patch Map Layers Endpoint
const url = 'https://example.com/maps/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/layers';const options = { method: 'PATCH', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"added":[{"dataset_id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","display_name":"example","filter":["example"],"label_config":{},"layer_type":"example","layout":{},"opacity":1,"paint":{},"popup_config":{"enabled":true,"expression":"example","visible_fields":["example"]},"show_in_legend":true,"sort_order":0,"style_config":{},"visible":true}],"fallback_full_replace":false,"order":["2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"],"removed":["2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"],"updated":[{"display_name":"example","filter":["example"],"id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","label_config":{},"layer_type":"example","layout":{},"opacity":1,"paint":{},"popup_config":{"enabled":true,"expression":"example","visible_fields":["example"]},"show_in_legend":true,"sort_order":1,"style_config":{},"visible":true}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://example.com/maps/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/layers \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "added": [ { "dataset_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "display_name": "example", "filter": [ "example" ], "label_config": {}, "layer_type": "example", "layout": {}, "opacity": 1, "paint": {}, "popup_config": { "enabled": true, "expression": "example", "visible_fields": [ "example" ] }, "show_in_legend": true, "sort_order": 0, "style_config": {}, "visible": true } ], "fallback_full_replace": false, "order": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ], "removed": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ], "updated": [ { "display_name": "example", "filter": [ "example" ], "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "label_config": {}, "layer_type": "example", "layout": {}, "opacity": 1, "paint": {}, "popup_config": { "enabled": true, "expression": "example", "visible_fields": [ "example" ] }, "show_in_legend": true, "sort_order": 1, "style_config": {}, "visible": true } ] }'Apply incremental layer additions, patches, removals, and ordering.
v13.14 fixup: declared on both slash variants directly (mirrors the
Phase 280 fix on POST). FastAPI’s default redirect_slashes builds a
relative Location header that resolves against the request’s Host
header, which would leak the in-container api:8000 hostname
through Vite’s dev proxy on a 307 redirect. The canonical
(OpenAPI-published) form is the no-slash sub-collection convention
documented in the GeoLens API guide (https://docs.getgeolens.com/guides/api/);
the trailing-slash form is a hidden alias.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”Request Body required
Section titled “Request Body required ”object
Layers to append (max 200)
object
Layer opacity 0.0-1.0
Per-layer popup configuration: enable/disable + custom title template
- ordered visible-fields allowlist. Persisted as JSONB on map_layers.
object
Whether to include in the map legend
Draw order (lower draws first)
Client hint only; PATCH never performs full replacement
object
Per-layer popup configuration: enable/disable + custom title template
- ordered visible-fields allowlist. Persisted as JSONB on map_layers.
object
Responses
Section titled “ Responses ”Successful Response
object
object
Whether the basemap renders below (‘bottom’, default) or above (‘top’) data layers.
Administrative boundary sublayer visibility where supported.
Whether supported building/3D building basemap layers are shown.
Basemap label prominence.
Land and water color treatment where supported.
Master basemap opacity 0.0-1.0
Map projection. ‘mercator’ (default) or experimental ‘globe’.
Road and transit sublayer visibility where supported.
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) — see CONTEXT.md D-01.
Security: extra=“forbid” locks the D-14 scope guardrail: unknown style axes such as dash patterns, line caps, halo blur, and text-font are rejected at validation time (T-1059A-03).
object
object
object
object
object
Per-layer popup configuration: enable/disable + custom title template
- ordered visible-fields allowlist. Persisted as JSONB on map_layers.
object
Example
{ "basemap_config": { "basemap_position": "bottom", "boundary_visibility": "full", "building_visibility": true, "label_mode": "full", "land_water_tone": "default", "opacity": 1, "projection": "mercator", "relief_contrast": "soft", "road_visibility": "full" }, "layers": [ { "layer_type": "vector_geolens", "show_in_legend": true } ], "terrain_config": { "enabled": false, "exaggeration": 1 }, "visibility": "private"}Bad request — invalid payload
object
Example
{ "type": "about:blank"}Unauthorized — missing or invalid credentials
object
Example
{ "type": "about:blank"}Forbidden — caller lacks write access
object
Example
{ "type": "about:blank"}Not found
object
Example
{ "type": "about:blank"}Conflict — resource state prevents the operation
object
Example
{ "type": "about:blank"}Validation error
object
Example
{ "type": "about:blank"}Internal server error
object
Example
{ "type": "about:blank"}