---
title: "Get legend for a named map"
method: GET
path: "/v1/spatial/maps/{mapName}/legend"
tags: ["Mapping Service: Miscellaneous"]
---

# Get legend for a named map

`GET /v1/spatial/maps/{mapName}/legend`

## Request

- Base URL: `https://api.cloud.precisely.com`
- URL: `https://api.cloud.precisely.com/v1/spatial/maps/{mapName}/legend`
- Auth: API key in header `Authorization` and HTTP bearer

Returns the complete legend of a named map by specifying the named map, the swatch size, and mime type of the legends.
The legend is returned as single swatch rows, including a base 64 encoded image (or URL) and text description, that make up a complete legend. For each layer in the named map, zero, one, or more legend entries will be returned.

The named map should be specified in the URL path, and the request must include parameters for width, height, and imageType. Optional parameters include resolution, inlineSwatch, and ignoreLegendRowOverrideVisibility.

**Resource dependencies:** The named map's layers — and the named tables they reference — must already exist in the repository for the legend to be resolved and rendered.

**Authorization:** Requires EXECUTE permission on the named map.

## Path parameters

- `mapName` string, required

## Query parameters

- `width` integer, required
- `height` integer, required
- `imageType` 'png' | 'jpeg' | 'gif', required
- `resolution` integer
- `inlineSwatch` boolean
- `ignoreLegendRowOverrideVisibility` boolean

## Response `200`

Successfully retrieved legend for the named map

- MidevLegendResponse
  - `legends` MidevLegend[]
    - `type` string
    - `rows` MidevLegendRow[]
      - `description` string
      - `swatch` string
    - `title` string
    - `layerName` string

## Other responses

- `400`: Invalid request arguments
- `403`: Caller does not have EXECUTE permission on the named map
- `404`: No resource found at requested path
- `500`: Internal server error while processing the request or with downstream services

---

[API](https://skmtc.dev/precisely/apis/mapping-api.md) · [All operations](https://skmtc.dev/precisely/apis/mapping-api/llms.txt) · [OpenAPI document](https://skmtc.dev/precisely/apis/mapping-api/revisions/cea0ad9440c5?raw)
