Client libraries: JavaScript and Python
Official MapDove API clients for TypeScript/JavaScript and Python: typed helpers for places, markets, brands and site analyses, retries, plan-limit errors and streamed CSV exports.
MapDove has official clients for TypeScript/JavaScript (@mapdove/sdk, Node 18+, browsers, Deno and Bun) and
Python (mapdove, 3.9+, sync and asyncio), MIT-licensed. They wrap the REST API with typed helpers,
handle retries and turn errors into exceptions you can catch. Everything they return is the API’s JSON, as documented
in the API reference; visit figures are modeled estimates, not measurements.
Both authenticate with an organization API key (ms_live_…), created under Settings → API keys. API access is
included on Pro, Business and Enterprise; every request counts toward the plan’s monthly API calls (see
Plans and limits). Keep keys on a server, never in a public web page.
Install
The npm and PyPI packages (@mapdove/sdk, mapdove) are coming soon; this page will give the install commands once
they are published. Until then, install them from their public source at
github.com/mapdove/developers:
# Python: pip builds it from the repository
pip install "mapdove @ git+https://github.com/mapdove/developers#subdirectory=packages/sdk-python"
# TypeScript / JavaScript: build the package and install its tarball (Node 22+ and pnpm to build)
git clone https://github.com/mapdove/developers.git && cd developers
pnpm install --frozen-lockfile && pnpm --filter @mapdove/sdk build
cd packages/sdk-js && pnpm pack # then in your project: pnpm add /path/to/mapdove-sdk-0.1.0.tgz
Everything below works the same once the packages are published. Without them, the REST API works with any HTTP client: the libraries are a convenience, not a requirement. Building an AI agent? See Use MapDove with AI agents.
Quick start
TypeScript / JavaScript
import { MapDove } from '@mapdove/sdk';
const md = new MapDove({ apiKey: process.env.MAPDOVE_API_KEY! });
const { items } = await md.places.search({ city: 'austin', category: 'coffee', limit: 10 });
for (const p of items) console.log(p.name, p.visits, p.change_pct);
const overview = await md.market.overview('toronto-on', { from: '2026-09-01', to: '2026-09-30' });
const huff = await md.analyses.huff({ city: 'austin', category: 'coffee', lng: -97.7431, lat: 30.2672 });
Python
import os
from mapdove import MapDove
md = MapDove(api_key=os.environ["MAPDOVE_API_KEY"])
page = md.places.search("austin", category="coffee", limit=10)
overview = md.market.overview("toronto-on", from_="2026-09-01", to="2026-09-30")
huff = md.analyses.huff(city="austin", category="coffee", lng=-97.7431, lat=30.2672)
Python’s date argument is from_ (from is a keyword). The async client, AsyncMapDove, has the same methods, each
awaited.
Every place in a market
Both clients page through /places for you, 500 places per request (each page is one API call):
for await (const p of md.places.iterate({ city: 'austin', category: 'grocery' })) console.log(p.name);
for p in md.places.iterate("austin", category="grocery"):
print(p["name"])
Export a whole market
On paid plans a market downloads as one CSV (one export per call, whatever its size): places (every place with its
modeled visits over the range and the period before), hexes (the hexagon grid with its demographics) or
neighborhoods. The file is streamed, so a national market of ~170,000 places never sits in memory.
import { createWriteStream } from 'node:fs';
import { Readable } from 'node:stream';
import { pipeline } from 'node:stream/promises';
import { csvRows } from '@mapdove/sdk';
const res = await md.cities.exportCsv('austin', { dataset: 'places', from: '2026-09-01', to: '2026-09-30' });
await pipeline(Readable.fromWeb(res.body!), createWriteStream('austin-places.csv'));
for await (const row of csvRows(await md.cities.exportCsv('austin', { dataset: 'hexes' }))) console.log(row.population);
md.cities.export_to_file("austin", "austin-places.csv", dataset="places", from_="2026-09-01", to="2026-09-30")
for row in md.cities.export_rows("austin", dataset="hexes"):
print(row["population"])
GeoJSON and NDJSON. The same exports come as one GeoJSON FeatureCollection or as newline-delimited GeoJSON,
one feature per line, for markets too big to load as one document:
import { ndjsonFeatures } from '@mapdove/sdk';
for await (const f of ndjsonFeatures(await md.cities.exportNdjson('new-york-ny'))) console.log(f.properties.name);
for feature in md.cities.export_features("new-york-ny"): # streamed from NDJSON
print(feature["properties"]["name"])
md.cities.export_to_file("austin", "austin.geojson", format="geojson")
Scheduled exports. A scheduled export arrives by email, Slack or webhook as a signed link. Opened in a browser it
shows a confirm page; a script downloads the file at once with the link (or its token), and sends no API key: the
link authorizes itself. Each download counts one export; an expired link fails with 410 link_expired.
const res = await md.exports.download(linkFromWebhook); // streamed Response
md.exports.download_to_file(link_from_webhook, "export.csv")
Journeys, affinity and visitor origin
const j = await md.places.journeys(placeId); // where visitors go before and after
const a = await md.places.affinity(placeId); // brands they over-index on, with lift
const o = await md.places.visitorOrigin(placeId); // local, other markets, travellers
const b = await md.brands.affinity('starbucks', { city: 'austin' });
The Python client has the same methods (journeys, affinity, visitor_origin). All of them are modeled from
the same open data as visits, never from devices.
Errors and retries
| Error (JS / Python) | When |
|---|---|
AuthenticationError |
401 / 403: a missing or revoked key |
NotFoundError |
404 |
PlanLimitError |
402 plan_limit: not in the plan (exports on Free) or a monthly allowance used up |
RateLimitError |
429 rate_limited, with retryAfter / retry_after in seconds when given |
MapDoveError |
anything else; status 0 for network errors and timeouts |
Each error carries the HTTP status, the API’s error code, its message and the request id (quote it to support).
Reads (GET, and the idempotent PUT and DELETE) are retried up to three times on 429, 5xx and network errors,
honouring Retry-After, else with exponential backoff. Analyses (POST) are never retried, so one is never counted
twice, and plan limits are never retried. Both clients take maxRetries / max_retries and a timeout.
What’s covered
Every endpoint an API key can call: markets (cities, with exports as CSV, GeoJSON or NDJSON and visitor origin),
places (with journeys, affinity and visitor origin), market intelligence (market), brands, categories,
segments, the public trends, scheduled-export links (exports), the site analyses (analyses: suitability, Huff, catchments, compare sites, workforce, area, tenant
gaps), projects, favorites, alerts, the dataset’s provenance and the plans. For anything else, md.http.request(...)
(JavaScript) or md.request(...) (Python) calls any path with the same authentication and retries.
QGIS and ArcGIS connect to the OGC API – Features service directly, not through these libraries: see Connect QGIS and ArcGIS. AI assistants connect through the MCP server.
Versions
Both follow semantic versioning. The API is versioned in its path (/api/v1): additions arrive in minor releases of
the clients, and a breaking change to a helper only in a major release.