Skip to main content

Configuration

You can configure the Docker Static Maps API through environment variables.

Supported Environment Variables

NameTypeDefaultDescription
PORTnumber3000Port number for the API
API_KEYstring(none)Optional key to restrict access
LOG_LEVELstringINFOLogging level (DEBUG, INFO, WARN, ERROR)
TILE_CACHE_TTLnumber3600Tile cache TTL in seconds
DISABLE_TILE_CACHEbooleanfalseSet to true to disable tile caching
RATE_LIMIT_MSnumber60000Rate limit window in milliseconds
RATE_LIMIT_MAXnumber60Max requests per IP per window

API Key Authentication

You can optionally restrict access to the API using an API key.

  • Set an API key using the API_KEY environment variable.
  • If no key is set, the API runs in keyless mode (anyone can access it).
  • Demo endpoints (/demo-map) are accessible either via a valid demo_auth=true cookie or a valid API key.
NameTypeDefaultDescription
API_KEYstring(none)Optional key to restrict access to the API

Passing the API Key

You can provide the API key in two ways:

1. Header

curl -H "x-api-key: your_api_key_here" \
"http://localhost:3000/api/staticmaps?width=600&height=600&center=40.7128,-74.006&zoom=12"

2. Query parameter

http://localhost:3000/api/staticmaps?width=600&height=600&center=40.7128,-74.006&zoom=12&API_KEY=your_api_key_here

✅ Both methods are supported for all endpoints, including demo maps.


Demo Page Access

  • Without an API key: Access http://localhost:3000 directly using a browser cookie demo_auth=true.
  • With API key: Pass the key using x-api-key header or api_key query parameter.

Example:

curl "http://localhost:3000/?api_key=your_api_key_here"