Site API / API key #1460
-
Past Issues Searched
Issue is a Bug Report
Describe the bugI created my API keys in the Plausible dashboard. I'm using the latest version 1.4.0. After created my keys, I can access to Stats API but not Site API I have {
"error": "Invalid API key. Please make sure you're using a valid API key with access to the resource you've requested."
} Expected behaviorAccess to the Site API ScreenshotsEnvironment- OS: My pc is on windows, server is on Linux Ubuntu
- Browser: Chrome
- Browser Version: 95.0.4638.69 (Official Build) (64-bit) |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 10 replies
-
Only API keys for the Stats API can be created through the UI. We currently provision keys for the Sites API manually. It is possible to insert an API key directly in to the database. It needs to have scope |
Beta Was this translation helpful? Give feedback.
-
@evanlegamer do you have any references for how you generated the key? does it have to be generated with the SECRET_KEY_BASE that is set through the env? Also not sure of the key_prefix if that needs to be set |
Beta Was this translation helpful? Give feedback.
-
Okay, I had this problem too and managed to solve it using the pointers in this issue, but writing the correct query took a little time, so hopefully I can help someone else to make it quicker. Assuming you want to add the
Alternatively, if you want to use an api key only for site provisioning (and remove the default access to the stats API), you can use the query by evanlegamer #1460 (reply in thread) :
If you're unsure how/where to run this query, here is a oneliner for the default self-hosted setup. For this to work, you need to find the container ID or name of the docker container that is running Plausible's postgres database. In my setup it's called
|
Beta Was this translation helpful? Give feedback.
-
It's been nearly 3 years and the api access is still terrible. Why ? |
Beta Was this translation helpful? Give feedback.
-
Yeah it's really confusing to me why we're having to modify the database directly in order to create an API key for provisioning. Even worse, it's really surely just a case of having a few checkboxes in order to specify the scopes for each key? I'm enjoying Plausible so far, but this was disappointing and, honestly, far too lacklustre compared to everything else you've built here. |
Beta Was this translation helpful? Give feedback.
-
/api/v1/sites takes me to 404. |
Beta Was this translation helpful? Give feedback.
Only API keys for the Stats API can be created through the UI. We currently provision keys for the Sites API manually.
It is possible to insert an API key directly in to the database. It needs to have scope
sites:provision:*