# Why does ActiveGate return a 401 Unauthorized error?

**URL:** <https://community.dynatrace.com/t/why-does-activegate-return-a-401-unauthorized-error/42796>\
**Category:** Troubleshooting\
**Tags:** activegate, opentelemetry\
**Created:** [November 28, 2023, 10:30pm UTC](https://community.dynatrace.com/t/why-does-activegate-return-a-401-unauthorized-error/42796 "2023-11-28T22:30:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexander\_dt](https://avatars.discourse-cdn.com/v4/letter/a/5daacb/32.png) [@alexander\_dt](https://community.dynatrace.com/u/alexander_dt)\
**Post date:** [November 28, 2023, 10:30pm UTC](https://community.dynatrace.com/t/why-does-activegate-return-a-401-unauthorized-error/42796/1 "2023-11-28T22:30:00Z")

</div>

When you send OTLP requests to ActiveGate and receive a 401 error, this indicates that the request either did not contain an authentication token or contained an invalid token value.

Make sure your request contains the HTTP&nbsp;`Authorization`&nbsp;header with&nbsp;`Api-Token [TOKEN-HERE]`&nbsp;as the value. For example:

```markup
Authorization: Api-Token dt0c01.abc123.abcdefjhij1234567890

```

where&nbsp;`dt0c01.abc123.abcdefjhij1234567890`&nbsp;is an example token value.

For details, see&nbsp;[Dynatrace API - Tokens and authentication](https://docs.dynatrace.com/docs/dynatrace-api/basics/dynatrace-api-authentication).

SpoilerIf you configure the token using the&nbsp;`OTEL_EXPORTER_OTLP_HEADERS`&nbsp;environment variable, make sure its value is&nbsp;[percent-encoded](https://github.com/w3c/baggage/blob/main/baggage/HTTP_HEADER_FORMAT.md#value).
