Migrate from Radar to Mapricot

This guide moves an app's Radar API calls to Mapricot: geocoding, search, routing, and maps. It lists the Mapricot endpoint for each Radar API, how each parameter and response field carries over, and what has no equivalent. To weigh up the switch first, see Mapricot vs Radar.

Mapricot's API isn't compatible with Radar's, so each call changes. Coordinates keep Radar's latitude-first order, but latitude and longitude become lat and lon. Route times change the most: Radar gives them in minutes, and distances in feet unless you ask for metric, where Mapricot always uses seconds and meters.

Migrate with a coding agent

Paste this prompt into Claude Code, Cursor, Codex, or another coding agent, in your project. It finds your Radar calls, plans the switch with you, and makes it.

Prompt
Migrate this project's geocoding, search, routing, and maps from Radar to Mapricot, a location API. https://mapricot.com/guides/migrate-from-radar/ maps each Radar endpoint, parameter, and response field to Mapricot's, and https://mapricot.com/llms.txt lists Mapricot's docs.

1. Find every use of Radar's geocoding, search, routing, and maps in this project: requests to api.radar.io, calls in the Radar SDKs, and Radar Maps. Leave geofencing, trip tracking, and fraud detection alone. List each with what it does and the Mapricot endpoint that replaces it, and tell me about any that Mapricot can't replace. Wait for my OK before changing code.
2. Use Mapricot's client for this project's language if the docs list one; otherwise use plain HTTP. For server code, ask me to create a server key at https://app.mapricot.com/ and put it in MAPRICOT_KEY, wherever this project keeps secrets. Don't ask me to paste it here. Web pages need a browser key: create one with the create_key tool if you have Mapricot's MCP server, or ask me to.
3. Replace each call as the guide shows. Radar gives route durations in minutes and distances in feet by default, and Mapricot gives seconds and meters. Mapricot rejects unknown parameters with a 400, so drop Radar parameters that have no equivalent.
4. Move Radar Maps to MapLibre GL JS with Mapricot's map tiles, as https://mapricot.com/docs/map-tiles/ shows.
5. Credit the data wherever the project shows Mapricot's results, as https://mapricot.com/docs/attribution/ explains.
6. Run the tests, and make one real request to each endpoint you changed. Then tell me what changed, what's left, and which Radar features the project still uses.

The rest of this guide is what the agent works from, and what to check its changes against.

Endpoints

Radar Mapricot
GET /v1/geocode/forward GET /geocoding/v1/search
GET /v1/geocode/reverse GET /geocoding/v1/reverse
GET /v1/search/autocomplete GET /geocoding/v1/autocomplete
GET /v1/search/places GET /places/v1/nearby
GET /v1/route/directions POST /routing/v1/route
GET /v1/route/distance POST /routing/v1/route, reading the distance and duration
GET /v1/route/optimize POST /routing/v1/optimize
GET /v1/geocode/ip, for the caller GET /ip-geolocation/v1/{ip}, for any IP address
Radar Maps MapLibre GL JS with Mapricot's map tiles

Radar takes its key as the whole Authorization header, such as Authorization: prj_live_pk_…. Mapricot puts Bearer before the key: Authorization: Bearer mapricot_sk_…. Map styles take the key as ?key=. Radar's publishable keys work in apps and pages; Mapricot's equivalent is a browser key for pages, which works only from the origins you allow, and a server key for mobile apps.

Geocoding

Radar Mapricot
query q
country=US,CA country=us,ca, up to 10 codes
lang lang
Reverse: coordinates=40.7039,-73.9867 Reverse: lat=40.7039&lon=-73.9867
layers None. Filter on each result's type
Radar addresses[] Mapricot results[]
latitude, longitude lat, lon
formattedAddress label
addressLabel, or placeLabel for a place name
layer, such as address, place, or locality type, such as address, venue, or locality
number address.houseNumber
street address.street
city address.locality
state, stateCode address.region, address.regionCode
postalCode address.postalCode
country, countryCode address.country, address.countryCode
distance, on reverse distanceMeters
confidence: "exact" type: "address"; a broader match has another type
timeZone, countryFlag, county, borough, neighborhood None
meta.code The HTTP status

