Map Image Generator API

Generate map images based on route data

Endpoint: POST /generate-map

This endpoint generates a map image based on the provided route data.

API Key

Add the header x-api-key with your API key in each request:

"x-api-key: YOUR_API_KEY"
Query Parameters

filename (optional) - Specify a custom filename for the generated map image

Examples:

/generate-map?filename=my-custom-map-name
/generate-map?filename=my-custom-map-name.png

If not provided, a unique filename will be generated automatically using UUID.

Request Body

Send an array of objects representing the points on the route:

[
    {
        "name": "Skagen",
        "latitude": 57.7209,
        "longitude": 10.5839
    },
    {
        "name": "Southampton",
        "latitude": 50.9138,
        "longitude": -1.47053
    }
]
Responses
200 OK

The PNG image is returned as a binary response.

Headers:

Content-Type: image/png
400 Bad Request

Returned if the input data is invalid.

Body:

{
    "error": "Invalid input data"
}
403 Forbidden

Returned if the API key is missing or incorrect.

Body:

{
    "error": "Forbidden: Invalid API key"
}
500 Internal Server Error

Returned if there was an error generating the map.

Body:

{
    "error": "Failed to generate map"
}