Tileserver RS provides a REST API for accessing tiles and metadata.
GET /health
Returns OK if the server is running.
Response: 200 OK
All endpoints that return URLs support an optional ?key query parameter. When provided, the key is appended to all URLs in the response, enabling API gateway/proxy scenarios where authentication needs to be forwarded through subsequent requests.
Example:
GET /styles/osm-bright/style.json?key=my_api_key
All URLs in the response will include ?key=my_api_key:
{
"sources": {
"openmaptiles": {
"url": "http://localhost:8080/data/openmaptiles.json?key=my_api_key"
}
},
"glyphs": "http://localhost:8080/fonts/{fontstack}/{range}.pbf?key=my_api_key",
"sprite": "http://localhost:8080/styles/osm-bright/sprite?key=my_api_key"
}
Supported endpoints:
/data.json/data/{source}.json/index.json/styles.json/styles/{style}.json/styles/{style}/style.json/styles/{style}/wmts.xmlGET /data.json
Returns a list of all available tile sources with their TileJSON metadata.
Query Parameters:
| Name | Type | Description |
|---|---|---|
key | string | Optional API key to append to all tile URLs |
Response:
[
{
"tilejson": "3.0.0",
"name": "OpenMapTiles",
"tiles": ["http://localhost:8080/data/openmaptiles/{z}/{x}/{y}.pbf"],
"minzoom": 0,
"maxzoom": 14,
"bounds": [-180, -85.0511, 180, 85.0511],
"center": [0, 0, 2]
}
]
GET /data/{source}.json
Returns TileJSON metadata for a specific source.
Parameters:
| Name | Type | Description |
|---|---|---|
source | string | Source ID |
Query Parameters:
| Name | Type | Description |
|---|---|---|
key | string | Optional API key to append to tile URLs |
Response:
{
"tilejson": "3.0.0",
"name": "OpenMapTiles",
"tiles": ["http://localhost:8080/data/openmaptiles/{z}/{x}/{y}.pbf"],
"vector_layers": [...],
"minzoom": 0,
"maxzoom": 14,
"bounds": [-180, -85.0511, 180, 85.0511],
"center": [0, 0, 2]
}
GET /data/{source}/{z}/{x}/{y}.{format}
Returns a single tile from a source. Works with all source types (PMTiles, MBTiles, PostgreSQL).
Parameters:
| Name | Type | Description |
|---|---|---|
source | string | Source ID (from config) |
z | integer | Zoom level (0-22) |
x | integer | Tile X coordinate |
y | integer | Tile Y coordinate |
format | string | Tile format (pbf, png, jpg, webp) |
Examples:
# PMTiles source
GET /data/openmaptiles/14/8192/5461.pbf
# MBTiles source
GET /data/terrain/10/512/340.pbf
# PostgreSQL table source
GET /data/buildings/12/2048/1365.pbf
# PostgreSQL function source
GET /data/custom_tiles/14/8580/5737.pbf
Response Headers:
| Header | Description |
|---|---|
Content-Type | MIME type based on format |
Content-Encoding | gzip if tile is compressed |
Cache-Control | Caching headers |
Response Codes:
| Code | Description |
|---|---|
200 | Tile found and returned |
204 | Tile not found (empty response) |
400 | Invalid coordinates |
404 | Source not found |
GET /styles.json
Returns a list of all available map styles.
Query Parameters:
| Name | Type | Description |
|---|---|---|
key | string | Optional API key to append to style URLs |
Response:
[
{
"id": "protomaps-light",
"name": "Protomaps Light",
"url": "http://localhost:8080/styles/protomaps-light/style.json"
}
]
GET /styles/{style}/style.json
Returns the MapLibre/Mapbox GL style JSON for vector rendering.
Query Parameters:
| Name | Type | Description |
|---|---|---|
key | string | Optional API key to append to all URLs (sources, glyphs, sprites) |
GET /styles/{style}.json
Returns TileJSON metadata for raster tile rendering of a style.
Query Parameters:
| Name | Type | Description |
|---|---|---|
key | string | Optional API key to append to raster tile URLs |
Response:
{
"tilejson": "3.0.0",
"name": "Protomaps Light",
"tiles": ["http://localhost:8080/styles/protomaps-light/{z}/{x}/{y}.png"],
"minzoom": 0,
"maxzoom": 22
}
GET /styles/{style}/{z}/{x}/{y}[@{scale}x].{format}
Returns a rendered raster tile from a vector style.
Parameters:
| Name | Type | Description |
|---|---|---|
style | string | Style ID |
z | integer | Zoom level (0-22) |
x | integer | Tile X coordinate |
y | integer | Tile Y coordinate |
scale | integer | Optional scale factor (1-3, default: 1) |
format | string | Output format (png, jpeg, webp) |
Examples:
/styles/protomaps-light/14/8192/5461.png # 512x512 PNG @ 1x
/styles/protomaps-light/14/8192/5461@2x.png # 1024x1024 PNG @ 2x (retina)
/styles/protomaps-light/14/8192/5461.webp # 512x512 WebP
Performance:
GET /styles/{style}/static/{type}/{width}x{height}[@{scale}x].{format}
Returns a static map image centered on a location or bounding box.
Static Image Types:
{lon},{lat},{zoom}[@{bearing}[,{pitch}]]{minx},{miny},{maxx},{maxy}auto (requires ?path= or ?marker= query params)Query Parameters:
| Name | Description |
|---|---|
path | Path/polyline overlay (see format below) |
marker | Marker overlay (see format below) |
padding | Padding ratio for auto-fit (default: 0.1) |
maxzoom | Maximum zoom level for auto-fit |
Examples:
# Center-based
/styles/protomaps-light/static/-122.4,37.8,12/800x600.png
/styles/protomaps-light/static/-122.4,37.8,12@45,60/800x600@2x.webp
# Bounding box
/styles/protomaps-light/static/-123,37,-122,38/1024x768.jpeg
# Auto-fit with path
/styles/protomaps-light/static/auto/800x600.png?path=path-5+f00(-122.4,37.8|-122.5,37.9|-122.4,38.0)
# With markers
/styles/protomaps-light/static/-122.4,37.8,12/800x600.png?marker=pin-s+f00(-122.4,37.8)
Paths are specified as: path-{strokeWidth}+{strokeColor}({coordinates})
strokeWidth: Line width in pixels (default: 3)strokeColor: Hex color (3 or 6 digits, e.g., f00 or ff0000)coordinates: Pipe-separated lon,lat pairsMultiple paths can be separated by ~.
Example:
path-5+ff0000(-122.4,37.8|-122.5,37.9|-122.4,38.0)
Markers are specified as: pin-{size}-{label}+{color}({lon},{lat})
size: s (small), m (medium), or l (large)label: Optional single character labelcolor: Hex colorMultiple markers can be separated by ~.
Example:
pin-s+f00(-122.4,37.8)~pin-m-A+00f(-122.5,37.9)
GET /styles/{style}/sprite[@{scale}x].{format}
Returns sprite image or metadata for a style.
Parameters:
| Name | Type | Description |
|---|---|---|
style | string | Style ID |
scale | integer | Optional scale factor (2x, 3x for retina) |
format | string | png for image, json for metadata |
Examples:
/styles/protomaps-light/sprite.json # Sprite metadata
/styles/protomaps-light/sprite.png # Sprite image (1x)
/styles/protomaps-light/sprite@2x.json # Retina metadata
/styles/protomaps-light/sprite@2x.png # Retina image (2x)
GET /styles/{style}/wmts.xml
Returns OGC WMTS 1.0.0 GetCapabilities document for use with GIS software (QGIS, ArcGIS).
Query Parameters:
| Name | Type | Description |
|---|---|---|
key | string | Optional API key to append to all tile URLs in the capabilities document |
GET /fonts.json
Returns a list of all available font families.
Response:
["Noto Sans Regular", "Noto Sans Medium", "Open Sans Bold"]
GET /fonts/{fontstack}/{range}.pbf
Returns font glyphs in PBF format for text rendering.
Parameters:
| Name | Type | Description |
|---|---|---|
fontstack | string | Font name or comma-separated fallback stack |
range | string | Character range (e.g., 0-255, 256-511) |
Examples:
/fonts/Noto Sans Regular/0-255.pbf
/fonts/Noto Sans Bold,Arial Unicode MS Regular/256-511.pbf
Font Stack Fallback:
When a font stack is requested (comma-separated), the server tries each font in order and returns the first available match. This enables fallback behavior for missing glyphs.
GET /index.json
Returns a combined array of all TileJSONs (both data sources and raster styles).
Query Parameters:
| Name | Type | Description |
|---|---|---|
key | string | Optional API key to append to all tile URLs |
Response:
[
{
"tilejson": "3.0.0",
"id": "openmaptiles",
"name": "OpenMapTiles",
"tiles": ["http://localhost:8080/data/openmaptiles/{z}/{x}/{y}.pbf"],
...
},
{
"tilejson": "3.0.0",
"name": "Protomaps Light",
"tiles": ["http://localhost:8080/styles/protomaps-light/{z}/{x}/{y}.png"],
...
}
]
GET /data/{source}/{z}/{x}/{y}.geojson
Returns a vector tile converted to GeoJSON format. Useful for debugging and inspection.
Parameters:
| Name | Type | Description |
|---|---|---|
source | string | Source ID (must be a vector tile source) |
z | integer | Zoom level |
x | integer | Tile X coordinate |
y | integer | Tile Y coordinate |
Response:
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"name": "Example",
"_layer": "places"
},
"geometry": {
"type": "Point",
"coordinates": [1205, 1540]
}
}
]
}
GET /files/{filepath}
Serves static files from the configured files directory. Useful for serving GeoJSON overlays, custom icons, or other static assets.
Parameters:
| Name | Type | Description |
|---|---|---|
filepath | string | Path to the file relative to the files directory |
Examples:
/files/data.geojson
/files/icons/marker.png
/files/overlays/route.json
Security:
..) is blockedResponse Headers:
Content-Type: Determined by file extensionCache-Control: public, max-age=3600