Autocomplete

Radar Mapricot
query q
near=lat,lng focus=lat,lon
countryCode country
limit, up to 100 limit, up to 20
layers, sessionToken None

Without near, Radar ranks results near the caller's IP address. Mapricot doesn't guess, so pass focus with the user's location, or a location from IP geolocation, to keep results local. Mapricot has no select endpoint to report the chosen result to. The address autocomplete guide builds a form on Mapricot's autocomplete.

Radar search/places Mapricot nearby
near=lat,lng lat, lon
radius, up to 10,000 meters radius, up to 50,000 meters
categories category, from Mapricot's categories
chains=starbucks None as a filter. Search by name, or filter nearby results on brand
limit, up to 100 limit, up to 20
iataCode, chainMetadata None

Results come nearest first in both. Radar's places[].name is name, location.coordinates, as [lng, lat], becomes lat and lon, chain.name becomes brand, and categories stays categories when you send category.

Routes

Radar takes the stops in the URL. Mapricot takes a JSON body:

Radar Mapricot
locations=lat,lng|lat,lng, up to 25 waypoints, 2 to 20 {"lat", "lon"} objects
mode=car "mode": "drive"
mode=bike "mode": "bicycle"
mode=foot "mode": "walk"
avoid=tolls,highways,ferries "costing": {"useTolls": 0, "useHighways": 0, "useFerry": 0}
avoid=borderCrossings "costing": {"countryCrossingPenalty": 3600}, or another penalty in seconds
geometry=polyline5 "geometries": "polyline", the default
geometry=polyline6 "geometries": "polyline6"
geometry=linestring "geometries": "geojson"
lang lang
units None: distances are always meters
mode=truck, departureTime, heading, alternatives None

Radar's avoid rules roads out where Mapricot's costing steers away from them, so a Mapricot route still takes a toll road when there's no other way. Mapricot returns turn-by-turn steps only when you send "steps": true.

Radar response Mapricot response
routes[].distance.value, in feet, or meters with units=metric routes[].distanceMeters
routes[].duration.value, in minutes routes[].durationSeconds, in seconds
distance.text, duration.text None: format them yourself
routes[].legs[].distance, .duration legs[].distanceMeters, .durationSeconds
legs[].geometry.polyline, per leg routes[].polyline, for the whole route
legs[].steps[].instructions legs[].steps[].instruction
steps[].start_location.latitude, .longitude steps[].lat, steps[].lon
steps[].banner_instructions, .voice_instructions, .maneuver None

Radar's distance endpoint takes an origin and a destination, and returns the distance and duration for each mode you list in modes. Send a Mapricot route with the two points as waypoints, once per mode.

Route optimization

Radar's optimize keeps the first location as the start and the last as the end, as Mapricot's does, and takes up to 10 locations where Mapricot takes 20. Where Radar returns each leg's startIndex and endIndex into your list, Mapricot returns waypointOrder, the indexes of your waypoints in visiting order. The route's distance and duration convert as for directions.

IP geocoding

Radar's IP geocode looks up the caller. Mapricot looks up any IP address you give it, so a server looks up its visitor's IP: GET /ip-geolocation/v1/{ip}. Radar's address.latitude and .longitude become location.lat and .lon, countryCode stays countryCode, state becomes regionName, and city stays city. Mapricot has no proxy flag.

Maps

Radar Maps uses MapLibre GL JS, so a map changes only its setup and style URL. Create the map with maplibregl.Map and style: "https://api.mapricot.com/tiles/v1/styles/default.json?key=mapricot_pk_…", or another of Mapricot's styles, in place of Radar's map setup. Markers and popups become MapLibre's own, which MapLibre markers and popups shows.

What has no equivalent

Keep these on Radar, or replace them with something else:

  • Geofencing, trip tracking, beacons, and fraud detection, which this guide leaves alone.
  • Address validation, the route matrix, and route matching.
  • Truck routing, departure times, and traffic.
  • Chain filters and chain metadata for place search.