> For the complete documentation index, see [llms.txt](https://help.felt.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.felt.com/developers/javascript-sdk.md).

# JavaScript SDK

Embed Felt maps in your web application with the JavaScript SDK. Use code to control layers, filters, the viewport, and clicks.

{% hint style="success" %}
Available with the Platform add-on. [Compare plans](https://felt.com/pricing#compare)
{% endhint %}

Embed a Felt map with the JavaScript SDK to control it from your application. Set the view, show or filter layers, respond to feature clicks, and add data at runtime. The [SDK reference](https://developers.felt.com/js-sdk-api-reference/) lists every method and event.

{% embed url="<https://www.youtube.com/watch?v=bHHPsuK3xO8>" %}

## What you can do with the JavaScript SDK

`Felt.embed` returns a controller for the embedded map. With it, your application can:

* Set and read the viewport, and zoom to features or areas.
* Show, hide, filter, and restyle layers and layer groups.
* Read features and their attributes, with the option to limit results to features in view.
* Listen for events, such as clicks on the map, changes to the selection, or changes to the viewport.
* Switch drawing tools and react when someone draws a shape.
* Add temporary layers from GeoJSON, whether from a URL, a file, or data in the page.
* Add buttons, panels, and other UI inside the map.

Layers the SDK adds from GeoJSON are temporary. They load in the browser showing the map and aren't saved to the map. To add data that stays on the map, upload it in Felt or with the [REST API](/developers/rest-api.md).

The JavaScript SDK also powers [custom extensions](/developers/extensions.md), which run on the Felt map itself. Felt AI can write them for you.

## Embed a map with the JavaScript SDK

The [getting started guide](https://developers.felt.com/js-sdk/getting-started) has the code for each step.

1. Install the SDK from npm with `npm install @feltmaps/js-sdk`.
2. In Felt, open the map in edit mode. In the toolbar, click **Developer Platform** > **Copy map ID**.
3. In your application, call `Felt.embed` with the element that should hold the map and the map ID. The map loads, and `Felt.embed` returns a controller.
4. Use the controller's methods and events to connect the map to the rest of your page.

A map with public link access loads for anyone. For a private map, add an embed token. See [Authenticated embeds](/developers/authenticated-embeds.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.felt.com/developers/javascript-sdk.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
