# About API Token

**URL:** <https://community.influxdata.com/t/about-api-token/34200>\
**Category:** Systems\
**Tags:** telegraf, influxdb-cloud-2-0\
**Created:** [May 13, 2024, 5:11am UTC](https://community.influxdata.com/t/about-api-token/34200 "2024-05-13T05:11:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sin\_356](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/sin_356/32/15567_2.png) [@sin\_356](https://community.influxdata.com/u/sin_356)\
**Post date:** [May 13, 2024, 5:11am UTC](https://community.influxdata.com/t/about-api-token/34200/1 "2024-05-13T05:11:40Z")

</div>

Hi i have a genuine question  
like 1-2 weeks ago i make literally basic project to how influxdb work and make sure my sensor can gather data and put it in influx

my question is

```auto
...
urls = ["https://us-east-1-1.aws.cloud2.influxdata.com"]
token = "<Token>"
...

```

in this snippet of whole telegraf configuration the first time i try to ran the telegraf config with actual API token put in the token, it said this error in shells:

```auto
Error getting HTTP config. Retry 0 of 3 in 10s. Status=401

```

but after i make an environment of it in my computer without changing my telegraf config, it suddenly worked. my log running, my data succesfully sent in my database is there a reasons why my computer is set in that ways?  
thx

---

<div class="post-metadata">

**Author:** ![scott](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/scott/32/16492_2.png) [@scott](https://community.influxdata.com/u/scott)\
**Post date:** [May 13, 2024, 2:47pm UTC](https://community.influxdata.com/t/about-api-token/34200/2 "2024-05-13T14:47:14Z")

</div>

There are a few things that could explain this:

- Was this a brand new token you created moments before starting Telegraf? Depending on the version of InfluxDB your using, there can actually be a delay between when a token is created vs when it’s registered and usable.

- There possible could have been an extra whitespace in your token string literal or something similar that wasn’t included when you added it as an environment variable.

---

<div class="post-metadata">

**Author:** ![sin\_356](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/sin_356/32/15567_2.png) [@sin\_356](https://community.influxdata.com/u/sin_356)\
**Post date:** [May 13, 2024, 3:16pm UTC](https://community.influxdata.com/t/about-api-token/34200/3 "2024-05-13T15:16:32Z")

</div>

> [@scott](#):
>
> Was this a brand new token you created moments before starting Telegraf

The answer is no? This token already up like 2-3 days. Everytime i need to activate my telegraf i always do this first:

1. Check my local host ip (its always change 1 numbers randomly) and if changed i renew my config
2. Add new environment for token just for my telegraf to function

> [@scott](#):
>
> Depending on the version of InfluxDB your using

Im using influxdb cloudless

> [@scott](#):
>
> There possible could have been an extra whitespace in your token string literal or something similar that wasn’t included when you added it as an environment variable.

The funny thing is if i do it like this

```auto
Token=$env:myToken

```

The system gonna tell is 401 unauthorized in the telegraf log
