!

API Recipes

Learn how to use the Houski API with practical examples.

Get address from latitude/longitude

Programming language

Select the programming language you want to display the code examples in.

Convert coordinates to address
Use reverse geocoding to find the nearest address from latitude and longitude coordinates.
Request
Shell session
curl -X GET "https://api.houski.ca/geocoding?api_key=YOUR_API_KEY&country_abbreviation=ca&latitude=49.2827&longitude=-123.1207&radius=0.5"
TypeScript code
const houski_geocoding = async (): Promise<GeocodingResponse> => {

    // You must copy the GeocodingResponse type declarations from the 
    // Houski API documentation to strongly type the response

    const url = new URL('https://api.houski.ca/geocoding');
    url.searchParams.set('api_key', 'YOUR_API_KEY');
    url.searchParams.set('country_abbreviation', 'ca');
    url.searchParams.set('latitude', '49.2827');
    url.searchParams.set('longitude', '-123.1207');
    url.searchParams.set('radius', '0.5');

    const response = await fetch(url);
    const data = await response.json();

    return data;
}

(async () => {
let data: GeocodingResponse = await houski_geocoding();

// Log the response
console.log(data);
})();
Response
JSON
{
  "cache_hit": false,
  "cost_cents": 1.2000000476837158,
  "data": [
    {
      "address": "1403 5380 Crooked Branch Road Road",
      "property_id": "5b69aa609df6ec92"
    },
    {
      "address": "817 6036 Gray Avenue",
      "property_id": "5aef8cd997c6c2d2"
    },
    {
      "address": "1306 5380 Crooked Branch Road Road",
      "property_id": "e6c69bfb9798beb0"
    },
    {
      "address": "1009 5380 Crooked Branch Road",
      "property_id": "ad62b6fe66b0d6e1"
    },
    {
      "address": "125 5370 Crooked Branch Road",
      "property_id": "fada86033e2236b"
    },
    {
      "address": "1309 5370 Crooked Branch Road",
      "property_id": "46b751cafda07368"
    }
  ],
  "error": "",
  "pagination": {
    "current_page": 1,
    "has_next_page": true,
    "has_previous_page": false,
    "page_total": 1483
  },
  "price_quote": false,
  "result_total": 8896,
  "time_ms": 115
}