You can also reset a Grafana user’s password from the Grafana users tab of the Scaleway console > Click the «See more Icon» icon next to the relevant Grafana user > Click Generate password > Generate new password.
Reviewed on 19 June 2024 • Published on 03 April 2023
This page shows you how to reset your Grafana user’s password through the Scaleway API.
Before you start
To complete the actions presented below, you must have:
- A Scaleway account logged into the console
- Created an API key with sufficient IAM permissions to perform the actions described on this page
- Installed curl
Open a terminal and paste the following command to retrieve your Grafana user ID:
curl --request GET \--url 'http://api.scaleway.com/cockpit/v1beta1/grafana-users?project_id=<SCW_PROJECT_ID>' \--header 'X-Auth-Token: $SCW_SECRET_KEY'
An output with a list of all Grafana users associated with your Cockpit and their IDs should display:
{"total_count": 3,"grafana_users": [{"id": 74,"login": "user1","role": "editor","password": ""},{"id": 8,"login": "user2","role": "editor","password": ""},{"id": 41,"login": "user3","role": "editor","password": ""}]}
Paste the following command to reset the password of the desired Grafana user. Make sure that you replace {grafana_user_id}
with the ID of the relevant Grafana user.
curl -X POST \-H "X-Auth-Token: $SCW_SECRET_KEY" \-H "Content-Type: application/json" \-d '{"project_id":"string"}' \"https://api.scaleway.com/cockpit/v1beta1/grafana-users/{grafana_user_id}/reset-password"
The output displays a new password for your Grafana user.
Important