Roof Pitch API — Free Roof Pitch Data (JSON)

Our API is open and easily readable JSON data. You can access it to add roof pitches to your website, app and/or spreadsheet – without needing to calculate this manually. There is no password, registration or charge. Simply download a file, analyze the data within and then present it to your audience, linking back to us.

What is an API?

An API transfers information between sites. Our API is the most basic type. There isn’t even a login process. On our site there are two JSON files accessed via an API. JSON is plain text that a script can turn into rows and lists without any extra software. Web browsers can open these files and display the text. Computer scripts can also access the files and convert them into tables. Therefore, this is our whole API. No installation is required and there is no control panel. As long as your code can access web pages, it can utilize our API.

Files are for viewing only

While you can view the files, you cannot add to or amend them. This ensures that everybody sees and experiences identical figures. We amend files to alter figures and so the amended figure is picked up the next time a file is accessed. There is no requirement for you to manually re-download files though. Provided that your code accesses or temporarily stores files, then it will receive updated information. Please refer to our fair use guidance to establish how frequently files should be accessed.

Endpoints

There are two files which both constitute an ‘endpoint’. An endpoint is simply a file location.

Pitch chart

This includes all full pitches (from 1:12 through to 18:12) within a table called chart. For each pitch, it tells you the rise in inches, the angle in degrees, the gradient in percentage terms and also a multiplier. This is identical to the chart shown on our homepage but in a computer friendly format.

https://roofpitchiq.com/api/pitch-chart.json

Material minimums

Again, this is in the shape of a table (named ‘materials’). It states the minimum permitted roof pitch for each typical roof covering type, as identified in the International Residential Code, under section R905. Included within this table are asphalt, clay and concrete tiles; metal shingles; slate; and both standing seam and lapped metal sheeting. For each material, the table shows what type of material it is together with the minimum pitch permitted by the code and a brief explanation. Local codes and manufacturers can impose even higher minimum pitches and so in such cases, these take precedence. Therefore, our file only demonstrates the minimum pitch permitted by the code – it is not definitive for actual roofs.

https://roofpitchiq.com/api/material-minimums.json

Code example

JavaScript can be used to retrieve data from a file. The fetch function requests information from a file and then awaits its return. The code given below retrieves the data and displays one row. This corresponds to a 6:12 pitch, which is the most popular in American houses. As the data is held in a list known as chart within the file, we must refer to data.chart.

fetch('https://roofpitchiq.com/api/pitch-chart.json')
  .then(function(response) { return response.json(); })
  .then(function(data) {
    var row = data.chart.find(function(r) { return r.pitch === '6:12'; });
    console.log(row);
  });

For this particular row, the pitch is 6:12. This equates to a rise of 6 inches. Converted into degrees, this is 26.57. As a percentage, this is 50 percent (calculated as rise divided by run, multiplied by 100). Finally, the multiplier is 1.118. Apart from simply displaying data, your code can populate a table, supply information to a calculator and/or verify a pitch that has been inputted by someone visiting your site. The fetch function can be used both in browsers and in most server-side coding. When using fetch in a browser, remember that the request is being made from your site to ours. For your site to successfully access the file, it must be formatted appropriately and it is. However, when using fetch on a server, there is no browser involved.

Understanding the columns

Every row in the pitch data comprises 5 columns. Pitch is expressed as a ratio of rise to run, and is shown as 6:12. Rise_inches shows how many inches the material rises for that pitch. Angle_degrees is another version of the gradient, but measured in degrees. Slope_percent is yet another representation of the gradient, but presented as a percentage. It is calculated in exactly the same way as above. Finally, the multiplier is used to calculate the actual area of a slope from its flat area. Therefore, for a 6:12 pitch, the sloped roof area is approximately 12 percent larger than that of the flat roof plan. To establish the rafter length, multiply the run by the multiplier. Thus, for every 12 inch run, a 6:12 pitch has an associated rafter length of approximately 13.42 inches.

FieldWhat it means
pitchThe rise over a 12-inch run, written as 6:12.
rise_inchesThe rise in inches for that pitch.
angle_degreesThe same steepness in degrees.
slope_percentThe same steepness as a percent, which is the rise divided by the run, times 100.
multiplierThe number you multiply a flat area by to get the real sloped area. A multiplier of 1.118 for a 6:12 pitch means the sloped roof is about 12 percent bigger than the flat plan. Multiply the multiplier by the run to get the rafter length, so a 6:12 pitch gives about 13.42 inches of rafter for each 12 inches of run.

Alongside the rows, the file also includes two further columns. Source details the origin of the data, and units provides a brief description of the units used.

For each line in the material minimums file, there are 3 elements. These are the type of material; the minimum pitch permitted by the code for that material (for example 2:12); and notes – a simple explanation of the information e.g. that between pitches of 2:12 and 4:12, asphalt shingles require two layers of underlay. Notes are included in the data and can be presented alongside any figures. Lines of data are in a ‘materials’ list. There is also a source element which states which part of the code the data was gathered from.

FieldWhat it means
materialThe name of the roofing material.
minimum_pitchThe lowest pitch the code allows for that material, written as a pitch like 2:12.
notesA short plain-English note, for example that asphalt shingles need double underlayment between 2:12 and 4:12. The notes are part of the data, and you may show them next to the number.

Attribution

Whenever data is presented from our database, it should be attributed. Therefore, you must include the statement ‘Data: RoofPitchIQ.com’, linked to our home page at https://roofpitchiq.com/. Ideally this should be under a table, or at the bottom of a page, but can also be alongside the data. Please don’t attribute using tiny gray font as nobody will then be able to read it. Also please don’t place attribution on a separate page to the data. Again, this is part of providing our data free of charge. It enables users to understand where our data is sourced from and also allows them to verify this information.

Fair use

While the API is free to use, it is also shared and should therefore be used responsibly. Rather than accessing the files each time a user visits a page on your site, it is better practice to store (or ‘cache’) data on your own server. You could cache data for one day or even one hour and then present this to your users. Do not access files continuously or more than once every second. Although there is no password and no defined access limits, we may still impose our own limits and even prevent access if we consider that the API is being overused or abused. Generally a couple of accesses to the API per day from a single site, or just one access per user session is sufficient. However, if your site expands and you require more regular access to the data, then extend the caching period rather than increasing the number of times that you access the API. This maintains a swift service for all users.

Frequently asked questions

Is an API key needed?

No, there is no key. There is no registration procedure and no account. Data can be requested using a specific URL and a response received. Should a key ever be required in the future this will be stated on this page. However, there are currently no intentions to introduce a key.

Can I incorporate the data into a commercial product?

Yes. Provided you credit this page and do not re-sell the data files, you can include the data within a commercial product. You can then create an app which utilizes the data and display the data within this. However, you must not sell the JSON files and cannot represent the data as your own. The data has been produced by RoofPitchIQ and so this should be recognized within your product.

Embed a calculator on your site · Try the roof pitch calculator