Delete build cache entries of a CI runner pool
const url = 'https://dashboard.quantcdn.io/api/v3/organizations/test-org/resources/cr-0123456789abcdef/cache';const options = { method: 'DELETE', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"repoId":123456,"ref":"refs/heads/main","version":"a1b2c3","key":"node-cache-Linux-x64-npm-abc"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request DELETE \ --url https://dashboard.quantcdn.io/api/v3/organizations/test-org/resources/cr-0123456789abcdef/cache \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "repoId": 123456, "ref": "refs/heads/main", "version": "a1b2c3", "key": "node-cache-Linux-x64-npm-abc" }'Deletes the part of the pool’s build cache that the body names: one entry (repoId, ref, version and key), one version of a ref (repoId, ref, version), one ref (repoId, ref), one repository (repoId) or, with exactly {“all”: true}, the whole cache. A missing or empty body is refused. Only the named scope is deleted; a delete is permanent, and a later job saves a new entry. A large delete stops after about 12 seconds and returns complete false with what it deleted so far; send the same request again until complete is true. complete false means: send the same request again. If a call returns complete false with deletedEntries 0, stop and try again later, because a storage call failed, timed out or refused objects. After a 502 the delete may still be running on the platform; the request is idempotent, so a client can send the same request again.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The organisation ID
Example
test-orgThe CI runner pool resource ID
Example
cr-0123456789abcdefRequest Bodyrequired
Section titled “Request Bodyrequired”The scope to delete: either {“all”: true} alone (the whole cache of the pool), or repoId with optionally ref, version and key, where a field needs every field before it (repoId, ref, version, key). An empty object is refused.
object
True clears the whole cache of the pool. Must be the only field.
GitHub repository id. A digit string is also accepted.
Git ref; starts with refs/, a valid git ref name without %.
The exact cache key. Deletes only that entry, not keys that start with it.
Examples
One entry
{ "repoId": 123456, "ref": "refs/heads/main", "version": "a1b2c3", "key": "node-cache-Linux-x64-npm-abc"}One branch
{ "repoId": 123456, "ref": "refs/heads/main"}One repository
{ "repoId": 123456}The whole cache
{ "all": true}Responses
Section titled “Responses”Deleted
object
False when the delete stopped at its time limit (about 12 seconds), a storage call failed or timed out, or storage refused some objects. false means: send the same request again until it is true. If a call returns false with deletedEntries 0, stop and try again later, because a storage call failed, timed out or refused objects.
Examplegenerated
{ "deletedEntries": 1, "deletedBytes": 1, "complete": true}The platform refused the scope
The delete_applications permission and the cloud:write scope are required
Resource not found, the resource is not a CI runner pool, or the organisation does not have CI runners
The body is missing, empty or not a JSON object; all is not exactly true or is sent with another field; the body has an unknown field, an invalid field, or a field without the fields it needs (key needs repoId, ref and version; version needs repoId and ref; ref needs repoId)
The build cache service is unavailable
