---
title: "Get a map layer from a query"
method: GET
path: "/v3/maps/{connectionName}/query"
tags: ["Maps"]
---

# Get a map layer from a query

`GET /v3/maps/{connectionName}/query`

Returns metadata and URLs to fetch a map layer built from a SQL query.

Omit `format` to get the full response with a URL per available format.
Pass `format` to get that single format directly.

## Path parameters

- `connectionName` string, required

## Query parameters

- `q` string, required
- `queryParameters` string
- `spatialDataColumn` string
- `spatialDataType` 'geo' | 'h3' | 'h3int' | 'quadbin'
- `geo_column` string
- `columns` string
- `format` 'ndjson' | 'geojson' | 'json' | 'binary' | 'tilejson'
- `tileResolution` 0.25 | 0.5 | 1 | 2 | 4
- `aggregationExp` string
- `aggregationResLevel` integer
- `v` '3.0' | '3.1' | '3.2' | '3.3' | '3.4'

## Response `200`

Map layer metadata and download URLs.

- MapResponse — Metadata and download URLs for a map layer. Which format keys are present depends on the size of the source — large sources only offer `tilejson`.
  - `size` integer — Size of the source in bytes.
  - `nrows` integer — Number of rows in the source.
  - `ndjson` MapResponseItem
    - `url` string[]
    - `error` string
  - `geojson` MapResponseItem
    - `url` string[]
    - `error` string
  - `json` MapResponseItem
    - `url` string[]
    - `error` string
  - `binary` MapResponseItem
    - `url` string[]
    - `error` string
  - `tilejson` MapResponseItem
    - `url` string[]
    - `error` string
  - `schema` SchemaField[]
    - `name` string, required
    - `type` 'number' | 'bigint' | 'string' | 'geometry' | 'timestamp' | 'object' | 'boolean' | 'variant' | 'unknown' | 'array', required

## Other responses

- `400` — The request is malformed or a parameter failed validation.
- `401` — The token is missing, malformed or expired.
- `403` — The token doesn't grant access to this resource.
- `404` — The resource doesn't exist.
- `422` — The query can't be served for this connection — for example a Databricks connection with `spatialDataType=geo`.
- `429` — You went over the [rate limit](#rate-limits) for this API.

---

[API](https://skmtc.net/gitbookio/apis/carto-api.md) · [All operations](https://skmtc.net/gitbookio/apis/carto-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/gitbookio/carto-api/revisions/019f79ecdd6c/schema)
