# ENV vars not showing up in workflow?

**URL:** <https://discuss.bitrise.io/t/env-vars-not-showing-up-in-workflow/836>\
**Category:** Question & Answer\
**Created:** [February 17, 2017, 8:15pm UTC](https://discuss.bitrise.io/t/env-vars-not-showing-up-in-workflow/836 "2017-02-17T20:15:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kyu](https://avatars.discourse-cdn.com/v4/letter/k/b3f665/32.png) [@kyu](https://discuss.bitrise.io/u/kyu)\
**Post date:** [February 17, 2017, 8:15pm UTC](https://discuss.bitrise.io/t/env-vars-not-showing-up-in-workflow/836/1 "2017-02-17T20:15:22Z")

</div>

Hello!

I’m currently using a curl command to trigger a bitrise build:

```
curl https://www.bitrise.io/app/XXXXXXX/build/start.json \
--data '{"hook_info":{"type":"bitrise","api_token":"XXXXXXXX"},"build_params": {"tag":"XXXXXXXX"},"environments":[{"mapped_to":"SOME_ENV_VAR","value":"1234","is_expand":true}]}'

```

In the workflow that gets kicked off for the resulting build, I have a script step that does this:

```
#!/bin/bash
set -ex

# write your script here
echo "value = $SOME_ENV_VAR"

```

but all I see in the logs are:

```
+ echo 'value = '
value =

```

Why is the SOME\_ENV\_VAR not showing 1234 in the logs when the script step gets run?

Even when I echo the environment vars list with “printenv”, I don’t see it in the logs, either.

From what I understand, these APP ENV vars should be available in the workflows…What exactly am I missing?

---

<div class="post-metadata">

**Author:** ![kyu](https://avatars.discourse-cdn.com/v4/letter/k/b3f665/32.png) [@kyu](https://discuss.bitrise.io/u/kyu)\
**Post date:** [February 17, 2017, 9:05pm UTC](https://discuss.bitrise.io/t/env-vars-not-showing-up-in-workflow/836/2 "2017-02-17T21:05:23Z")

</div>

I had the wrong nesting for the json data I was posting:

It should look like this:

`--data '{"hook_info":{"type":"bitrise","api_token":"XXXXXX"},"build_params":{"tag":"XXXXXXX","environments":[{"mapped_to":"SOME_ENV_VAR","value":"1234","is_expand":true}]}}'`

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [February 18, 2017, 9:21am UTC](https://discuss.bitrise.io/t/env-vars-not-showing-up-in-workflow/836/3 "2017-02-18T09:21:57Z")

</div>

Just for future reference, it’s also worth to mention that you can’t overwrite env vars defined in your config (`bitrise.yml`) with API defined env vars just by specifying the env var through the API call.

If you want to do that please follow this guide:

> [@How to override environment variables through the Build Trigger API](http://discuss.bitrise.io/t/how-to-override-environment-variables-through-the-build-trigger-api/191):
>
> Environment Variables are set (processed) in a specific order. An environment variable processed before another one can’t override the second one, but the second one can use the first one. If you use the [Build Trigger API](http://devcenter.bitrise.io/api/build-trigger) and you specify one-off environment variables as parameters of the build, those will be processed after the Secret Env Vars, but before App Env Vars. This means that simply specifying the same environment variable this way which is also defined in the build configuration (bit…

---

<div class="post-metadata">

**Author:** ![nmwilk](https://avatars.discourse-cdn.com/v4/letter/n/e68b1a/32.png) [@nmwilk](https://discuss.bitrise.io/u/nmwilk)\
**Post date:** [July 21, 2020, 6:37am UTC](https://discuss.bitrise.io/t/env-vars-not-showing-up-in-workflow/836/4 "2020-07-21T06:37:00Z")

</div>

Could we get this added to the docs?

Currently the example is as follows with no mention that it should be a property of build\_params:

```auto
"environments":[
  {"mapped_to":"API_TEST_ENV","value":"This is the test value","is_expand":true},
  {"mapped_to":"HELP_ENV","value":"$HOME variable contains user's home directory path","is_expand":false},
]

```

---

<div class="post-metadata">

**Author:** ![non-binary](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/non-binary/32/2764_2.png) [@non-binary](https://discuss.bitrise.io/u/non-binary)\
**Post date:** [July 23, 2020, 5:26pm UTC](https://discuss.bitrise.io/t/env-vars-not-showing-up-in-workflow/836/5 "2020-07-23T17:26:01Z")

</div>

Hi @nmwilk,

The docs are open source. Please feel free to file a pull request over on [https://github.com/bitrise-io/devcenter](https://github.com/bitrise-io/devcenter).

---

<div class="post-metadata">

**Author:** ![edinson.mejia](https://avatars.discourse-cdn.com/v4/letter/e/c0e974/32.png) [@edinson.mejia](https://discuss.bitrise.io/u/edinson.mejia)\
**Post date:** [September 30, 2020, 6:20am UTC](https://discuss.bitrise.io/t/env-vars-not-showing-up-in-workflow/836/6 "2020-09-30T06:20:54Z")

</div>

It will be good that the documentation clarifies that **environments** should be inside of **build\_params** … I lost a couple of hours just trying to figure out why this didn’t work:

```
{
	"hook_info": {
		"type": "bitrise"
	},
	"build_params": {
		"branch": "the-pr-branch",
		"branch_dest": "master",
		"pull_request_id": 133,
		"skip_git_status_report": "true"
	},
	"environments":[
  		{"mapped_to":"API_TEST_ENV","value":"This is the test value","is_expand":true},
  		{"mapped_to":"HELP_ENV","value":"$HOME variable contains user's home directory path","is_expand":false},
	]
  }

```

It is not really clear from the documentation that it should be:

```
{
	"hook_info": {
		"type": "bitrise"
	},
	"build_params": {
		"branch": "the-pr-branch",
		"branch_dest": "master",
		"pull_request_id": 133,
		"skip_git_status_report": "true",
		"environments":[
  			{"mapped_to":"API_TEST_ENV","value":"This is the test value","is_expand":true},
  			{"mapped_to":"HELP_ENV","value":"$HOME variable contains user's home directory path","is_expand":false},
		]
	}
}
```
