Layer Uploads

APIs to upload data

With these APIs, you can upload your data to create new layers.

Upload map layer

post

Upload a file or import data from a URL to create a new layer on the map.

Check our Upload Anything docs to see what URLs are supported.

The /upload endpoint can be used for both URL and file uploads:

  • For URL uploads, simply making a single POST request to the upload endpoint is enough

  • For file uploads, the response of the initial POST request will include a target URL and some pre-signed attributes, which will be used to upload the new file to Amazon S3.

Uploading the file to Amazon S3

Uploading a file is a single function call using the felt-python library.

Layer files aren't uploaded directly to the Felt API. Instead, they are uploaded by your client directly to an S3 bucket.

You will receive a single set of URL and pre-signed params to upload the file. Only a single file may be uploaded — if you wish to upload several files at once, consider wrapping them in a zip file.

To upload the file using the pre-signed params, you must perform a multipart upload, and include the file contents in the file field.

# Requires requests library to be installed with: pip install requests
import requests

# Your API token should look like this:
# api_token = "felt_pat_ABCDEFUDQPAGGNBmX40YNhkCRvvLI3f8/BCwD/g8"
api_token = "<YOUR_API_TOKEN>"
map_id = "<YOUR_MAP_ID>"
path_to_file = "<YOUR_FILE_WITH_EXTENSION>" # Example: features.geojson

# Request  a pre-signed URL from Felt
layer_response = requests.post(
    f"https://felt.com/api/v2/maps/{map_id}/upload",
    headers={
        "authorization": f"Bearer {api_token}",
        "content-type": "application/json",
    },
    json={"name": "My new layer"},
)
presigned_upload = layer_response.json()
url = presigned_upload["data"]["attributes"]["url"]
presigned_attributes = presigned_upload["data"]["attributes"]["presigned_attributes"]
# A 204 response indicates that the upload was successful
with open(path_to_file, "rb") as file_obj:
    output = requests.post(
        url,
        # Order is important, file should come at the end
        files={**presigned_attributes, "file": file_obj},
    )
from felt_python import upload_file

upload_file(map_id, file_name="features.geojson", layer_name="My new layer")
Authorizations
Path parameters
map_idstringRequired

The ID of the map to upload the layer to.

Body
import_urlstringOptional

A public URL containing geodata to import, in place of uploading a file.

latnumberOptional

(Image uploads only) The latitude of the image center.

lngnumberOptional

(Image uploads only) The longitude of the image center.

namestringRequired

The display name for the new layer.

zoomnumberOptional

(Image uploads only) The zoom level of the image.

Responses
200

Upload layer response

application/json
post
POST /api/v2/maps/{map_id}/upload HTTP/1.1
Host: felt.com
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 311

{
  "hints": [
    {
      "attributes": {
        "lat": "text",
        "lng": "text"
      }
    }
  ],
  "import_url": "text",
  "lat": 1,
  "lng": 1,
  "metadata": {
    "attribution_text": "text",
    "attribution_url": "text",
    "description": "text",
    "license": "text",
    "source_abbreviation": "text",
    "source_name": "text",
    "source_url": "text",
    "updated_at": "2025-03-24"
  },
  "name": "text",
  "zoom": 1
}
{
  "layer_group_id": "luCHyMruTQ6ozGk3gPJfEB",
  "layer_id": "luCHyMruTQ6ozGk3gPJfEB",
  "presigned_attributes": {},
  "type": "upload_response",
  "url": "text"
}

Add layer from data source

post

Create a new layer from an existing data source connection (database, API, or file).

Authorizations
Path parameters
map_idstringRequired
Body
one ofOptional
or
or
Responses
202

AddSourceLayerAccepted

application/json
post
POST /api/v2/maps/{map_id}/add_source_layer HTTP/1.1
Host: felt.com
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 56

{
  "dataset_id": "luCHyMruTQ6ozGk3gPJfEB",
  "from": "dataset"
}
{
  "links": {
    "layer_group": "https://felt.com/api/v2/maps/V0dnOMOuTd9B9BOsL9C0UjmqC/layer_groups/KFFhKAbvS4anD3wxtwNEpD",
    "self": "https://felt.com/api/v2/maps/V0dnOMOuTd9B9BOsL9C0UjmqC"
  },
  "status": "accepted"
}

Refresh map layer

post

Trigger a data refresh for a layer from its original data source to pull in the latest updates.

Refreshing a file is a single function call using the felt-python library.

After uploading a file or URL, you may want to update the resulting layer with some new data. The process is quite similar to the above:

  • For URL uploads, simply making a single POST request to the refresh endpoint is enough

  • For file uploads, the response of the initial POST request will include a URL and some presigned attributes, which will be used to upload the new file to Amazon S3. See #uploading-the-file-to-amazon-s3 for more details.

from felt_python import (refresh_file_layer, refresh_url_layer)

refresh_file_layer(map_id, layer_id, file_name="features.geojson")
refresh_url_layer(map_id, layer_id)
Authorizations
Path parameters
map_idstringRequired

The ID of the map hosting the layer to refresh

layer_idstringRequired

The ID of the layer to refresh

Responses
200

Refresh response

application/json
post
POST /api/v2/maps/{map_id}/layers/{layer_id}/refresh HTTP/1.1
Host: felt.com
Authorization: Bearer YOUR_API_KEY
Accept: */*
{
  "layer_group_id": "luCHyMruTQ6ozGk3gPJfEB",
  "layer_id": "luCHyMruTQ6ozGk3gPJfEB",
  "presigned_attributes": {},
  "type": "upload_response",
  "url": "text"
}

Was this helpful?