# "Failed to export batch code" error

**URL:** <https://community.dynatrace.com/t/failed-to-export-batch-code-error/42769>\
**Category:** OpenTelemetry\
**Tags:** integrations, opentelemetry\
**Created:** [November 22, 2023, 4:35am UTC](https://community.dynatrace.com/t/failed-to-export-batch-code-error/42769 "2023-11-22T04:35:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anki1212](https://avatars.discourse-cdn.com/v4/letter/a/e480ec/32.png) [@anki1212](https://community.dynatrace.com/u/anki1212)\
**Post date:** [November 22, 2023, 4:35am UTC](https://community.dynatrace.com/t/failed-to-export-batch-code-error/42769/1 "2023-11-22T04:35:02Z")

</div>

Failed to export batch code: 401, reason: {“error”:{“code”:401,“message”:“Authentication required”,“details”:{“errorRef”:“ae8f7e02-91a2-49de-8283-93fd9a6e3db2”,“traceId”:“209a419afdc425d9d480e35e7719bac3”}}}

why is this error occurring? please update. I include by a token with opentelementary scopes…

---

<div class="post-metadata">

**Author:** ![RazTN7](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/raztn7/32/10208_2.png) [@RazTN7](https://community.dynatrace.com/u/RazTN7)\
**Post date:** [November 22, 2023, 6:04am UTC](https://community.dynatrace.com/t/failed-to-export-batch-code-error/42769/2 "2023-11-22T06:04:16Z")

</div>

Hello&nbsp;[@anki1212](https://community.dynatrace.com/user/69112)&nbsp;,

From the error code it seems there is access issue. have you also included Ingest Metrics v2,&nbsp;Read metrics v2,&nbsp; Ingest events v2 & Ingest logs v2 along with&nbsp;opentelementary in scope.

If not create new with all enabled and see if it is accessible.

Cheers!

RN

---

<div class="post-metadata">

**Author:** ![anki1212](https://avatars.discourse-cdn.com/v4/letter/a/e480ec/32.png) [@anki1212](https://community.dynatrace.com/u/anki1212)\
**Post date:** [November 22, 2023, 9:34am UTC](https://community.dynatrace.com/t/failed-to-export-batch-code-error/42769/3 "2023-11-22T09:34:01Z")

</div>

i did try but the same error occurred. I used to follow the same steps given by you. I am using the access token. any following the step that i am using please check this are correct ..

export OTEL\_EXPORTER\_OTLP\_ENDPOINT=https://{environmentid}.apps.dynatrace.com/  
export OTEL\_EXPORTER\_OTLP\_HEADERS=Authorization=\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

export OTEL\_EXPORTER\_OTLP\_PROTOCOL=xxxxxxxxxxxxxx

export OTEL\_SERVICE\_NAME=“xxxxxxxxxxxx”

~/.local/bin/opentelemetry-instrument pm2 start api.py --interpreter python3.8

please check.

---

<div class="post-metadata">

**Author:** ![anki1212](https://avatars.discourse-cdn.com/v4/letter/a/e480ec/32.png) [@anki1212](https://community.dynatrace.com/u/anki1212)\
**Post date:** [November 24, 2023, 12:15pm UTC](https://community.dynatrace.com/t/failed-to-export-batch-code-error/42769/4 "2023-11-24T12:15:47Z")

</div>

please update tomorrow my trial version will end

---

<div class="post-metadata">

**Author:** ![RazTN7](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/raztn7/32/10208_2.png) [@RazTN7](https://community.dynatrace.com/u/RazTN7)\
**Post date:** [November 24, 2023, 12:35pm UTC](https://community.dynatrace.com/t/failed-to-export-batch-code-error/42769/5 "2023-11-24T12:35:37Z")

</div>

Can you please provide more details.

---

<div class="post-metadata">

**Author:** ![anki1212](https://avatars.discourse-cdn.com/v4/letter/a/e480ec/32.png) [@anki1212](https://community.dynatrace.com/u/anki1212)\
**Post date:** [November 24, 2023, 1:05pm UTC](https://community.dynatrace.com/t/failed-to-export-batch-code-error/42769/6 "2023-11-24T13:05:26Z")

</div>

I am implementing this in the python 3.8 version. please check
