Delete multiple Annotations in a single call

I had a demo script that entered annotations several times a minute and was not aware that these were accumulating in the grafana.db. (I mistakenly thought that the retention policy on my time series db would take care of old entries).

To clean out all this crud, I rolled a compound API call, which will now run for days :upside_down_face:.
Is there a way to DELETE more than a single Annotation (docs show only specification of Id or RangeId)?

Such a method would make the process much more efficient.

Thanks for any pointers,
Best wishes,
Eric

Hi!

I looked a bit into the code and find an undocumented POST /annotations/mass-delete endpoint that accept the following body:

{
  "dashboardId":468,
  "panelId":1
}

I never used it though, do not hesitate to post more questions if it doesn’t work as expected.

Super kind agnestoulet1,

I need to check this some more and see how it works. First tests were good.

It may be that I just start with a fresh grafana.db to loose all that crud.

Great that you found that API call for me.

Brest wishes,
Eric

Hello,

I am facing the same kind of problem where i want to delete a lot of annotation in a quick manner (ideally I would like to delete by “tag” but this is not supported).

I see that you mentioned a delete method with “RangeId” however I have not found mention of such method in the docs … only this one : Annotations HTTP API | Grafana documentation - Do you have any more details on the “RangeID” method ?

Thanks !