# Issues with API on adding an environment variable

**URL:** <https://answers.netlify.com/t/issues-with-api-on-adding-an-environment-variable/94963>\
**Category:** Support\
**Tags:** netlify-api\
**Created:** [June 21, 2023, 12:20pm UTC](https://answers.netlify.com/t/issues-with-api-on-adding-an-environment-variable/94963 "2023-06-21T12:20:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fabioped](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/fabioped/32/51946_2.png) [@fabioped](https://answers.netlify.com/u/fabioped)\
**Post date:** [June 21, 2023, 12:20pm UTC](https://answers.netlify.com/t/issues-with-api-on-adding-an-environment-variable/94963/1 "2023-06-21T12:20:11Z")

</div>

It seems the API for creating and updating environment variables has issues.

The main issue at the moment is that sending a `site_id` is not really understood by the servers, so all env vars are set at the team level.

 ![image](https://global.discourse-cdn.com/netlify/original/3X/c/0/c0159049a561b78e1edf1c9d1d9a56d54fd36837.png)

The docs clearly state the site\_id needs to go as query parameter, but doesn’t seem to work.

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [June 25, 2023, 11:01am UTC](https://answers.netlify.com/t/issues-with-api-on-adding-an-environment-variable/94963/2 "2023-06-25T11:01:04Z")

</div>

I’m not sure that body is valid. It should be something like:

```auto
{
  "key": "SOMETHING_COOL",
  "values": [{
    "context": "all",
    "value": "Something Something"
  }]
}

```

When reporting problems with API, if you mention the response you receive from the API, it would be useful.
