API recipes

Requests you can copy and run. Each one returns live data from the API.

Examples

Calculate cap rate, cash on cash return and return on investment

Programming language

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

Get investment calculations
Pull the return on investment, cap rate and cash on cash return of Calgary houses for sale, highest cap rate first, to screen acquisitions.
Request
Shell session
curl -X GET "https://api.houski.ca/properties?api_key=YOUR_API_KEY&cap_rate_sort=desc&city=calgary&country_abbreviation=ca&for_sale_eq=true&page=1&property_type_eq=House&province_abbreviation=ab&results_per_page=3&select=for_sale,cash_on_cash_return,return_on_investment,cap_rate"
TypeScript code
const houski_recipe_data = async (): Promise<PropertiesResponse> => {

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

    const url = new URL('https://api.houski.ca/properties');
    url.searchParams.set('api_key', 'YOUR_API_KEY');
    url.searchParams.set('cap_rate_sort', 'desc');
    url.searchParams.set('city', 'calgary');
    url.searchParams.set('country_abbreviation', 'ca');
    url.searchParams.set('for_sale_eq', 'true');
    url.searchParams.set('page', '1');
    url.searchParams.set('property_type_eq', 'House');
    url.searchParams.set('province_abbreviation', 'ab');
    url.searchParams.set('results_per_page', '3');
    url.searchParams.set('select', 'for_sale,cash_on_cash_return,return_on_investment,cap_rate');

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

    return data;
}

(async () => {
let data: PropertiesResponse = await houski_recipe_data();

// Log the response
console.log(data);
})();
Response
JSON
{
  "cache_hit": true,
  "cost_cents": 1.26,
  "data": [
    {
      "address": "90 Coventry Lane NE",
      "cap_rate": 0.08808493,
      "cash_on_cash_return": 0.14296167,
      "for_sale": true,
      "property_id": "e0414f73a3800041",
      "return_on_investment": 1.1346697
    },
    {
      "address": "11 Coventry Lane NE",
      "cap_rate": 0.08500553,
      "cash_on_cash_return": 0.13064405,
      "for_sale": true,
      "property_id": "79f6aabcc679c01e",
      "return_on_investment": 1.0852761
    },
    {
      "address": "920 Penmeadows Road SE",
      "cap_rate": 0.08387231,
      "cash_on_cash_return": 0.12611118,
      "for_sale": true,
      "property_id": "5cfd0a5d9ca8d79c",
      "return_on_investment": 1.0670995
    }
  ],
  "error": "",
  "pagination": {
    "current_page": 1,
    "has_next_page": true,
    "has_previous_page": false,
    "page_total": 938
  },
  "price_quote": false,
  "result_total": 2813,
  "time_ms": 4186,
  "ui_info": {
    "city": "Calgary",
    "city_id": "6ec95b53075d062c",
    "city_link": "ca/ab/calgary",
    "city_slug": "calgary",
    "country": "Canada",
    "country_abbreviation": "CA",
    "country_abbreviation_id": "9ace2b6431b7f1be",
    "country_abbreviation_link": "ca",
    "country_slug": "canada",
    "province": "Alberta",
    "province_abbreviation": "AB",
    "province_abbreviation_id": "aae1f05a0f89d2c7",
    "province_abbreviation_link": "ca/ab",
    "province_slug": "alberta"
  }
}