Borderly API Documentation

Generate SVG shapes of any country, US state, ZIP code, or DMA with a simple URL. No API keys required for basic usage.

Quick Start

Embed a geographic shape with a simple img tag:

<img src="https://borderly.dev/california.svg" alt="California" />
<img src="https://borderly.dev/country/germany.svg" alt="Germany" />

Base URL

https://borderly.dev

Supported Regions

US States

Countries (200+)

US DMAs (Designated Market Areas)

US ZIP Codes

Canada

India

API Parameters

All parameters are optional query string parameters.

ParameterTypeDefaultDescription
fillhex22c55eFill color (without #)
strokehex166534Stroke color (without #)
strokeWidthnumber1.5Stroke width in pixels
bghextransparentBackground color
paddingnumber0Padding around shape in pixels
opacitynumber1Fill opacity (0-1)
patternstring-Fill pattern: dots, stripes, crosshatch, grid, waves, zigzag, diamonds, hexagons
patternBghextransparentPattern background color
zoomnumber1Zoom level (1-5)
cxnumber50Center X for zoom (0-100)
cynumber50Center Y for zoom (0-100)
rotatenumber0Rotation angle in degrees
animationstring-CSS animation: pulse, glow, float, spin, fade

Example URLs

Basic Usage

https://borderly.dev/california.svg
https://borderly.dev/country/france.svg
https://borderly.dev/dma/501.svg

With Customization

https://borderly.dev/texas.svg?fill=3b82f6&stroke=1d4ed8
https://borderly.dev/country/japan.svg?fill=ef4444&strokeWidth=2
https://borderly.dev/california.svg?pattern=stripes&fill=22c55e
https://borderly.dev/ny.svg?animation=pulse&fill=8b5cf6
https://borderly.dev/florida.svg?zoom=2&cx=50&cy=50
https://borderly.dev/wa.svg?rotate=45

Geocoding API

Reverse geocode coordinates to find which region contains a point.

Endpoint

GET /api/geocode?lat={latitude}&lng={longitude}

Example Request

GET https://borderly.dev/api/geocode?lat=37.77&lng=-122.42

Example Response

{
  "coordinates": { "lat": 37.77, "lng": -122.42 },
  "country": { "name": "United States", "iso2": "US", "iso3": "USA" },
  "state": { "name": "California", "fips": "06", "abbrev": "CA" },
  "dma": { "name": "San Francisco-Oakland-San Jose", "code": "807" },
  "zip": { "code": "94102" }
}

Coordinate-Based SVG

Get SVGs directly from coordinates:

https://borderly.dev/state.svg?lat=37.77&lng=-122.42
https://borderly.dev/country.svg?lat=48.86&lng=2.35

Composite Maps

Combine multiple regions into a single SVG. Requires a free API key from /dashboard.

https://borderly.dev/composite.svg?regions=ca,tx,ny&apikey=YOUR_KEY

Code Examples

HTML

<img src="https://borderly.dev/california.svg" alt="California" />

Python (Jupyter Notebook)

from IPython.display import Image
display(Image(url='https://borderly.dev/california.svg?fill=3b82f6'))

Using an API Key

API keys are optional but enable composite maps and usage tracking. Get a free key at /dashboard.

Via Query Parameter

<img src="https://borderly.dev/california.svg?apikey=YOUR_KEY" alt="California" />

Via HTTP Header (curl)

curl -H "x-api-key: YOUR_KEY" https://borderly.dev/california.svg

Coming Soon

Response Headers

Rate Limits

Support & Links