I found that there’s an API endpoint to delete build caches in the documentation. https://circleci.com/docs/api/v1-reference/#clear-cache. The top of the document mentions that it supports both 1.0 and 2.0, however as caches are immutable in 2.0 I suspect that it’s a generic statement and the build cache section needs updating to state that it only applies to 1.0.
My question, however, is how can I retrieve a list of all the cache keys for a specific project? Ideally with when it was created too. Hoping for maybe an undocumented response, a GET request on that same endpoint didn’t return a result. Any other ways to achieve this other than iterating through all build logs looking for the entries where a cache was successfully saved? Which, I don’t even know is possible yet, and would very much be the long way around.