Introduction
When integrating with the API of Customer.io, encountering a 401 unauthorized error can be a common but puzzling issue for some of our users, especially those located in the EU data center. This post will walk you through the steps to resolve this issue.
Problem
The problem occurs when sending a request to the api.customer.io/v1/segments address with the API key created by the user. This key is sent with the Bearer prefix under the Authorization heading in the headers section, which results in triggering a 401 unauthorized error.
Solution
To rectify this problem, it is essential to use the EU API endpoints for the API request if your account is based in the EU data center. It is equally important to ensure that the Tracking API keys from the workspace settings which are Basic Auth are in use and not the App API keys.
You may find the specific API endpoint details at our document here: Specific API endpoint document. For more clarity on the authentication process refer to: Authentication document