Johnyb
Johnyb

Reputation: 1316

Permission denied creating user via HTTP api grafana

I am trying to create new user using grafana HTTP rest api:

I am doing HTTP post to https://adminTest:adminTest@grafanaUrl:8086/api/admin/users with body:

{
  "name":"User",
  "email":"[email protected]",
  "login":"user",
  "password":"userpassword"
}

However i get:

{
    "message": "Permission denied"
}

What are the right steps to create user with HTTP api? The adminTest account is admin account in grafana,

Upvotes: 0

Views: 1869

Answers (1)

dnnshssm
dnnshssm

Reputation: 1305

To use the HTTP Admin API, a user has to be a Grafana server admin. The term Grafana admin can therefore be a bit misleading.

To make a user a Grafana server admin, you have to be one yourself. From the docs:

To assign or remove Grafana administrator privileges:

  1. Sign in to Grafana as a server administrator.
  2. Hover your cursor over the Server Admin (shield) icon until a menu appears, and click Users.
  3. Click a user.
  4. In the Grafana Admin section, click Change.
  5. Click Yes or No, depending on whether or not you want this user to have the Grafana server administrator role.
  6. Click Change.

Upvotes: 3

Related Questions