> For the complete documentation index, see [llms.txt](https://docs.2050-materials.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.2050-materials.com/using-the-2050-materials-api.md).

# Get data

How to get access to the 2050 Materials APIs: which account each endpoint needs, the rate and hourly limits, and how to authenticate.

## Accessing our API <a href="#accessing-our-api" id="accessing-our-api"></a>

2050 Materials' API aims to seamlessly integrate comprehensive sustainability data into digital design processes in the construction industry. It leverages AI-powered algorithms and detailed life cycle assessment (LCA) calculations to create a vast, high-quality database on the climate impact of building materials. This integration facilitates real-time calculations of embodied environmental impacts, supporting designers and builders in making more informed, sustainable choices. The goal is to make sustainability a fundamental and easily accessible part of the construction process.

{% hint style="success" %}
**Make your first call in your browser.** The [2050 Materials SDK](https://sdk.2050-materials.com) runs a first API call with your developer token in about a minute, with no code. It covers the open data, product, generic material and best match endpoints. Use it to see the responses before you write your integration.
{% endhint %}

* [Swagger Docs](https://app.2050-materials.com/developer/documentation-ui/), and the same reference as JSON for agents and scripts: [schema.json](https://app.2050-materials.com/developer/schema.json)
* [SDK](https://sdk.2050-materials.com)
* Read more about our API [here](https://2050-materials.com/sustainability-data-api/)
* Jump to the [Notebooks and SDKs](https://docs.2050-materials.com/using-the-2050-materials-api/sdks.md)
* [Python Library aecdata](https://pypi.org/project/aecdata/)

#### API Access and Authentication details <a href="#api-access-and-authentication-details" id="api-access-and-authentication-details"></a>

License is available to any organization which has a use-case for high-quality product information. Use cases include, but are not limited to, building a carbon tool for the construction industry, linking carbon and other data in cost estimation software, and including more granular information in real estate climate risk metrics.

#### Available Endpoints <a href="#available-endpoints" id="available-endpoints"></a>

All endpoints are under `https://app.2050-materials.com/developer/api/`. Each link below opens the Swagger UI. The Swagger UI is a JavaScript page, so agents and scripts should read [schema.json](https://app.2050-materials.com/developer/schema.json) instead.

1. [/get\_products\_open\_api](https://app.2050-materials.com/developer/documentation-ui/)\
   *Open API with limited information (GWP, A1-A3) on construction products*
2. [/get\_products](https://app.2050-materials.com/developer/documentation-ui/)\
   *Full LCA data breakdown & augmented data on all construction products globally*
3. [/get\_generic\_materials](https://app.2050-materials.com/developer/documentation-ui/)\
   *Full LCA data breakdown & augmented data on generic materials/products*
4. [*/get\_best\_match*<br>](https://app.2050-materials.com/developer/documentation-ui/)*Automated mapping of materials from a BoQ to both generic materials and products*
5. [/get\_co2\_warming\_potential](https://app.2050-materials.com/developer/documentation-ui/)\
   *Embodied carbon and* [*Warming Potential*](https://docs.2050-materials.com/methodology-documentation.md) *estimation for building typologies and assemblies*
6. [/get\_product\_filters/](https://app.2050-materials.com/developer/documentation-ui/)\
   *Valid filter values (IDs and names) for the product endpoints*
7. [/get\_generic\_material\_filters/](https://app.2050-materials.com/developer/documentation-ui/)\
   *Valid filter values (IDs and names) for the generic materials endpoint*

#### Access and limits by endpoint <a href="#access-and-limits-by-endpoint" id="access-and-limits-by-endpoint"></a>

There are three kinds of API account:

* **Free account.** Any registered user who generates a Developer Token on the [account page](https://app.2050-materials.com/accounts/edit-account/) gets one. It calls `get_products_open_api`, both filter lists (`get_product_filters` and `get_generic_material_filters`) and the token endpoints.
* **Trial account.** 2050 Materials sets it up for a fixed period. It calls every endpoint in the table below until the trial ends. To ask for a trial, use the [contact page](https://app.2050-materials.com/contact/) or email <api@2050-materials.com>.
* **Licensed account.** Each licence opens one endpoint: Products (`get_products`), Generic Materials (`get_generic_materials`), Early Stage LCA model (`get_co2_warming_potential`) and Get Best Match (`get_best_match`). Any active licence also opens the free-account endpoints, with no hourly limit.

| Endpoint                             | Free account | Trial account | Licensed account      | Limits                                                                                                                                                                                                                                      |
| ------------------------------------ | ------------ | ------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `token/getapitoken`, `token/refresh` | Yes          | Yes           | Any active licence    | Hourly limit for free and trial accounts                                                                                                                                                                                                    |
| `get_products_open_api`              | Yes          | Yes           | Any active licence    | Hourly limit for free and trial accounts. `page_size` up to 200                                                                                                                                                                             |
| `get_product_filters`                | Yes          | Yes           | Any active licence    | Hourly limit for free and trial accounts                                                                                                                                                                                                    |
| `get_products`                       | No           | Yes           | Products              | Trial accounts: at most 5 results, page 1 only, and the hourly limit. `page_size` up to 200                                                                                                                                                 |
| `get_generic_materials`              | No           | Yes           | Generic Materials     | Trial accounts: 5 results from page 1 only, no `page_size`, and the hourly limit. Licensed accounts: `page_size` up to 200                                                                                                                  |
| `get_generic_material_filters`       | Yes          | Yes           | Any active licence    | Hourly limit for free and trial accounts                                                                                                                                                                                                    |
| `get_co2_warming_potential`          | No           | Yes           | Early Stage LCA model | Hourly limit for trial accounts                                                                                                                                                                                                             |
| `get_best_match`                     | No           | Yes           | Get Best Match        | Hourly limit for trial accounts. About 20 input items per request recommended; see [Get Best Match](https://docs.2050-materials.com/using-the-2050-materials-api/available-endpoints/automated-mapping-get-best-match.md#access-and-limits) |

The rate limit in [Rate limits](#rate-limits) applies to every account. The table gives endpoint names; the full paths, with their trailing slashes, are in [Available Endpoints](#available-endpoints). A call to an endpoint your account can't use returns 401 with an `Error Message`. The message depends on the account, for example `{"Error Message": "User account associated with the token doesn't have access to Product API. Please contact support."}` for a licensed account without the Products licence.

On `get_products` and `get_generic_materials`, a trial account gets at most 5 results, from page 1 only:

* Any `page` other than 1 returns 401 with an `Error Message` that says the account has access to limited products (or materials) in one single page.
* On `get_products`, a trial account may send `page_size`, but still gets at most 5 results.
* On `get_generic_materials`, a trial request with `page_size` returns 400 `{"error": "Invalid query parameters"}`.

#### Get a Developer Token <a href="#get-a-developer-token" id="get-a-developer-token"></a>

For the Open API ([/get\_products\_open\_api](https://app.2050-materials.com/developer/documentation-ui/), [schema.json](https://app.2050-materials.com/developer/schema.json)) please register an account on the [2050 Materials platform](https://app.2050-materials.com/accounts/login/) and generate a token on your [account page](https://app.2050-materials.com/accounts/edit-account/).

{% embed url="<https://www.youtube.com/watch?v=EFjUxIDjB9c>" %}

If you are interested in getting access to the other endpoints, please send us an email at <api@2050-materials.com>.

#### Authenticate your requests <a href="#authenticate-your-requests" id="authenticate-your-requests"></a>

```mermaid
sequenceDiagram
  participant C as Your code
  participant A as app.2050-materials.com
  Note over C: Developer token from your account page
  C->>A: GET /developer/api/token/getapitoken/ with Bearer developer token
  A-->>C: api_token and refresh_token
  C->>A: API call with Bearer api_token
  A-->>C: Data
  Note over C,A: The api_token expires after 24 hours
  C->>A: POST /developer/api/token/refresh/ with Bearer refresh token and body refresh
  A-->>C: New api_token
  Note over C,A: The refresh_token also expires after 24 hours. Then get a new pair with the developer token
```

1. Exchange your developer token for an API token: `GET https://app.2050-materials.com/developer/api/token/getapitoken/` with the header `Authorization: Bearer <developer_token>`. The response is `{"api_token": "...", "refresh_token": "..."}`. The older path `/developer/api/getapitoken/` still works and returns the same response.
2. Send the header `Authorization: Bearer <api_token>` on every API call.
3. API tokens expire after 24 hours. To renew one, call `POST https://app.2050-materials.com/developer/api/token/refresh/` with the header `Authorization: Bearer <refresh_token>` and the JSON body `{"refresh": "<refresh_token>"}`. The response is `{"api_token": "..."}`.
4. The refresh token also expires after 24 hours. After that, call `token/getapitoken/` again with your developer token.

#### Rate limits <a href="#rate-limits" id="rate-limits"></a>

Requests are limited to 10 per second per IP address (bursts up to 50). Exceeding this returns HTTP 429 (Too Many Requests). Trial and free (open-data) accounts also have a limit of 100 calls per hour. Reaching it returns 429. Licensed accounts have no hourly limit.

#### Error responses <a href="#error-responses" id="error-responses"></a>

Check the HTTP status code first, then the key in the JSON body. These are the shapes the endpoints return:

| Status | Body                                                          | When                                                                                                                                                                                                                                                                                                                                                                                   |
| ------ | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 401    | `{"detail": "...", "code": "token_not_valid", ...}`           | The API token has expired or is not valid. Get a new one with `token/refresh/`, or with `token/getapitoken/` once the refresh token has expired too (see [Authenticate your requests](#authenticate-your-requests)). Other keys, such as `messages`, may be absent: branch on `code`.                                                                                                  |
| 401    | `{"detail": "...", "code": "bad_authorization_header"}`       | The `Authorization` header is malformed. Send `Authorization: Bearer <api_token>`.                                                                                                                                                                                                                                                                                                     |
| 401    | `{"detail": "Authentication credentials were not provided."}` | The request has no `Authorization` header.                                                                                                                                                                                                                                                                                                                                             |
| 401    | `{"Error Message": "..."}`                                    | On `token/getapitoken/` and `token/refresh/`: the developer token or the refresh token is not valid or has expired. Call `token/getapitoken/` with your developer token; if that fails too, contact support for a new developer token. On any other endpoint: your account can't use this endpoint or this page (see [Access and limits by endpoint](#access-and-limits-by-endpoint)). |
| 403    | `{"detail": "..."}` or `{"error": "..."}`                     | You asked for a `collection` your account can't access.                                                                                                                                                                                                                                                                                                                                |
| 404    | `{"detail": "Invalid page."}`                                 | `page` is past the last page of results.                                                                                                                                                                                                                                                                                                                                               |
| 404    | `{"Error Message": "..."}`                                    | `get_best_match` could not check your Get Best Match subscription. Contact support.                                                                                                                                                                                                                                                                                                    |
| 429    | `{"Error Message": "..."}`                                    | Your account has reached its hourly limit or its Get Best Match quota.                                                                                                                                                                                                                                                                                                                 |
| 429    | Not JSON                                                      | More than 10 requests per second from your IP address (see [Rate limits](#rate-limits)). Wait and retry.                                                                                                                                                                                                                                                                               |
| 400    | `{"error": "..."}`                                            | A parameter or the request body is not valid. The message says which.                                                                                                                                                                                                                                                                                                                  |
| 400    | `{"<parameter>": "..."}`, one key per invalid parameter       | `get_co2_warming_potential`: a parameter is not valid. A missing required parameter returns `{"Error Message": "... Missing: ..."}` instead. See [Early-Stage Embodied Carbon Model](https://docs.2050-materials.com/using-the-2050-materials-api/available-endpoints/early-stage-embodied-carbon-model.md).                                                                           |
| 400    | `{"page_size": "Page size cannot be more than 200"}`          | `page_size` is over 200.                                                                                                                                                                                                                                                                                                                                                               |

The message text in `detail`, `Error Message` and `error` can change. Do not match on it: use the status code and the key.
