[SOLVED] Addressing Unauthorized Access (401) while utilizing APIs through Python

I’m getting a 401 error (unauthorized access) trying to execute code samples from Coda’s API reference

Here is an example:

I used my coda.io/account to create the API keys.

What I have tried so far:

  • Recreate the API key with or without restrictions

  • Same output running the same code on different environments (i.e., Jupyter Lab or Python CLI console).

  • I’m the owner of the document I’m trying to access. Plus, I can access the URI from my browser and correctly see the output.

Other information

  • I’m using Python 3.11.2 on Ubuntu 23.04

I might be overlooking something. I’m seeking your suggestions on the best way to identify and resolve potential issues. Any ideas are welcome.

You might need to add the word Bearer before your token in the authorization header

1 Like

Thanks, @Scott_Collier-Weir !!!

I knew it that should be something small but a significant detail🤦🏽‍♂️

If someone arrives here with the same problem, this is how to fix that.

image

2 Likes

You got it! If you need any more help with Codas api please just reach out!