BCL API Documentation
The BCL API is the main mechanism for querying and downloading content.
BCL Auth Key
Some OpenStudio apps—such as the OpenStudio Application and the SketchUp Plug-in—may prompt you to enter a BCL Auth Key. This key is no longer needed to search for content on the BCL. If you encounter a dialog box prompting you to enter your BCL Auth key, simply enter the following placeholder key or any 32 characters.
BCL auth key:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXSearch Endpoint
The main syntax for querying is as follows:
https://bcl.nrel.gov/api/search/{KEYWORD}.{FORMAT}?fq={FILTER}:{FILTER_VALUE}where:
KEYWORD—is the term to search on, such as "window" or "boiler". To do a wildcard search, use the "*" symbol.
FORMAT—is the return format wanted. XML and JSON are both supported; if no format is specified, JSON will be returned.
FILTER_NAME & FILTER_VALUE—are used to narrow down the search results. Multiple name-value pairs can be specified.
Search results schemas for measures and components are available.
Read on for more details on filters and query parameters that can be used in search requests, or view the examples section for ready-to-use examples.
Filters
Below is a list of common filters that can be used to narrow down search results:
| Filter Name | Description |
|---|---|
| bundle | Type of content. The possible values for this filter are: measure and component |
| name | Name of the component or measure |
| display_name | Display Name of the component or measure |
| uuid | UUID of the component or measure |
| version_id | Unique Version ID of the component or measure |
| release_tag | Release tag version of the parent GitHub repo |
| repo | Name of the content's GitHub repo of origin |
| org | Name of the content's GitHub organization of origin |
| measure_tags | Classification tag of the measure. See Measure Tags for a complete tag list and the examples below for query syntax. |
| component_tags | Classification tag of the component. See Component Tags for a complete list and the examples below for query syntax. |
| classname | OpenStudio Classname of the component or measure |
| manufacturer | Manufacturer of the item represented by the component |
| model | Model number of the item represented by the component |
| serial_no | Serial number of the item represented by the component |
| year | Year of manufacture of the item represented by the component |
| url | Source URL of the item represented by the component |
Special Filter: OpenStudio Version
To specify the OpenStudio version you are using and retrieve only those measures that are valid for that version, the openstudio_version filter can be used. This is a special filter: when given a version number in Major.Minor.Patch format (e.g. 3.2.0), the search algorithm will retrieve all content with openstudio_min_compatible version less than or equal to the specified version and all content with openstudio_max_compatible version greater than or equal to the specified version. The openstudio_version field of the measure.xml file is not directly used as it has not been reliably updated in the XML files in the past. The openstudio_min_compatible field is a better indicator of OpenStudio version compatibility.
For example, to retrieve all measures that are compatible with OpenStudio 3.2.0, the following filter can be used:
https://bcl.nrel.gov/api/search/*.json?fq=bundle:measure&fq=openstudio_version:3.2.0The latest released version of each measure that meet the filter criteria will be returned. If ALL versions of a measure that meet the criteria are desired, append &all_content_versions=1 to the query string. For example:
https://bcl.nrel.gov/api/search/*.json?fq=bundle:measure&fq=openstudio_version:3.2.0&all_content_versions=1
Attributes
Content attributes can also be used to filter search results. Attributes are stored as a name and value pair. For example:
{ "name": "Measure Type", "value": "ModelMeasure"}To query by attribute, specify the attribute name and attribute value separately using the attr_name and attr_value syntax:
https://bcl.nrel.gov/api/search?fq=attr_name:{ATTRIBUTE NAME}&fq=attr_value:{ATTRIBUTE VALUE}Query Parameters
In addition to filters, several query parameters are also available to narrow down the search results. These query parameters are appended to the search URL but do not need the 'fq=' syntax which indicates filters.
For example, the following URL can be used to paginate the search results to 10 per request and return page 2 of the results:
https://bcl.nrel.gov/api/search/denver.json?page=2&show_rows=10The list of query parameters can be found in the table below.
| Query Parameter Name | Description |
|---|---|
| show_rows | Number of results to return on each page. Default is 50. |
| page | The page to return. This is 0-based (the first page is page=0). |
| all_content_versions | By default, the latest version of all content is returned. all_content_versions=1 can be added to the URL to return all versions. |
| api_version | Used to specify the legacy API. Set api_version=2.0 to use the legacy syntax. |
Geospatial Search
Geospatial searching is enabled for content with Latitude and Longitude attributes. This search currently exists for Location-Dependent Components such as Weather Files and Design Days, but is possible on any component or measure content provided that Latitude and Longitude are both provided as attributes in the component.xml or measure.xml file.
To perform a geospatial search, the special location: prefix is used in the keyword section of the search query URL. There are three syntaxes available for this query type, as described below.
| Type | Keyword Syntax |
|---|---|
| Zipcode | location:{zipcode} |
| Latitude and Longitude | location:{latitude},{longitude} |
| City and State | location:{city},{state abbreviation} |
The default search radius is 40km, but a custom radius can be specified in miles (mi) or kilometers (km) using the radius query parameters.
See below for geospatial search examples.
Download Endpoint
Measures and Components can be downloaded via the BCL API. Individual or multiple content can be downloaded in the same request, by specifying a single uuid or a list of uuids. For individual requests, the version of the content can be specified. You will need the uuid
The basic syntax for downloading is as follows:
https://bcl.nrel.gov/api/download/?uids={UUID}where:
UUID—is either a single uuid or a list of uuids.
See below for downloading examples.
Taxonomy Endpoint
The taxonomy endpoint is used to programmatically return the Measure Tags or Component Tags hierarchies. This can be useful for user interface development.
The response can be returned in either XML or JSON format. To return all Measure Tags:
https://bcl.nrel.gov/api/taxonomy/measure.jsonTo return all Component Tags:
https://bcl.nrel.gov/api/taxonomy/component.jsonMetasearch Endpoint
The metasearch endpoint can be used to retrieve the statistics of a search—such as number of results overall as well as the number of results per filter relevant to the search. This endpoint can be useful for user interface development.
Basic syntax is the same as the search endpoint; for example:
https://bcl.nrel.gov/api/metasearch/*.xml?fq=bundle:measureThis query will return the total number of results overall and the number of results per measure tag, for example.
Examples
Expand the sections below to view API usage examples.
Use the bundle filter to specify a measure or a component, and the measure_tags or component_tags to specify the category of content to retrieve:
JSON FORMAThttps://bcl.nrel.gov/api/search/*.json?fq=bundle:measure&fq=measure_tags:HVAChttps://bcl.nrel.gov/api/search/*.json?fq=bundle:component&fq=component_tags:Location-Dependent Component&fq=component_tags:Weather Filehttps://bcl.nrel.gov/api/search/*.xml?fq=bundle:measure&fq=measure_tags:HVAChttps://bcl.nrel.gov/api/search/*.xml?fq=bundle:component&fq=component_tags:Location-Dependent Component&fq=component_tags:Weather FileThe UUID is a universally unique content identifier. The search will only return exact UUID matches.
https://bcl.nrel.gov/api/search/?fq=uuid:339a2e3a-273c-4494-bb50-bfe586a0647cTo retrieve all versions of a measure or component, append the all_content_versions query parameter to the query.
https://bcl.nrel.gov/api/search/?fq=uuid:339a2e3a-273c-4494-bb50-bfe586a0647c&all_content_versions=1The OpenStudio version should be specified in Major.Minor.Patch format, e.g. 3.8.0. This will search for all content with openstudio_min_compatible element <= the OpenStudio version and all content with openstudio_max_compatible >= the OpenStudio version. Null fields will be included in the search results. The latest release of each version that meets the criteria will be returned. To query measures that are compatible with OpenStudio 3.8.0, use the following query:
https://bcl.nrel.gov/api/search/?fq=bundle:measure&fq=openstudio_version:3.8.0To view all versions of each measure that meet the criteria, append the all_content_versions query parameter to the query.
https://bcl.nrel.gov/api/search/?fq=bundle:measure&fq=openstudio_version:3.8.0&all_content_versions=1To search by the content's GitHub repo name:
https://bcl.nrel.gov/api/search/?fq=repo:bcl-test-componentsTo search by the content's GitHub repo name and repo organization name:
https://bcl.nrel.gov/api/search/?fq=repo:bcl-test-measures-gem&fq=org:BuildingComponentLibraryTo search by attribute Measure Type with value ReportingMeasure:
https://bcl.nrel.gov/api/search?fq=attr_name:"Measure Type"&fq=attr_value:ReportingMeasureTo search by Zipcode:
https://bcl.nrel.gov/api/search/location:80222To search by City and State:
https://bcl.nrel.gov/api/search/location:denver,COTo search by Latitude and Longitude:
https://bcl.nrel.gov/api/search/location:39.7,-104.5.jsonTo search by Location and Component Type, and limit the results to the first one:
https://bcl.nrel.gov/api/search/location:80222.json?fq=component_tags:"Weather File"&show_rows=1To search by Latitude and Longitude in a custom radius of 100 miles:
https://bcl.nrel.gov/api/search/location:39.7,-104.5.json?radius=100miTo search by Latitude and Longitude in a custom radius of 50 kilometers:
https://bcl.nrel.gov/api/search/location:39.7,-104.5.json?radius=50kmDownload the latest version of a single measure or component:
https://bcl.nrel.gov/api/download/?uids=339a2e3a-273c-4494-bb50-bfe586a0647cDownload multiple measures or components (measures and components can be downloaded at the same time):
https://bcl.nrel.gov/api/download/?uids=339a2e3a-273c-4494-bb50-bfe586a0647c,03b18912-0ceb-47e9-8f8b-417a3008e189Download a specific version of a measure or component:
https://bcl.nrel.gov/api/download/?uids=339a2e3a-273c-4494-bb50-bfe586a0647c&release_tag=V0.4.2