For the complete documentation index, see llms.txt. This page is also available as Markdown.

Working with annotations

Note: Annotations were previously referred to as Elements.

References have been updated in the app and documentation, while REST API endpoint and JS SDK method naming remain unchanged.

Annotations sit on top of all data layers on a map. They are usually drawn in the Felt app, but can also be created and updated via the API.

Combining annotations with webhooks is a great way to create interactive data apps in Felt: when someone draws or edits an annotation in the Felt app, your webhook hears about it. Annotations created through the API don't trigger webhooks.

Listing all annotations on a map

Annotations are returned as a GeoJSON Feature Collection.

# Your API token and map ID should look like this:
# FELT_API_TOKEN="felt_pat_ABCDEFUDQPAGGNBmX40YNhkCRvvLI3f8/BCwD/g8"
# MAP_ID="CjU1CMJPTAGofjOK3ICf1D"
FELT_API_TOKEN="<YOUR_API_TOKEN>"
MAP_ID="<YOUR_MAP_ID>"

curl \
  -H "Authorization: Bearer ${FELT_API_TOKEN}" \
  "https://felt.com/api/v2/maps/${MAP_ID}/elements"
import requests

# Your API token and map ID should look like this:
# api_token = "felt_pat_ABCDEFUDQPAGGNBmX40YNhkCRvvLI3f8/BCwD/g8"
api_token = "<YOUR_API_TOKEN>"
map_id = "<YOUR_MAP_ID>"

r = requests.get(
  f"https://felt.com/api/v2/maps/{map_id}/elements",
  headers={"Authorization": f"Bearer {api_token}"}
)
assert r.ok
print(r.json())

Listing all annotation groups

Returns a list of GeoJSON Feature Collections, one for each annotation group.

Create or update annotations

Each annotation is represented by a feature in the POSTed GeoJSON Feature Collection.

For each feature, including an existing annotation ID (felt:id) will result in the annotation being updated on the map. If the ID is omitted or does not match an existing annotation, a new annotation is created.

Styling is controlled with felt:-prefixed properties on each feature — for example felt:color, felt:opacity, felt:strokeWidth, felt:strokeStyle, felt:size, and felt:text for text annotations. Properties without the felt: prefix are stored as the annotation's data attributes. Request bodies are limited to 1 MB, and very complex geometries may be simplified on import.

Delete an annotation

Delete an annotation by its ID. Annotation IDs are returned as the felt:id property when listing annotations.

Last updated

Was this helpful?