Programmatically manage your map data with our REST API
Use the REST API to programmatically manage your map data. All requests require authentication.
https://mapsemble.com/api/v1/layer/{LAYER_ID}/features
All API requests require OAuth 2 authentication. First, obtain an access token using your client credentials, then include it in the Authorization header.
POST to the token endpoint with your client credentials:
POST https://mapsemble.com/token
Request body (YAML format):
grant_type: client_credentials_with_user client_id: your_client_id client_secret: your_client_secret
Example curl request:
curl -X POST "https://mapsemble.com/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials_with_user&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET"
Response:
{
"token_type": "Bearer",
"expires_in": 3600,
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJS..."
}
Include the access token in the Authorization header:
Authorization: Bearer YOUR_ACCESS_TOKEN
Note: Generate your client_id and client_secret from your profile page. Tokens expire after 3600 seconds (1 hour).
curl -X GET "https://mapsemble.com/api/v1/layer/{LAYER_ID}/features" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Returns a GeoJSON FeatureCollection with all features.
Request body (YAML format):
features:
- type: Feature
geometry:
type: Point
coordinates:
- -73.985428 # longitude
- 40.748817 # latitude
properties:
title: My Location
description: Description here
Example curl request (JSON):
curl -X POST "https://mapsemble.com/api/v1/layer/{LAYER_ID}/features" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-d '{
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-73.985428, 40.748817]
},
"properties": {
"title": "My Location",
"description": "Description here"
}
}
]
}'
Create new features. Do not include an ID - it will be auto-generated. Maximum 1000 features per request.
Request body (YAML format):
features:
- id: feature-uuid-here
type: Feature
geometry:
type: Point
coordinates:
- -73.985428 # longitude
- 40.748817 # latitude
properties:
title: Updated Title
Example curl request (JSON):
curl -X PUT "https://mapsemble.com/api/v1/layer/{LAYER_ID}/features" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-d '{
"features": [
{
"id": "feature-uuid-here",
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-73.985428, 40.748817]
},
"properties": {
"title": "Updated Title"
}
}
]
}'
Update existing features. The feature ID is required. Use PATCH for partial updates.
Request body (YAML format):
features: - id: feature-uuid-to-delete
Example curl request (JSON):
curl -X DELETE "https://mapsemble.com/api/v1/layer/{LAYER_ID}/features" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-d '{
"features": [
{
"id": "feature-uuid-to-delete"
}
]
}'
Delete features by ID. The feature ID is required.
Successful operations return a JSON response with success and/or failed arrays indicating the status of each feature operation.
{
"success": [
{ "id": "uuid", "message": "Feature successfully created." }
],
"failed": [
{ "id": "uuid", "path": "field", "message": "Error message" }
]
}