# Missing \`environment\` in DBT Cloud API responses

**URL:** https://discourse.getdbt.com/t/missing-environment-in-dbt-cloud-api-responses/9099
**Category:** Help
**Tags:** dbt-cloud
**Created:** [July 11, 2023, 10:04pm UTC](https://discourse.getdbt.com/t/missing-environment-in-dbt-cloud-api-responses/9099 "2023-07-11T22:04:53Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mroy](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/mroy/32/3094_2.png) [@mroy](https://discourse.getdbt.com/u/mroy)
#### Post date: [July 11, 2023, 10:04pm UTC](https://discourse.getdbt.com/t/missing-environment-in-dbt-cloud-api-responses/9099/1 "2023-07-11T22:04:53Z")

</div>

When calling certain API endpoints, such as `/jobs/{job_id}/run/` or `/runs/{run_id}`, the `environment` key in the response always seems `null`.

This then requires us to send a separate request to `/environments/{environment_id}` to retrieve the environment name in every run of all our workflows.

If the `environment` were present in the API responses, an another API call wouldn’t be necessary.

![image](https://us1.discourse-cdn.com/flex020/uploads/getdbt/original/2X/f/f260cf37e10c63379d205114fa5dbe737ded7d50.png)

Is this intentional, or something that could be fixed?

---

<div class="post-metadata">

### Author: ![mroy](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/mroy/32/3094_2.png) [@mroy](https://discourse.getdbt.com/u/mroy)
#### Post date: [September 14, 2023, 5:23am UTC](https://discourse.getdbt.com/t/missing-environment-in-dbt-cloud-api-responses/9099/2 "2023-09-14T05:23:46Z")

</div>

Found the answer to this [in the legacy API documentation](https://docs.getdbt.com/dbt-cloud/api-v2-legacy#tag/Runs/operation/getRunById): we have to use the `include_related` parameter, like this: `include_related=["job","environment","run_steps","trigger",...]`. Unfortunately, this parameter is not documented [in the new API documentation](https://docs.getdbt.com/dbt-cloud/api-v2#/operations/Retrieve%20Run). ☹

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex020/uploads/getdbt/original/1X/a7a7ca1fe379aaf90952b0e13118a817babcd14f.png) [@system](https://discourse.getdbt.com/u/system)
#### Post date: [February 18, 2024, 9:35pm UTC](https://discourse.getdbt.com/t/missing-environment-in-dbt-cloud-api-responses/9099/3 "2024-02-18T21:35:57Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
