I am using Commcare APIs to get data from Commcare to google sheets via python script. It has been working fine for the past 6 months or so, but now suddenly it has stopped happening and showing the following error.
Error fetching data: 401 Client Error: Unauthorized for url "URL and FormName"
Is their any changes in the Commcare API access policies? Or is it some temporary glitch?
Welcome to the CommCare Forum! My first thought is that your API key has expired. You can check this in CommCare HQ by going to the gear icon on the top right of the page and choosing My Account Settings. From there, use the left hand menu to navigate to API Keys and check the status.
It sounds frustrating when something that has worked smoothly for months suddenly breaks—especially with a 401 Unauthorized error. While I can’t speak directly to Commcare’s internal policy changes, this kind of issue often relates to expired API keys, revoked access tokens, or permission changes on the account. Double-checking your authentication credentials would be a good first step. It reminds me of how critical consistent maintenance is—just like using a scale inhibitor for membranes to ensure smooth operation in water filtration systems, maintaining API integrations requires ongoing attention to avoid performance issues. Hopefully, this is just a quick fix on the auth side!