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:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Search 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 NameDescription
bundleType of content. The possible values for this filter are: measure and component
nameName of the component or measure
display_nameDisplay Name of the component or measure
uuidUUID of the component or measure
version_idUnique Version ID of the component or measure
release_tagRelease tag version of the parent GitHub repo
repoName of the content's GitHub repo of origin
orgName of the content's GitHub organization of origin
measure_tagsClassification tag of the measure. See Measure Tags for a complete tag list and the examples below for query syntax.
component_tagsClassification tag of the component. See Component Tags for a complete list and the examples below for query syntax.
classnameOpenStudio Classname of the component or measure
manufacturerManufacturer of the item represented by the component
modelModel number of the item represented by the component
serial_noSerial number of the item represented by the component
yearYear of manufacture of the item represented by the component
urlSource URL of the item represented by the component

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=10

The list of query parameters can be found in the table below.

Query Parameter NameDescription
show_rowsNumber of results to return on each page. Default is 50.
pageThe page to return. This is 0-based (the first page is page=0).
all_content_versionsBy default, the latest version of all content is returned. all_content_versions=1 can be added to the URL to return all versions.
api_versionUsed 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.

TypeKeyword Syntax
Zipcodelocation:{zipcode}
Latitude and Longitudelocation:{latitude},{longitude}
City and Statelocation:{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.json

To return all Component Tags:

https://bcl.nrel.gov/api/taxonomy/component.json

Metasearch 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:measure

This 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.

Download the latest version of a single measure or component:

https://bcl.nrel.gov/api/download/?uids=339a2e3a-273c-4494-bb50-bfe586a0647c

Download 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-417a3008e189

Download 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