How to delete pipelines when removing a branch in gitlab?

Hello, is there a way to delete pipelines of certain branch when removing the branch in gitlab?

As I know there is API but using it I can remove only one by one.

curl -H "PRIVATE-TOKEN: " -XDELETE  "https://gitlab.com/api/v4/projects/1834585768/pipelines/1484564631637"

But it’s not convenient. Maybe there is another way to automate deleting?