The Maps API is the core of BuzzTrip’s backend. Every collaborative map, its participants, and its analytics are managed through the functions documented here. Most operations require authentication — the only exception isDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/jacobsamo/buzztrip/llms.txt
Use this file to discover all available pages before exploring further.
trackMapView, which is a public mutation used for anonymous analytics collection.
All map IDs are Convex Id<'maps'> values. Authentication is enforced via authedQuery and authedMutation wrappers that inject a ctx.user object into the handler context.
getMap
Retrieves a single map document by its ID. Returnsnull if no map with the given ID exists.
API path: api.maps.index.getMapType:
authedQuery — authentication required
The Convex document ID of the map to retrieve.
null.
getMapUsers
Returns allmap_users records for a given map — i.e., everyone who has been granted access, along with their permission level.
API path: api.maps.index.getMapUsersType:
authedQuery — authentication required
The Convex document ID of the map.
map_users documents.
getUserMaps
Fetches all maps a user is associated with. It first queries themap_users join table by user_id, then enriches each record with the full map document — merging both objects into a UserMap shape.
API path: api.maps.index.getUserMapsType:
authedQuery — authentication required
The Convex document ID of the user whose maps should be listed.
UserMap[] — an array of merged map + map_user documents.
trackMapView
Records an anonymous map view event for analytics purposes. This is the only unauthenticated mutation in the Maps API — it useszodMutation rather than authedMutation, so it can be called from public map pages.
API path: api.maps.index.trackMapViewType:
zodMutation — no authentication required
The map being viewed.
Optional — the authenticated user’s ID, if available.
The viewer’s IP address.
Country derived from IP geolocation.
Region/state derived from IP geolocation.
City derived from IP geolocation.
Raw User-Agent header string.
Operating system parsed from User-Agent.
Browser parsed from User-Agent.
Device type parsed from User-Agent.
void
getMapViews
Retrieves all recorded view events for a specific map. Useful for building analytics dashboards. API path:api.maps.index.getMapViewsType:
authedQuery — authentication required
The map whose view records should be returned.
mapViews documents.
createMap
Creates a new map along with all required associated records. Internally callscreateMapFunction, which:
- Inserts the map document (uppercasing the first letter of the title; defaulting
mapTypeIdto"hybrid"). - Creates a
map_usersrecord for the authenticated caller withpermission: "owner". - Optionally creates
map_usersrecords for any additional users passed inusers. - Creates a default collection named
"Default Collection"for the map.
api.maps.index.createMapType:
authedMutation — authentication required
The map data to insert.
Optional list of additional users to invite at creation time. The authenticated user is always added as
"owner" automatically.Id<'maps'> — the document ID of the newly created map.
updateMap
Patches an existing map document with partial field updates. Iftitle is provided it is automatically uppercased. Always stamps updatedAt with the current ISO datetime.
API path: api.maps.index.updateMapType:
authedMutation — authentication required
The map to update.
Any subset of map fields to update. All fields are optional.
void
partialMapUpdate
Identical toupdateMap but skips the title uppercasing logic. Use this for programmatic or silent field updates (e.g. syncing map viewport bounds) where you want to preserve the exact string provided.
API path: api.maps.index.partialMapUpdateType:
authedMutation — authentication required
The map to update.
Any subset of map fields to update. All fields are optional. The value of
title is stored verbatim, without case transformation.void
deleteMap
Permanently deletes a map document. This does not cascade-delete related records (markers, collections, paths, etc.) — handle cascades separately if required. API path:api.maps.index.deleteMapType:
authedMutation — authentication required
The document ID of the map to delete.
void
duplicateMap
Creates a full deep copy of an existing map, including all of its markers, collections, collection links, paths, labels, routes, and route stops. The new map is owned by the authenticated user and prefixed with"Copy of ".
API path: api.maps.index.duplicateMapType:
authedMutation — authentication required
The document ID of the map to duplicate.
Id<'maps'> — the document ID of the newly created duplicate map.
Permission check: The caller must satisfy at least one of the following conditions to duplicate a map:
- They are the map owner (
owner_id === ctx.user._id). - They have an existing
map_usersrecord for that map (any permission level). - The map’s
visibilityis"public"— public maps can be duplicated by anyone.
"You don't have permission to duplicate this map".What gets copied:collections— new IDs assigned; old-to-new ID map is tracked.markers— new IDs assigned; old-to-new ID map is tracked.collection_links— re-linked using the new collection and marker IDs.paths— duplicated as-is with the newmapId.labels— duplicated as-is with the newmap_id.routes— new IDs assigned; old-to-new ID map is tracked.route_stops— re-linked using the new route and marker IDs.