# How to set API KEY and Service Endpoint through environment variables for IBM Watson "Language Translator" node?

**URL:** <https://discourse.nodered.org/t/how-to-set-api-key-and-service-endpoint-through-environment-variables-for-ibm-watson-language-translator-node/29116>\
**Category:** General\
**Created:** [28 June 2020 15:17 UTC](https://discourse.nodered.org/t/how-to-set-api-key-and-service-endpoint-through-environment-variables-for-ibm-watson-language-translator-node/29116 "2020-06-28T15:17:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![janvda](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/janvda/32/234_2.png) [@janvda](https://discourse.nodered.org/u/janvda)\
**Post date:** [28 June 2020 15:17 UTC](https://discourse.nodered.org/t/how-to-set-api-key-and-service-endpoint-through-environment-variables-for-ibm-watson-language-translator-node/29116/1 "2020-06-28T15:17:24Z")

</div>

I would like to keep my IBM Watson credentials outside the node-red flow by setting them in environment variables.

The problem is that the watson translator node is not substituting `${XXX}` by the contents of the environment variable `XXX`.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/7/17ec82fa6c25d2eec1ea8fcfdb12f470bf2f36c3.png)

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [28 June 2020 15:47 UTC](https://discourse.nodered.org/t/how-to-set-api-key-and-service-endpoint-through-environment-variables-for-ibm-watson-language-translator-node/29116/2 "2020-06-28T15:47:11Z")

</div>

can you double check there are no whitespace or space characters before the $ and after the } and that the environment variable actually exists

---

<div class="post-metadata">

**Author:** ![janvda](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/janvda/32/234_2.png) [@janvda](https://discourse.nodered.org/u/janvda)\
**Post date:** [28 June 2020 16:29 UTC](https://discourse.nodered.org/t/how-to-set-api-key-and-service-endpoint-through-environment-variables-for-ibm-watson-language-translator-node/29116/3 "2020-06-28T16:29:31Z")

</div>

> [@dceejay](#):
>
> ... and that the environment variable actually exists

Thanks a lot: that was indeed the first issue: It didn't exist.

The second issue I encountered when defining it: was that I had defined it as follows in my env file:

```auto
WATSON_LANGUAGE_TRANSLATOR_APIKEY="gYHe7_-....k_"

```

which is also not correct - it should be defined without the double quotes as follows:

```auto
WATSON_LANGUAGE_TRANSLATOR_APIKEY=gYHe7_-....k_

```

So when removing the double quotes in my env file it worked as a charm.

Thanks a lot !

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [12 July 2020 16:29 UTC](https://discourse.nodered.org/t/how-to-set-api-key-and-service-endpoint-through-environment-variables-for-ibm-watson-language-translator-node/29116/4 "2020-07-12T16:29:34Z")

</div>

Closed on 12 July 2020 16:29 UTC

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