Get a free key

Docs

On this page
The examples use YOUR_KEY. Get a free key to run them; it takes about a minute and needs no card.Get a free key

Quickstarts

Machine-readable: OpenAPI 3.1 spec · llms.txt · this page as Markdown

Getting started

Get a key from the dashboard. Every request takes it as ?key=ps_… or as an Authorization: Bearer ps_… header. The base URL is https://api.pinsharing.com.

curl "https://api.pinsharing.com/v1/geocode?q=Oswego%20IL&limit=1&key=YOUR_KEY"

JavaScript:

const r = await fetch("https://api.pinsharing.com/v1/geocode?q=" + encodeURIComponent("Oswego IL") + "&limit=1", {
  headers: { Authorization: "Bearer YOUR_KEY" }
});
const { features } = await r.json();
const [lng, lat] = features[0].geometry.coordinates;

Python:

import requests
r = requests.get("https://api.pinsharing.com/v1/geocode", params={"q": "Oswego IL", "limit": 1},
                 headers={"Authorization": "Bearer YOUR_KEY"}, timeout=10)
lng, lat = r.json()["features"][0]["geometry"]["coordinates"]

PHP (for example in WordPress):

$url = "https://api.pinsharing.com/v1/geocode?" . http_build_query(["q" => "Oswego IL", "limit" => 1, "key" => "YOUR_KEY"]);
$data = json_decode(file_get_contents($url), true);
[$lng, $lat] = $data["features"][0]["geometry"]["coordinates"];

Static images

GET /v1/static returns an image. Give a center and zoom, or let us fit the view to your markers, path or area.

ParameterMeaningDefault
centerlat,lngfitted
zoom0 to 20, decimals allowedfitted
sizeWIDTHxHEIGHT, each 16 to 1280600x400
scale2 for high-density screens1
stylelight, dark, white, grayscalelight
formatpng, jpg, webppng
markersUp to 25 points: lat,lng|lat,lng
marker_colorHex coloure11d48
pathA line through 2 to 200 points: lat,lng|lat,lng|…
path_color, path_widthHex colour; 1 to 12 px2563eb, 4
paddingPixels kept clear around fitted content40
<img src="https://api.pinsharing.com/v1/static?markers=41.8781,-87.6298|41.6828,-88.3515&size=600x300&scale=2&key=YOUR_KEY"
     width="600" height="300" alt="Map from Chicago to Oswego">

Images are deterministic: the same URL gives the same picture, so cache them for as long as your plan allows. On the Free plan, images carry a small "Map by pinsharing.com" mark in the bottom-left corner; paid plans have none.

Privacy area mode

For listings, deliveries or anything where the exact address should stay private. Send the real point as area; we snap it to a grid, draw a shaded circle, and add no pin.

ParameterMeaningDefault
areaThe real lat,lng
radiusCircle radius in metres, 100 to 25000. Raised if needed so the circle always contains the real point.1000
snapGrid size in degrees, 0 to 0.1. 0.01 is about 1 km.0.01
colorHex colour of the circle0f766e
https://api.pinsharing.com/v1/static?area=41.6843,-88.3512&size=640x300&key=YOUR_KEY

Every address in the same grid cell gets the identical image, so viewers can't narrow the location down by comparing maps. Build the URL on your server if the real point must never reach the browser; the image itself contains only the snapped circle. See privacy-safe listing maps for a full walkthrough.

Address search

GET /v1/geocode?q=… returns GeoJSON features, best match first. /v1/autocomplete takes the same parameters and suits type-ahead boxes; each call counts as one lookup, so wait for a short pause in typing (about 250 ms) before calling it.

ParameterMeaning
qText to search for (required)
limit1 to 20, default 5
lat, lonPrefer results near this point
bboxminLon,minLat,maxLon,maxLat to restrict results
langen, de, fr or default (local names)
layerFilter: house, street, city, county, state, country and more
curl "https://api.pinsharing.com/v1/geocode?q=4%20Yorkville%20Rd%20Oswego&limit=1&key=YOUR_KEY"

Paid plans may store and reuse results indefinitely; Free results may be stored for up to 30 days. Each response carries a license field that says which applies. US house-number coverage follows OpenStreetMap and varies by area; street and town results are reliable everywhere.

Reverse lookup

GET /v1/reverse?lat=…&lon=… returns the nearest address or place. Optional radius (km), limit, lang.

Raster tiles

256-pixel PNG tiles, with @2x for sharp screens. Use them with Leaflet, OpenLayers or anything that takes an XYZ URL. A typical map view loads about 16 tiles.

L.tileLayer("https://api.pinsharing.com/v1/tiles/light/{z}/{x}/{y}@2x.png?key=YOUR_KEY", {
  tileSize: 256, maxZoom: 19,
  attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>'
}).addTo(map);

Vector tiles & styles

For MapLibre GL, point the map at a style. Fonts, icons and tile URLs inside it already carry your key.

new maplibregl.Map({
  container: "map",
  style: "https://api.pinsharing.com/v1/styles/light.json?key=YOUR_KEY",
  center: [-88.35, 41.68], zoom: 12
});

Styles: light, dark, white, grayscale. Raw tiles are at /v1/tiles/vector/{z}/{x}/{y}.pbf (Protomaps schema, zoom 0 to 15), described by /v1/tiles/vector.json.

Keys & websites

Keys used in web pages are visible to visitors. In the dashboard, limit such a key to your websites (for example example.com, *.example.com); requests from other sites are refused. Keep an unrestricted key on your server only. Revoking a key takes effect within a minute. Free accounts have 1 key; paid plans up to 20.

Plans, caps & errors

Each plan has a monthly cap per product (see Pricing). Caps reset on the 1st of each month (UTC). We email the account at 80% and at 100% of a cap. The Free plan also allows 5 requests a second per account, with bursts up to 60; paid plans have no per-second limit.

Errors are JSON with an error code and a readable message.

StatuserrorMeaning
400bad_requestA parameter is missing or out of range
401missing_key, invalid_keyNo key, or a revoked one
403referer_deniedThe key is limited to other websites
404not_foundNo such tile, style or path
429monthly_cap_reachedThis product's cap is used up; includes product, cap, resets and upgrade_url
429slow_downFree plan rate limit; retry after the Retry-After header (1 second)
502engine_errorTemporary; retry shortly

Attribution

Map data comes from OpenStreetMap under the Open Database License. Show © OpenStreetMap contributors near any map or results you display, linked to openstreetmap.org/copyright. Static images already include it in the corner. PinSharing is not affiliated with or endorsed by the OpenStreetMap Foundation.

↑ Contents