Deleting snapshots

Hi,

As there is no way to disable snapshot feature in grafana, for security reasons I was looking for deleting snapshots using APIs.

However, I see that for using delete API, we need the delete key . Can you please advise

  1. If I create the snapshot from UI, how do I get the delete key for that snapshot?
  2. Can I delete all snapshots in bulk using API ?

Thanks

There are 2 api endpoints for deleting snapshots, one that uses the deleteKey and doesn’t require authentication, and another authenticated endpoint that can delete using the snapshot key.

You can get a list of snapshots, then delete each one using its key.

Thanks! So there is no API that can delete all snapshots in bulk ?
something like - DELETE localhost:3000/api/snapshots/*

Also, could you please confirm that using authenticated endpoint as admin, I can delete snapshots created by any user ?

Bulk deletion is not supported, if you are an admin you can delete snapshots from any user.

Thanks a lot. Is there any release plan to disable snapshot feature in UI?

Not that I know of, you could block the api route in your reverse proxy, or use this PR that added support for disabling external snapshots as a guide to add another config variable to control local snapshots.

Could you please elaborate on how this can be done ?

The front-end saves snapshots by POSTing to the api route /api/snapshots, so if you add a rule in your nginx/apache/etc config that just denies all POSTs to /api/snapshots then users will not be able to save snapshots.