- Home
- Docs
- API reference
- Static map image with a route and numbered stops
API reference
Static map image with a route and numbered stops
Renders a PNG (or WebP) map up to 1280x1280, at `scale=2` for retina screens and zooming, with base map tiles from OpenStreetMap, your paths and numbered markers, and "© OpenStreetMap contributors" drawn in the bottom-right corner (so the image meets the ODbL attribution requirement on its own). Without `center`/`zoom` the map fits every path vertex and marker inside the image minus `padding`. Paths and markers use Google Static Maps-like syntax: - `path=color:0x2563eb|weight:5|opacity:0.9|enc:<polyline>` (`enc:` must be last; add `precision:6` for `polyline6`), or `path=color:red|lat,lng|lat,lng|…` - `markers=numbered:1|lat,lng|lat,lng|…` labels the points 1, 2, 3 … - `markers=style:start|label:1|lat,lng`, `markers=style:end|label:15|lat,lng`, `markers=color:0x7c3aed|label:A|lat,lng`, `markers=style:dot|lat,lng` Keep GET URLs under 16 KB (use `overview=simplified` on `/v1/route`), or POST a JSON body for long paths. One `static_map` unit per image; images served from the server-side cache are billed the same, and errors are never billed.
Endpoint
https://api.wayline.cloud/v1/staticmapRequires an API key (authentication). Product overview: Static Maps API. Billing: see units & pricing.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
size | query | string | WIDTHxHEIGHT in CSS pixels, each 64 to 1280. Default 600x400. |
width | query | integer | |
height | query | integer | |
scale | query | integer | 2 doubles the pixel size (1280x800 at scale 2 is 2560x1600 px).One of: 1, 2Default: 1 |
format | query | string | jpg is ~5x smaller than png; best for app and web previews.One of: png, jpg, webpDefault: png |
padding | query | integer | Pixels kept clear around the fitted content.Default: 48 |
center | query | PointString | lat,lng; requires zoom. |
zoom | query | integer | 0 to 18; requires center. |
path | query | string[] | Repeatable (up to 10). |
markers | query | string[] | Repeatable; up to 100 markers in total. |
Example
curl "https://api.wayline.cloud/v1/staticmap?size=1280x800&scale=2&path=color%3A0x2563eb%7Cweight%3A5%7C23.7925,90.4078%7C23.7937,90.4066%7C23.7639,90.3889%7C23.7465,90.376&markers=numbered%3A1%7C23.7925,90.4078%7C23.7937,90.4066%7C23.7639,90.3889%7C23.7465,90.376" \
-H "Authorization: Bearer $WAYLINE_API_KEY"const res = await fetch(
"https://api.wayline.cloud/v1/staticmap?size=1280x800&scale=2&path=color%3A0x2563eb%7Cweight%3A5%7C23.7925,90.4078%7C23.7937,90.4066%7C23.7639,90.3889%7C23.7465,90.376&markers=numbered%3A1%7C23.7925,90.4078%7C23.7937,90.4066%7C23.7639,90.3889%7C23.7465,90.376",
{ headers: { Authorization: `Bearer ${process.env.WAYLINE_API_KEY}` } },
);
if (!res.ok) throw new Error(`Wayline ${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);import os, requests
res = requests.get(
"https://api.wayline.cloud/v1/staticmap",
params={"size": "1280x800", "scale": "2", "path": "color:0x2563eb|weight:5|23.7925,90.4078|23.7937,90.4066|23.7639,90.3889|23.7465,90.376", "markers": "numbered:1|23.7925,90.4078|23.7937,90.4066|23.7639,90.3889|23.7465,90.376"},
headers={"Authorization": f"Bearer {os.environ['WAYLINE_API_KEY']}"},
timeout=10,
)
res.raise_for_status()
print(res.json())package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
req, _ := http.NewRequest("GET", "https://api.wayline.cloud/v1/staticmap?size=1280x800&scale=2&path=color%3A0x2563eb%7Cweight%3A5%7C23.7925,90.4078%7C23.7937,90.4066%7C23.7639,90.3889%7C23.7465,90.376&markers=numbered%3A1%7C23.7925,90.4078%7C23.7937,90.4066%7C23.7639,90.3889%7C23.7465,90.376", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("WAYLINE_API_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res.Status, string(body))
}<?php
$ch = curl_init("https://api.wayline.cloud/v1/staticmap?size=1280x800&scale=2&path=color%3A0x2563eb%7Cweight%3A5%7C23.7925,90.4078%7C23.7937,90.4066%7C23.7639,90.3889%7C23.7465,90.376&markers=numbered%3A1%7C23.7925,90.4078%7C23.7937,90.4066%7C23.7639,90.3889%7C23.7465,90.376");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer " . getenv("WAYLINE_API_KEY")],
CURLOPT_TIMEOUT => 10,
]);
$data = json_decode(curl_exec($ch), true);
print_r($data);require "net/http"
require "json"
uri = URI("https://api.wayline.cloud/v1/staticmap?size=1280x800&scale=2&path=color%3A0x2563eb%7Cweight%3A5%7C23.7925,90.4078%7C23.7937,90.4066%7C23.7639,90.3889%7C23.7465,90.376&markers=numbered%3A1%7C23.7925,90.4078%7C23.7937,90.4066%7C23.7639,90.3889%7C23.7465,90.376")
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer #{ENV.fetch("WAYLINE_API_KEY")}"
res = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(req) }
puts JSON.parse(res.body)import java.net.URI;
import java.net.http.*;
public class Main {
public static void main(String[] args) throws Exception {
var req = HttpRequest.newBuilder(URI.create("https://api.wayline.cloud/v1/staticmap?size=1280x800&scale=2&path=color%3A0x2563eb%7Cweight%3A5%7C23.7925,90.4078%7C23.7937,90.4066%7C23.7639,90.3889%7C23.7465,90.376&markers=numbered%3A1%7C23.7925,90.4078%7C23.7937,90.4066%7C23.7639,90.3889%7C23.7465,90.376"))
.header("Authorization", "Bearer " + System.getenv("WAYLINE_API_KEY"))
.GET().build();
var res = HttpClient.newHttpClient().send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(res.statusCode() + " " + res.body());
}
}import 'dart:convert';
import 'dart:io';
import 'package:http/http.dart' as http;
Future<void> main() async {
final res = await http.get(
Uri.parse('https://api.wayline.cloud/v1/staticmap?size=1280x800&scale=2&path=color%3A0x2563eb%7Cweight%3A5%7C23.7925,90.4078%7C23.7937,90.4066%7C23.7639,90.3889%7C23.7465,90.376&markers=numbered%3A1%7C23.7925,90.4078%7C23.7937,90.4066%7C23.7639,90.3889%7C23.7465,90.376'),
headers: {'Authorization': 'Bearer ${Platform.environment['WAYLINE_API_KEY']}'},
);
print(jsonDecode(res.body));
}HTTP/1.1 200 OK
Content-Type: image/png
X-Map-Zoom: 14
X-Map-Center: 23.752310,90.384120
X-Units-Charged: 1
X-Cache: MISS
<2560 x 1600 PNG: your route and numbered stops, © OpenStreetMap contributors>Response
200 — PNG or WebP image.
Response headers
X-Request-Id— Unique identifier for tracking and debugging this request.X-Units-Charged— Units billed (1).X-Map-Zoom— Zoom used (fitted or given).X-Map-Center— Center used, `lat,lng`.X-Cache— `HIT` when served from the server-side image cache (billed the same).
Errors
| Status | When |
|---|---|
400 | Bad request (invalid coordinates, out of coverage, too many elements, etc.). |
401 | Missing or invalid API key, or expired key. |
402 | Free quota exhausted, no payment method, account suspended, or the monthly spend limit you set was reached. Never billed. Raise or remove the limit in the dashboard (Billing) and retry; nothing else changes. |
403 | Account disabled, key IP restriction failed, origin not allowed, or scope not permitted. |
429 | Rate limit exceeded or test key daily quota reached. |
500 | Internal server error. |
503 | Upstream routing service temporarily unavailable. |
Error bodies contain a code such as OUT_OF_COVERAGE — see the error reference.
Try it
Interactive API Console
Sends a real request from your browser using a test key (free, never billed). The key stays in this browser tab only.
No key yet? Create a free test key.