Developer documentation
For developers and technical users. Last updated 27 October 2026.
Overview
Canvx is a map you write on. Each account holds marks: points, textboxes, lines, areas, boxes, circles and freehand strokes. Each mark carries a note, sources, a category, layers, and links to other marks. Everything a person can see in the app is in the data and comes back out through the API and the exports.
- Stack: a browser app (React, MapLibre GL) and an API (Node.js, Fastify) on PostgreSQL 16 with PostGIS, hosted in the United States.
- Coordinates: WGS84 (EPSG:4326) everywhere, in GeoJSON order
[longitude, latitude]. Lengths and areas are measured on the ellipsoid, in metres and square metres, never in degrees. - Ways in: the web app (a signed-in browser), the REST API with an API token, and an MCP server that wraps the API for AI clients such as Claude Code and Claude Desktop.
Addresses
| Address | What it serves | Who gets in |
|---|---|---|
| This site's address | The web app and the API | Your Canvx account (cookie), or an API token |
http://localhost:8788 | A local copy of the API | Cookie or token |
The web app calls the API under /api, which the server strips, so /api/features and /features are the same route. Examples here leave out the prefix and use two shell variables:
export AV=https://canvx.com/api # the API, for scripts and agents
export TOKEN=canvx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # from Settings → Automation
Authentication and tokens
API tokens (scripts and AI clients)
- Make one in the app: Settings → Automation → Agent tokens, name it (the name is shown on every mark it proposes), Create, Copy. It is shown once.
- A token is
canvx_followed by 32 random characters (tokens made before November 2026 startadauctus_and keep working). Only its Argon2id hash is stored, with the time it was last used. Revoke it on the same screen. - Tokens made before 8 November 2026 start with
avision_, and setups using the olderAVISION_TOKENandAVISION_API_URLnames keep working; nothing needs changing. - Send it on every request:
Authorization: Bearer canvx_….
A token can read and propose, nothing else. On the Free plan it can read only: proposing marks (POST /features, the MCP propose_mark tool) needs Pro or Enterprise, and is refused with a 403 on Free. It can make any GET a signed-in person can (marks, links, layers, categories, the notepad, exports) and POST /features (propose a mark). Every other write answers 403: editing, deleting, approving, linking, the AI console, analysis, imported imagery and token management. The server enforces this, not the MCP server, so it holds for any client.
Browser sessions
The web app signs in with POST /auth/login and keeps a session cookie (fn_session: HttpOnly, SameSite=Lax, Secure, 30 days). New accounts on the live site also confirm their email and use two-step sign-in: the login answers {"twoFactor": {"challenge", "method", "to"}}, and POST /auth/login/code with the emailed code completes it. Sessions are for people. Use a token in scripts.
Data model
Marks
The fields GET /features returns for each mark:
| Field | Type | Meaning |
|---|---|---|
id | uuid | |
title | string, ≤ 300 | Also the name other notes link to. |
body | string | The note: plain text, up to 50,000 characters (20,000 from a token). [[Title]] links to another mark; [[Title|label]] also labels the connector. |
color | slot | The category: one of 12 slots, pink red orange yellow green blue purple white teal magenta lime slate. Each account names and colours its own (GET /colors). |
draw_mode | enum | point line area freehand rectangle circle. A textbox is a point with icon text; a box is a rectangle. |
icon, size | enum, number | pin dot star flag triangle square diamond cross text; size 0.6 to 2.4 (1 is the default). |
show_label, priority | boolean | Title shown on the map; priority marks pulse. |
expires_at | ISO time or null | Past it the mark is "expired" (kept, or deleted if the account chose that). |
end_marker, line_style | enum | Lines: none arrow arrow-both; solid dashed dotted. |
fill_style, fill_opacity | enum, number | Areas: solid striped dotted crosshatch. |
geojson | GeoJSON geometry | Point, LineString, Polygon or their Multi forms. A circle is a 64-sided polygon. |
lon, lat | number | The centroid, computed by PostGIS. |
length_m, area_m2 | number | Measured on the ellipsoid. |
group_ids | uuid[] | The layers the mark is on (any number of the account's four). |
collection_id | uuid or null | Its set, if any. |
sources | array | {url, title, siteName, excerpt}; the server reads each page once to fill these in. |
source, agent_name | user or agent | Who made it; for an agent, the token's name. A request cannot set either. |
approved | boolean | False for a pending agent proposal. |
external_id | string or null | An agent's own key for the mark (see Creating marks). |
created_at, updated_at | ISO time |
Links
Links join two marks of the same account and point one way, from src to dst, with an optional label. They come from two places (origin):
body: a[[Title]]in the source mark's note, matched to a mark by exact title. A title that matches nothing waits and links once a mark with that title exists.manual: drawn in the app.
Links only join approved marks, and [[links]] in an agent's note stay inert until a person approves the mark.
Categories, layers, sets and the notepad
- Categories are the 12 colour slots, each with a label, a hex colour and a position.
- Layers are four named groups per account. A mark can be on several.
- Sets (collections) are optional folders.
- The notepad has a general page (slot
"") and one page per category slot.
REST API
JSON in and out. An error is {"error": "what went wrong and what to do"} with one of these statuses:
| Status | Means |
|---|---|
| 400 | Invalid input; the message says which field. |
| 401 | No session, or the token is wrong or revoked. |
| 403 | Not allowed for this caller: a token on a write it may not make, or a new account that has not finished setting up. |
| 404 | Not found. Another account's ids are also "not found". |
| 409 | The mark limit: {"code": "limit", "used", "limit"}. |
| 413 / 429 / 503 | Request over 3 MB / too many requests / database or service unavailable; retry later. |
Routes a token can use
| Route | Parameters | Returns |
|---|---|---|
GET /features | bbox=w,s,e,n, collection=uuid, limit (1 to 5,000, default 2,000) | {features: Mark[], capped}, last edited first. Includes pending proposals. |
GET /features/:id | The mark, with links and backlinks: {id, title, color, style, label, origin}. | |
GET /features/index | Every mark, short form: {id, title, color, icon, draw_mode, source, approved, lon, lat, created_at}, oldest first. | |
GET /search | q (2+ characters) | Up to 20 marks whose title matches (closest first), then marks whose note holds the text (in_note: true). |
GET /features/near | lat, lon, km (up to 5,000) | Up to 100 approved marks, nearest first, with distance_km to the nearest edge. |
GET /features/within | bbox=w,s,e,n or polygon=[[lon,lat],…] (3 to 1,000 corners, URL-encoded JSON) | Up to 100 approved marks touching the area. |
GET /links | {src_id, dst_id, style, label, origin, src_lon, src_lat, dst_lon, dst_lat, src_color}. | |
GET /colors | {slot: {label, hex, pos}} for all 12 slots. | |
GET /groups | The four layers: {id, name, count}. | |
GET /collections | {id, name, description, color, visibility, updated_at, feature_count}. | |
GET /notes | The notepad: {"": "…", "red": "…"}. | |
GET /export | format=geojson|kml|gpx, collection, groups=uuid,uuid | A file download; see Exporting data. |
POST /features | JSON body | 201 and the new mark; see Creating marks. |
GET /health | {"ok": true}; no token needed. |
/features/near and /features/within return a lighter mark shape built for questions like "what do I know near here": the note (first 2,000 characters), source URLs, the extent (west south east north), area_km2, length_km, and a line's start_lon/lat and end_lon/lat.
# What do I have within 500 km of the Strait of Hormuz?
curl -s "$AV/features/near?lat=26.57&lon=56.25&km=500" -H "Authorization: Bearer $TOKEN"
# Everything in a box over Taiwan, then the whole map as GeoJSON
curl -s "$AV/features/within?bbox=119.3,21.8,122.1,25.4" -H "Authorization: Bearer $TOKEN"
curl -s "$AV/export?format=geojson" -H "Authorization: Bearer $TOKEN" -o map.geojson
Routes for signed-in browsers only
Editing and deleting marks (PATCH/DELETE /features/:id), approving (POST /features/:id/approve), bulk actions, links (PUT/DELETE /features/:id/links/:dst), categories, layers, sets, the notepad, POST /analysis, the AI console (/assistant), imported imagery (/imagery), tokens (/tokens) and account settings. A token gets 403 on every one of them.
Creating marks
POST /features with a GeoJSON geometry and the fields you want; everything else takes its default.
| Field | Rules |
|---|---|
geometry (required) | GeoJSON Point, LineString, Polygon or their Multi forms, [lon, lat], up to 50,000 vertices. A latitude past ±90 is refused as "coordinates may be reversed". Longitudes past ±180 are accepted for a shape that crosses the 180° line, and it is stored the short way round. |
title, body | ≤ 300 characters; the note, cut at 20,000 characters from a token. |
color | A slot name; default pink. |
drawMode, icon, size | As in the data model. Send drawMode to match the geometry (line for a LineString, area, rectangle or circle for a Polygon) so the editor treats it as that shape. |
endMarker, lineStyle, fillStyle | As in the data model. An unknown value is ignored rather than refused. |
sources | Up to 20 http(s) URLs; anything else is dropped. |
externalId | Your stable key for the thing (an article URL, a database id), up to 300 characters. Sending the same key again updates that mark's content and shape instead of adding a duplicate, and never changes whether it is approved. |
collectionId | A set of this account; otherwise unfiled. |
curl -s -X POST "$AV/features" -H "Authorization: Bearer $TOKEN" -H "content-type: application/json" -d '{
"title": "Port of Kaohsiung",
"body": "Taiwan'\''s largest container port. Ships chips to [[Port of Long Beach|containers]].",
"geometry": { "type": "Point", "coordinates": [120.28, 22.61] },
"color": "blue",
"sources": ["https://www.twport.com.tw/"],
"externalId": "port-kaohsiung"
}'
From a token the mark arrives pending (approved: false): drawn faintly, badged automated, and waiting in the mark list's Agent marks filter for a person to approve it. An account can choose Settings → Automation → Add automatically to skip the review. Pending marks do not count toward the limit; approved ones do (409 when it is full).
AI clients (MCP)
The Canvx MCP server lets any Model Context Protocol client read your map and propose marks. It is a small Node.js program in packages/mcp of the source. It speaks MCP over stdio to the client, calls the REST API with your token, and so can do exactly what a token can: read, and propose.
Build it
Node.js 20 or later. From the repository root:
npm install
npm run mcp:build # writes packages/mcp/build/index.js
It reads two environment variables:
| Variable | Value |
|---|---|
CANVX_TOKEN | Required. An API token (Authentication). |
CANVX_API_URL | The agent address, or http://localhost:8788 (the default) for a local API. |
Tools
| Tool | Does |
|---|---|
list_categories | The account's categories, by label, in its order. |
search_marks | Marks by title or note text, so the client can avoid duplicates. |
marks_near | Approved marks within radiusKm of a point, nearest first, with notes and sources. |
marks_in_area | Approved marks inside a bbox or polygon. |
propose_mark | A pending mark with a note: a point (lat/lon, or degrees and decimal minutes as latDmm/lonDmm), a circle (plus radiusKm), a box (bbox), an area (polygon) or a line (line, with arrows and lineStyle). Takes category, sources and externalId. It refuses a mark with no position and tells the model to ask rather than guess. |
Every tool reports a mark's kind. Shapes come back with their extent and areaKm2, a circle with its centre and radiusKm, and a line with its ends and lengthKm.
Claude Code
Add the server with claude mcp add. Options go before the name; everything after -- is the command that starts the server:
claude mcp add --scope user \
--env CANVX_TOKEN=canvx_xxxxxxxx \
--env CANVX_API_URL=https://canvx.com/api \
--transport stdio canvx -- node /path/to/canvx/packages/mcp/build/index.js
In Windows PowerShell, lines continue with a backtick:
claude mcp add --scope user `
--env CANVX_TOKEN=canvx_xxxxxxxx `
--env CANVX_API_URL=https://canvx.com/api `
--transport stdio canvx -- node C:\path\to\canvx\packages\mcp\build\index.js
--scope usermakes it available in every project. Leave it out to add it to the current project only.- Keep
--transport stdio(or another option) between the last--envand the name, or the name is read as another variable.
Check it with claude mcp list (it should say Connected), or /mcp inside Claude Code. Then ask in plain words: "What do I have near the Strait of Hormuz?", or "Propose marks for the three largest container ports in Taiwan." Proposals wait in the app for your approval.
To share the setup with a team without sharing a token, put it in the project's .mcp.json and let each person set their own variables:
{
"mcpServers": {
"canvx": {
"type": "stdio",
"command": "node",
"args": ["${CLAUDE_PROJECT_DIR:-.}/packages/mcp/build/index.js"],
"env": {
"CANVX_TOKEN": "${CANVX_TOKEN}",
"CANVX_API_URL": "${CANVX_API_URL:-http://localhost:8788}"
}
}
}
}
Claude Code asks each person to approve a project's servers the first time. Its MCP documentation covers scopes and the other options.
Claude Desktop
Edit claude_desktop_config.json (Windows: %APPDATA%\Claude\; macOS: ~/Library/Application Support/Claude/), then restart Claude Desktop:
{
"mcpServers": {
"canvx": {
"command": "node",
"args": ["C:\\path\\to\\canvx\\packages\\mcp\\build\\index.js"],
"env": { "CANVX_TOKEN": "canvx_…", "CANVX_API_URL": "https://canvx.com/api" }
}
}
}
Other clients and testing
Any client that starts stdio MCP servers can run node packages/mcp/build/index.js with the two variables. The MCP Inspector calls the tools from a terminal:
npx -y @modelcontextprotocol/inspector --cli node packages/mcp/build/index.js \
-e CANVX_TOKEN=canvx_… -e CANVX_API_URL=$AV \
--method tools/call --tool-name search_marks --tool-arg query=port
--method tools/list lists the five tools; leave out --cli for the browser version.
There is no hosted connector you add by URL yet, so each client runs the server on its own computer.
Loading a dataset without an AI client
The same code path reads a JSON file (format: samples/rare-earth-chokepoint.json). Each entry takes the same fields as propose_mark. Running it again updates the same marks.
CANVX_TOKEN=canvx_… CANVX_API_URL=$AV npm run ingest -- samples/rare-earth-chokepoint.json
Exporting data
In the app: Export → Export data in the top bar. From the API: GET /export?format=…, optionally narrowed to a set (collection) or to marks on any of some layers (groups). Only approved marks are exported.
| Format | What you get |
|---|---|
| GeoJSON | An RFC 7946 FeatureCollection (WGS84, no crs member). Each feature has the mark's id, its geometry and properties: title, body, color, drawMode, lengthMeters, areaSquareMeters, collection, sources, createdAt, updatedAt. |
| KML | One Placemark per mark for Google Earth, with a style per category colour and the note and sources as plain, escaped text in the description. |
| GPX | Points as waypoints (with the first 500 characters of the note), lines as tracks, and areas as a track around their outline. For GPS units and route tools. |
The files open in QGIS, Google Earth, ArcGIS Online, Felt, geojson.io, Mapbox Studio and other GIS tools, with notes, colours and sources kept. The app's Export data section also saves screenshots (PNG) and AI-written reports in one standard layout (PDF; Word and Markdown on Pro).
Sample files
The same three marks (a pin with a note and a source, a line, and an area) exported in each format, exactly as Canvx writes them. Download one to try it in your own tools, or open an excerpt.
GeoJSON: the pin
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"id": "6f1c2c1e-6b0e-4b3a-9d55-1a2b3c4d5e01",
"geometry": {
"type": "Point",
"coordinates": [
4.1427,
51.9496
]
},
"properties": {
"title": "Port of Rotterdam",
"body": "Europe's largest seaport. Most container traffic uses the Maasvlakte terminals at the river mouth.",
"color": "blue",
"drawMode": "point",
"lengthMeters": null,
"areaSquareMeters": null,
"collection": "Sample map",
"sources": [
"https://www.portofrotterdam.com/en"
],
"createdAt": "2026-11-26T18:00:00.000Z",
"updatedAt": "2026-11-26T18:00:00.000Z"
}
}
]
}
The file's other two features are the line (LineString, with lengthMeters) and the area (Polygon, with areaSquareMeters).
KML: the pin and its style
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>Sample map</name>
<Style id="fn-blue">
<IconStyle><color>ffd98c1a</color><scale>1.1</scale></IconStyle>
<LineStyle><color>ffd98c1a</color><width>3</width></LineStyle>
<PolyStyle><color>66d98c1a</color></PolyStyle>
</Style>
<Placemark id="6f1c2c1e-6b0e-4b3a-9d55-1a2b3c4d5e01">
<name>Port of Rotterdam</name>
<description>Europe's largest seaport. Most container traffic uses the Maasvlakte terminals at the river mouth.
Sources:
Port of Rotterdam Authority: https://www.portofrotterdam.com/en</description>
<styleUrl>#fn-blue</styleUrl>
<TimeStamp><when>2026-11-26T18:00:00.000Z</when></TimeStamp>
<Point><coordinates>4.1427,51.9496,0</coordinates></Point>
</Placemark>
</Document>
</kml>
The full file has a style for every colour, and a Placemark each for the line and the area.
GPX: the pin as a waypoint, the line as a track
<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.1" creator="Canvx" xmlns="http://www.topografix.com/GPX/1/1" xmlns:osmand="https://osmand.net">
<metadata><name>Sample map</name><time>2026-11-27T00:32:13.874Z</time></metadata>
<wpt lat="51.9496" lon="4.1427"><time>2026-11-26T18:00:00.000Z</time>
<name>Port of Rotterdam</name>
<desc>Europe's largest seaport. Most container traffic uses the Maasvlakte terminals at the river mouth.</desc>
<link href="https://www.portofrotterdam.com/en"><text>Port of Rotterdam Authority</text>
</link><extensions><osmand:color>#1a8cd9</osmand:color></extensions></wpt>
<trk><name>Rotterdam to Antwerp</name>
<desc>The inland shipping route between the two ports.</desc><extensions>
<osmand:color>#1a8cd9</osmand:color></extensions><trkseg><trkpt lat="51.9496" lon="4.1427">
</trkpt><trkpt lat="51.6889" lon="4.2896"></trkpt><trkpt lat="51.4428" lon="4.2377"></trkpt>
<trkpt lat="51.2602" lon="4.3997"></trkpt></trkseg></trk>
</gpx>
The area follows as a second track, around its outline.
Sharing and embedding
Share in the top bar copies the approved marks in view into a public page: their titles, notes, sources, links and colours, frozen as they are. Later edits stay private until the owner presses Update, which keeps the same link; Delete ends it.
| Address | What it is |
|---|---|
https://maps.canvx.com/<slug> | The shared map: an interactive, read-only page with each mark's note and sources. Link previews read its Open Graph tags. |
…/<slug>/embed | The same map for an <iframe>: a slim title bar, "Made with Canvx", and two-finger or Ctrl-scroll zoom so it never hijacks the host page's scrolling. |
…/<slug>/card.jpg | The 1200 × 630 card image (og:image, twitter:card summary_large_image). |
https://maps.canvx.com/oembed?url=… | oEmbed: a rich response with the iframe, for sites that turn links into embeds by themselves. Takes maxwidth and maxheight. |
The embed code the app copies:
<iframe src="https://maps.canvx.com/<slug>/embed" width="640" height="420"
style="border:0;border-radius:12px" loading="lazy" allowfullscreen
title="Your map (Canvx)"></iframe>
On X a share appears as a large image card, and the link opens the live page: X runs interactive maps inside posts only for players it has approved. Slugs are 10 random characters. Shared pages carry noindex, so they stay out of search results while link previews still work.
Spatial analysis
POST /analysis (signed-in browsers; it is a POST, so tokens cannot call it) powers reports, briefings and the AI console. One implementation feeds all three, so they always agree. Body: {"ids"?: uuid[] (up to 2,000; all marks if absent), "weight"?: "none"|"links"|"priority", "radiusKm"?: number, "attribute"?: "links"|"priority"}.
It returns:
- mean, median and weighted centres with a 95% radius;
- the standard distance and the deviational ellipse;
- the Clark-Evans nearest-neighbour index with its confidence;
- DBSCAN clusters with Monte Carlo confidence;
- density peaks and Getis-Ord Gi* hot spots;
- Voronoi zones;
- containment and exposure;
- network measures: links in and out, influence and impact following the arrows, betweenness, closeness and single points of failure;
- countries from the Natural Earth 1:50m borders (computed offline);
- an overall data-quality level.
Each finding states its confidence, and notes say when a test does not apply.
Limits
| What | Limit |
|---|---|
| Marks per account | 500 approved on Free, 2,500 on Pro; pending proposals and the example map do not count |
| Note | 50,000 characters (20,000 from a token); title 300 |
| Sources per mark | 20 |
| Vertices per shape | 50,000 |
| Request body | 3 MB |
/features/near, /features/within | 100 results; radius up to 5,000 km; polygons up to 1,000 corners |
| Requests | 600 a minute per IP address, with lower limits on sign-in and AI routes |
Security model
- Per account. Every query is scoped to the caller's account; another account's ids answer 404.
- Tokens are hashed with Argon2id, looked up by a short prefix, limited to reading and proposing, and revocable. A proposal's provenance comes from the token, never from the request.
- Proposals wait for a person by default, and their
[[links]]stay inert until approved. Source links must behttp(s). - The agent address answers only requests with a token: no site, no cookies, no sign-in.
- The browser app runs under a strict Content-Security-Policy, with HTTPS-only, HttpOnly session cookies; passwords are Argon2id hashes.
- The AI console treats map text and web pages as material, never instructions. Its changes wait for Apply by default, and nothing is deleted without a person pressing Delete.