Error uploading dashboard to through API

Hi! I’m trying to upload a dashboard to but I’m getting an error, this is the command i use:

curl -X POST -H "Authorization: Bearer $GRAFANA_API_KEY" -H "Content-Type: application/json" -d @dashboard.json

and this is the response i get:

  "code": "InvalidArgument",
  "message": "Unexpected parameter: dashboard"

The format of the son file follows the schema described here

Any help is very appreciated, thanks!

That is dashboard model for dashboard API. But you need different model, which you can get from the UI only (export dashboard from your browser). You can compare these 2 models and you will see difference.

Thanks a lot for your response @jangaraj i also tried with the exported model and got a similar error:

  "code": "InvalidArgument",
  "message": "Unexpected parameter: __inputs"

How did you know that URL is for dashboard uploading? IMHO you are mixing Grafana (product) HTTP API with (web portal) API.

Why you don’t use UI, when you want to publish your dashboard?

Yeah, that is possible, I verified that a GET to gives me a json with the complete list of dashboards, same as the dashboards list in the browser. Also, that queries to /api/dashboards require proper authentication and the response looks meaningful. But I haven’t found anywhere saying that this is possible, it would be great if someone in the community can clarify.

My goal is to host the dashboard json on a repo and upload it in the final stage of the CI/CD pipeline.

1 Like

I’m also interested in the same process.
We want to publish our dashboard after a CICD process. (internal review, archive and public publication to grafana hub and so on…).
I still didn’t find any information about the url and the method to do this while there are api keys…