A 401 error from OpenTelemetry when using Phoenix usually means the Phoenix API key is missing or not being sent correctly, even if you believe it is set. You must ensure the PHOENIX_API_KEY environment variable is set and, if you are using manual OpenTelemetry setup, that the API key is attached as a header in your exporter configuration. See the relevant documentation and examples <https://docs.arize.com/phoenix/deployment/authentication#sending-openinference-traces|here> and <https://github.com/Arize-ai/phoenix/issues/5332|here>.
If you are using the phoenix.otel.register helper, setting PHOENIX_API_KEY as an environment variable is usually sufficient. For manual OpenTelemetry setup, you must explicitly add the API key to the headers. Would you like a code example for both approaches?
Sources:
- <https://github.com/Arize-ai/phoenix/issues/5332|GitHub Issue: Manually Instrumented "Failed to export batch code: 401, reason: Invalid token">