Skip to main content

API

The Carroted Maps API lets your own systems work with a group's map: read and write pins, routes and zones, and push live data. Every request acts as you, with your role in the group and your plan's limits, exactly as if you did it in the app.

To use your maps from Claude, ChatGPT or another AI assistant instead, see AI assistants: no key needed.


Get your API key​

Step 1: Open your Profile

Tap your profile icon on the home screen.

Step 2: Open API key

Under Preferences, tap API key.

Step 3: Turn it on

Tap Turn the key on, then copy it.

The key is off until you turn it on. From the same row you can make a new key (the old one stops working straight away) or turn the key off.

caution

Anything with your key can edit map items as you, in every group you're in. Keep it on a server, never in a web page or a shared file. What it creates counts toward your plan's limits.


Find a group's ID​

Calls take a groupId. Open the group in Carroted Maps on the web: the ID is the part of the address after /group/. A shared item link has it in the same place.


Making a request​

Every call is a POST to /v1/<call> on the API address, with the call's fields as a JSON body and your key in the Authorization header:

curl -X POST "$CARROTED_API/v1/getMapItems" \
-H "Authorization: Bearer $CARROTED_KEY" \
-H "Content-Type: application/json" \
-d '{"groupId": "YOUR_GROUP_ID"}'
API address

$CARROTED_API is the Carroted Maps API address: https://api.carroted.com

Answers are JSON. A call that worked returns {"success": true, "data": ...}. One that didn't returns {"success": false, "message": "...", "code": "..."} with an HTTP status to match:

StatusCodeMeaning
400BAD_REQUEST, INVALID_IDA field is missing or wrong; message says which
401UNAUTHORIZEDNo key, a wrong key, or no permission in this group
402UPGRADE_REQUIREDOver a plan limit
404NOT_FOUNDNo such call
429RATE_LIMITEDToo many requests in a minute with this key

Fields not listed for a call are refused, so send only the ones below.

All calls​

CallWhat it does
getUserGroupsYour groups
getUserOrgGroupsYour groups inside organizations
getMapItemsA group's pins, routes and zones
createMapItemAdds a pin, route or zone
updateMapItemChanges one
deleteMapItemDeletes one
getRouteA route along roads through some stops
pushFeaturesAdds or updates live data
deleteFeaturesRemoves live data
getLiveFeaturesA group's live data

Groups​

getUserGroups​

The groups you're in, outside organizations. Use it to find a groupId.

{}

Answer: a list of groups. Each has its _id (the groupId other calls take), name, your role (admin, member or viewer), memberCount and the lastMessage in its chat.

getUserOrgGroups​

The same for the groups inside your organizations.

{}

Answer: a list of groups, each with _id, name, icon, color and organizationId.


Map items​

Pins, routes and zones, the same ones people add in the app.

FieldWhat it is
typepin, route or area (a zone)
positionA pin's place: {"latitude": 51.5072, "longitude": -0.1276}
pathA route's or zone's points: a list of positions. A route needs at least 2, a zone at least 3
styleHow it looks: label (up to 100 characters), description (up to 500), color (#RRGGBB) and icon (one of the pin icons, by id)
alertOnEnter, alertOnExitZones only: alert the group when someone goes in or out. Alert zones count toward your plan's limit

getMapItems​

{ "groupId": "YOUR_GROUP_ID" }

Answer: the group's items, newest first, up to 500. Each has its _id, type, position or path, style and who made it.

createMapItem​

{
"groupId": "YOUR_GROUP_ID",
"type": "pin",
"position": { "latitude": 51.5072, "longitude": -0.1276 },
"style": { "label": "Gate 3", "color": "#E8590C", "icon": "flag", "description": "North entrance" }
}

A zone instead:

{
"groupId": "YOUR_GROUP_ID",
"type": "area",
"path": [
{ "latitude": 51.507, "longitude": -0.128 },
{ "latitude": 51.508, "longitude": -0.126 },
{ "latitude": 51.506, "longitude": -0.125 }
],
"style": { "label": "Car park", "color": "#2F80ED" },
"alertOnEnter": true
}

Answer: {"itemId": "..."}. You need to be a Member or Admin, and new items count toward the group's map item limit.

updateMapItem​

Send the item's id and only what changes: any of style, position (pins), path (routes and zones), alertOnEnter and alertOnExit (zones).

{
"id": "ITEM_ID",
"position": { "latitude": 51.5081, "longitude": -0.1281 },
"style": { "label": "Gate 3 (moved)" }
}

style is merged into the current one, so send only the parts that change. Answer: {"success": true}.

deleteMapItem​

{ "id": "ITEM_ID" }

Answer: {"success": true}. Deleting takes the item's creator or a group Admin, as in the app.

getRoute​

{
"stops": [
{ "latitude": 40.758, "longitude": -73.9855 },
{ "latitude": 40.7484, "longitude": -73.9857 }
],
"mode": "pedestrian"
}

A route along roads or paths through 2 to 20 stops in order. mode is car (the default), pedestrian or bicycle. Answer: {"success": true, "data": {"path": [...], "distanceMeters": 1240, "durationSeconds": 930}}. Nothing is saved: send the path to createMapItem as a route to put it on the map.


Live data​

pushFeatures​

Adds or updates features in a layer. Send each feature with its own id: a new id adds a feature, an id you sent before updates it.

{
"groupId": "YOUR_GROUP_ID",
"layer": "Vehicles",
"features": [
{
"id": "truck-12",
"lat": 51.5072,
"lng": -0.1276,
"icon": "tracker",
"color": "#2F80ED",
"details": [
{ "label": "Name", "value": "Truck 12" },
{ "label": "Driver", "value": "Sam" }
],
"metrics": [
{ "key": "speed", "value": 42, "unit": "km/h" },
{ "key": "fuel", "value": 68, "unit": "%" }
],
"ttlSeconds": 900
}
]
}
FieldRequiredWhat it is
idYesYour id for the feature, 1 to 100 characters, unique within the layer
lat, lngYesIts position
iconOne of the pin icons, by id
color#RRGGBB
detailslabel (up to 40 characters) and value (up to 200) texts. The first one's value is the feature's name on the map
metricsNumbers, each a key, a value and an optional unit
ttlSecondsHow long the feature stays after its last push. Leave it out to keep it until you delete it

The layer name is 1 to 60 characters. There's a cap on features per call and on details and metrics per feature; going over returns BAD_REQUEST with the number.

Answer: {"created": 1, "updated": 0, "skipped": 0}. A feature someone else pushed is skipped unless you're a group Admin. Only new features count toward the group's map item limit.

You need to be a Member or Admin of the group. Pushing also checks the group's alert zones.

deleteFeatures​

{ "groupId": "YOUR_GROUP_ID", "layer": "Vehicles", "ids": ["truck-12"] }

Leave out ids to delete the whole layer. Answer: {"deleted": 1, "skipped": 0}; as with pushing, other people's features are skipped unless you're an Admin.

getLiveFeatures​

{ "groupId": "YOUR_GROUP_ID" }

Answer: every feature in the group, every layer, each with its layer, featureId (your id), position, icon, color, details, metrics and updatedAt.


Good to know​

  • The API works with online groups. Radio groups live on your devices and the mesh, not on a server
  • Viewers can read but not write. Deleting an item takes its creator or a group Admin, as in the app
  • Items and features you add through the API show as added by you