Plus code (Open Location Code) encoder and decoder
Plus code (Open Location Code) encoder and decoder: encode coordinates as a plus code at a chosen length, or decode a full code back to its bounding box and centre. Also shortens a full code against a reference coordinate and recovers a shortened code given a reference, which is how plus codes are normally exchanged in text. Returns code length, precision in metres and validity.
Output (data): code, length (integer|null, null for an invalid code), bbox {min_lat, min_lon, max_lat, max_lon}, center {lat, lon}, precision_m (cell height in metres, rounded to 0.1), is_full, is_short, valid, reason (string|null, null on success). Invalid codes on op=decode return 200 with valid:false and a reason (invalid character is checked before the + position); short codes decode to valid:true, is_short:true without a bbox. shorten also returns full_code. shorten/recover with a malformed code are 400 INVALID_PARAM.
Deterministic: identical input returns identical output, so the response is served with Cache-Control: private, max-age=31536000, immutable (the paying client may cache it indefinitely; shared caches must not, because the response is paid).
Price: $0.05 USDC per call (x402, Base). Route contract version 1.0.0. Docs: https://api.duoleads.com/docs#geo-pluscode
Request
- Base URL: https://api.duoleads.com
- URL: https://api.duoleads.com/v1/geo/pluscode
- Auth: none declared
Query parameters
encode (default), decode, shorten or recover. Accepted: encode, decode, shorten, recover.
Latitude for op=encode. Accepted: a number between -90 and 90.
Longitude for op=encode. Accepted: a number between -180 and 180.
Plus code for decode, shorten or recover. Accepted: at most 20 characters.
Integer code length for op=encode: one of 2,4,6,8,10 (default),11,12,13,14,15. Other integers in 2-15 are 400 UNSUPPORTED_VALUE. Accepted: one of 2,4,6,8,10,11,12,13,14,15.
Reference latitude for op=shorten/recover. Accepted: a number between -90 and 90.
Reference longitude for op=shorten/recover. Accepted: a number between -180 and 180.
Response
Paid and settled. data is route-specific; a route that judges its input returns 200 with data.valid: false for a bad value.
Changes
No recorded changes to this operation across all 1 revision of this API.