Free tier cleanup: report or delete
const url = 'https://beta-api.plune.ai/v1/admin/retention';const options = { method: 'POST', headers: { cookie: 'plune_session=<plune_session>', 'Content-Type': 'application/json' }, body: '{"dryRun":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://beta-api.plune.ai/v1/admin/retention \ --header 'Content-Type: application/json' \ --cookie plune_session=<plune_session> \ --data '{ "dryRun": true }'The Free tier keeps 30 days of runs and 200 000 results per account (#1049). A run of a Free account is deleted for good when it is older than 30 days by started_at, or when it and the runs newer than it, in all the account’s projects, add up to more than 200 000 results. The newest run and any run still going are kept, and an account on a paid tier (also in its grace, or switched off by hand) is never touched. The cleanup holds an owner only while a letter can still go (#2111): an account or company whose paid tier ended is held, and counted in held.waiting, until a letter for the date of that end has gone to a live owner, or 3 days after that date; past that, or with nobody left to write to, it is cleaned without a letter and counted in unlettered. One that never had a paid tier owes none. dryRun: true deletes nothing and answers per project how many runs, results and bytes of files a pass would remove. dryRun: false deletes, through the cascade the Bin and the nightly purge share, and writes one summary row to each project’s log; it is refused with 409 retention_not_enabled until the operator sets TIER_RETENTION_ENFORCE=true. The worker runs the same pass every night at 03:00 UTC, as a report only until that switch is on. The owner’s session or an admin token with the retention door; anyone else is told 404. Ten a minute.
Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ”object
True: report only. false: delete (409 until TIER_RETENTION_ENFORCE=true)
Examples
The report
{ "dryRun": true}Responses
Section titled “ Responses ”What the pass would delete (mode: report) or deleted (mode: delete)
object
Free accounts the pass went through; the held ones are not among them, the unlettered ones are
Only projects with something to remove
object
Files of those results, in the database and in the customer’s bucket
Runs older than 30 days
Runs over the 200 000-result limit
object
Free accounts and companies left alone this pass, in a report as in a deletion, because their paid tier (or a switch-off) ended and the letter for that date can still go (#2111): nothing of theirs is in projects or totals
object
No letter for the date of that end has gone to a live owner or manager yet, and one still can: a letter goes until 3 days after that date. The nightly letter opens it; past the 3 days the owner is no longer held (see unlettered)
Owners the pass went through (in a report, would go through) without a letter for the date of their end: nobody is left to write to (the account, or every owner and manager of the company, is in the Bin), or the 3 days a letter can still go have passed with none sent. They are counted in accounts and their projects are in projects
Example
{ "mode": "report", "accounts": 3, "projects": [ { "projectId": "proj_1", "runs": 12, "results": 5400, "fileBytes": 10485760, "byAge": 9, "byLimit": 3 } ], "totals": { "runs": 12, "results": 5400, "fileBytes": 10485760 }, "held": { "waiting": 1 }, "unlettered": 0}The body is not valid
object
Example generated
{ "error": "example"}An admin token without the retention door (code: door_not_granted)
object
Example generated
{ "error": "example"}Not found
object
Example generated
{ "error": "example"}dryRun: false while deletion is not switched on (code: retention_not_enabled)
object
Example generated
{ "error": "example"}Rate-limited: the per-route throttle, or the per-minute request limit of the plan an API token counts by (#1442; the body names the plan, #2092). Retry-After carries the seconds until the window rolls over.
object
Example generated
{ "error": "example"}Headers
Section titled “Headers ”Seconds until the window rolls over