# Geocode ## Forward geocode an address **get** `/api/v1/geocode` Forward geocode an address ### Query Parameters - `q: string` Address or place name - `bbox: optional string` Bounding box filter: south,west,north,east - `country_code: optional string` ISO 3166-1 alpha-2 country code filter - `lang: optional string` Language code for localized names (e.g. en, de, fr) - `lat: optional number` Focus latitude - `layer: optional string` Filter by layer: address, poi, or admin - `limit: optional number` Maximum results (default 20, max 100) - `lng: optional number` Focus longitude ### Returns - `GeocodeResult = object { features, type }` GeoJSON FeatureCollection of geocoding results - `features: array of GeocodingFeature` - `geometry: GeoJsonGeometry` - `coordinates: array of number or array of array of number or array of array of array of number or array of array of array of array of number` GeoJSON coordinates array (nesting depth varies by geometry type) - `array of number` - `array of array of number` - `array of array of array of number` - `array of array of array of array of number` - `type: "Point" or "LineString" or "Polygon" or 3 more` - `"Point"` - `"LineString"` - `"Polygon"` - `"MultiPoint"` - `"MultiLineString"` - `"MultiPolygon"` - `properties: object { country_code, display_name, distance_m, 4 more }` - `country_code: optional string` ISO 3166-1 alpha-2 country code - `display_name: optional string` Formatted address or place name - `distance_m: optional number` Distance in meters - `osm_id: optional number` OpenStreetMap ID - `osm_type: optional string` OSM element type - `score: optional number` Match confidence score - `source: optional string` Result source (address, place, interpolation) - `type: "Feature"` - `"Feature"` - `type: "FeatureCollection"` - `"FeatureCollection"` ### Example ```http curl https://plaza.fyi/api/v1/geocode \ -H "Authorization: Bearer $PLAZA_API_KEY" ``` ## Reverse geocode a coordinate **get** `/api/v1/geocode/reverse` Reverse geocode a coordinate ### Query Parameters - `lat: number` Latitude - `lng: number` Longitude - `lang: optional string` Language code for localized names (e.g. en, de, fr) - `layer: optional string` Filter by layer: house or poi - `limit: optional number` Maximum results (default 1, max 20) - `radius: optional number` Search radius in meters (default 200, max 5000) ### Returns - `ReverseGeocodeResult = object { features, type }` GeoJSON FeatureCollection of reverse geocoding results - `features: array of GeocodingFeature` - `geometry: GeoJsonGeometry` - `coordinates: array of number or array of array of number or array of array of array of number or array of array of array of array of number` GeoJSON coordinates array (nesting depth varies by geometry type) - `array of number` - `array of array of number` - `array of array of array of number` - `array of array of array of array of number` - `type: "Point" or "LineString" or "Polygon" or 3 more` - `"Point"` - `"LineString"` - `"Polygon"` - `"MultiPoint"` - `"MultiLineString"` - `"MultiPolygon"` - `properties: object { country_code, display_name, distance_m, 4 more }` - `country_code: optional string` ISO 3166-1 alpha-2 country code - `display_name: optional string` Formatted address or place name - `distance_m: optional number` Distance in meters - `osm_id: optional number` OpenStreetMap ID - `osm_type: optional string` OSM element type - `score: optional number` Match confidence score - `source: optional string` Result source (address, place, interpolation) - `type: "Feature"` - `"Feature"` - `type: "FeatureCollection"` - `"FeatureCollection"` ### Example ```http curl https://plaza.fyi/api/v1/geocode/reverse \ -H "Authorization: Bearer $PLAZA_API_KEY" ``` ## Autocomplete a partial address **get** `/api/v1/geocode/autocomplete` Autocomplete a partial address ### Query Parameters - `q: string` Partial address query - `country_code: optional string` ISO 3166-1 alpha-2 country code filter - `lang: optional string` Language code for localized names (e.g. en, de, fr) - `lat: optional number` Focus latitude - `layer: optional string` Filter by layer: address, poi, or admin - `limit: optional number` Maximum results (default 10, max 20) - `lng: optional number` Focus longitude ### Returns - `AutocompleteResult = object { features, type }` GeoJSON FeatureCollection of autocomplete suggestions - `features: array of GeocodingFeature` - `geometry: GeoJsonGeometry` - `coordinates: array of number or array of array of number or array of array of array of number or array of array of array of array of number` GeoJSON coordinates array (nesting depth varies by geometry type) - `array of number` - `array of array of number` - `array of array of array of number` - `array of array of array of array of number` - `type: "Point" or "LineString" or "Polygon" or 3 more` - `"Point"` - `"LineString"` - `"Polygon"` - `"MultiPoint"` - `"MultiLineString"` - `"MultiPolygon"` - `properties: object { country_code, display_name, distance_m, 4 more }` - `country_code: optional string` ISO 3166-1 alpha-2 country code - `display_name: optional string` Formatted address or place name - `distance_m: optional number` Distance in meters - `osm_id: optional number` OpenStreetMap ID - `osm_type: optional string` OSM element type - `score: optional number` Match confidence score - `source: optional string` Result source (address, place, interpolation) - `type: "Feature"` - `"Feature"` - `type: "FeatureCollection"` - `"FeatureCollection"` ### Example ```http curl https://plaza.fyi/api/v1/geocode/autocomplete \ -H "Authorization: Bearer $PLAZA_API_KEY" ``` ## Batch geocode multiple addresses **post** `/api/v1/geocode/batch` Batch geocode multiple addresses ### Body Parameters - `addresses: array of string` ### Example ```http curl https://plaza.fyi/api/v1/geocode/batch \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $PLAZA_API_KEY" \ -d '{ "addresses": [ "string" ] }' ``` #### Response ```json {} ``` ## Domain Types ### Autocomplete Result - `AutocompleteResult = object { features, type }` GeoJSON FeatureCollection of autocomplete suggestions - `features: array of GeocodingFeature` - `geometry: GeoJsonGeometry` - `coordinates: array of number or array of array of number or array of array of array of number or array of array of array of array of number` GeoJSON coordinates array (nesting depth varies by geometry type) - `array of number` - `array of array of number` - `array of array of array of number` - `array of array of array of array of number` - `type: "Point" or "LineString" or "Polygon" or 3 more` - `"Point"` - `"LineString"` - `"Polygon"` - `"MultiPoint"` - `"MultiLineString"` - `"MultiPolygon"` - `properties: object { country_code, display_name, distance_m, 4 more }` - `country_code: optional string` ISO 3166-1 alpha-2 country code - `display_name: optional string` Formatted address or place name - `distance_m: optional number` Distance in meters - `osm_id: optional number` OpenStreetMap ID - `osm_type: optional string` OSM element type - `score: optional number` Match confidence score - `source: optional string` Result source (address, place, interpolation) - `type: "Feature"` - `"Feature"` - `type: "FeatureCollection"` - `"FeatureCollection"` ### Geocode Result - `GeocodeResult = object { features, type }` GeoJSON FeatureCollection of geocoding results - `features: array of GeocodingFeature` - `geometry: GeoJsonGeometry` - `coordinates: array of number or array of array of number or array of array of array of number or array of array of array of array of number` GeoJSON coordinates array (nesting depth varies by geometry type) - `array of number` - `array of array of number` - `array of array of array of number` - `array of array of array of array of number` - `type: "Point" or "LineString" or "Polygon" or 3 more` - `"Point"` - `"LineString"` - `"Polygon"` - `"MultiPoint"` - `"MultiLineString"` - `"MultiPolygon"` - `properties: object { country_code, display_name, distance_m, 4 more }` - `country_code: optional string` ISO 3166-1 alpha-2 country code - `display_name: optional string` Formatted address or place name - `distance_m: optional number` Distance in meters - `osm_id: optional number` OpenStreetMap ID - `osm_type: optional string` OSM element type - `score: optional number` Match confidence score - `source: optional string` Result source (address, place, interpolation) - `type: "Feature"` - `"Feature"` - `type: "FeatureCollection"` - `"FeatureCollection"` ### Geocoding Feature - `GeocodingFeature = object { geometry, properties, type }` - `geometry: GeoJsonGeometry` - `coordinates: array of number or array of array of number or array of array of array of number or array of array of array of array of number` GeoJSON coordinates array (nesting depth varies by geometry type) - `array of number` - `array of array of number` - `array of array of array of number` - `array of array of array of array of number` - `type: "Point" or "LineString" or "Polygon" or 3 more` - `"Point"` - `"LineString"` - `"Polygon"` - `"MultiPoint"` - `"MultiLineString"` - `"MultiPolygon"` - `properties: object { country_code, display_name, distance_m, 4 more }` - `country_code: optional string` ISO 3166-1 alpha-2 country code - `display_name: optional string` Formatted address or place name - `distance_m: optional number` Distance in meters - `osm_id: optional number` OpenStreetMap ID - `osm_type: optional string` OSM element type - `score: optional number` Match confidence score - `source: optional string` Result source (address, place, interpolation) - `type: "Feature"` - `"Feature"` ### Reverse Geocode Result - `ReverseGeocodeResult = object { features, type }` GeoJSON FeatureCollection of reverse geocoding results - `features: array of GeocodingFeature` - `geometry: GeoJsonGeometry` - `coordinates: array of number or array of array of number or array of array of array of number or array of array of array of array of number` GeoJSON coordinates array (nesting depth varies by geometry type) - `array of number` - `array of array of number` - `array of array of array of number` - `array of array of array of array of number` - `type: "Point" or "LineString" or "Polygon" or 3 more` - `"Point"` - `"LineString"` - `"Polygon"` - `"MultiPoint"` - `"MultiLineString"` - `"MultiPolygon"` - `properties: object { country_code, display_name, distance_m, 4 more }` - `country_code: optional string` ISO 3166-1 alpha-2 country code - `display_name: optional string` Formatted address or place name - `distance_m: optional number` Distance in meters - `osm_id: optional number` OpenStreetMap ID - `osm_type: optional string` OSM element type - `score: optional number` Match confidence score - `source: optional string` Result source (address, place, interpolation) - `type: "Feature"` - `"Feature"` - `type: "FeatureCollection"` - `"FeatureCollection"`