Retention and deletion

How long files and analyses are kept, how to keep them for less time, and what deleting removes.

AirCredit deletes files and analyses automatically when their retention period ends. The retention period of each integration is 30 days from the creation of a file or analysis. The period is currently fixed and cannot be changed.

To keep a single file or analysis for a shorter time, send retention_days when you create it. The value is a whole number of days from 1 up to the integration's period. Without it, the integration's period applies. Other values, such as 0 or 31, return 422 invalid_spec with the pointer /retention_days.

For a file, send retention_days as a form field of the upload. For an analysis, add it to the JSON body. This example keeps both for seven days:

// Keeps a file and its analysis for seven days instead of the integration's 30.
import { Client } from "@aircredit/sdk/partner/v1";

const client = Client.fromEnv();

// Keep the upload for seven days.
const file = await client.createFile("payslip.pdf", { retentionDays: 7 });
console.log(`the file expires at ${file.expires_at}`);

// Keep the analysis for seven days too.
const analysis = await client.createAnalysis({
  files: [file.id],
  retention_days: 7,
  spec: { fields: { net_income: { builtin: "net_salary" } } },
});
console.log(`analysis ${analysis.id} is ${analysis.status}`);

expires_at on the file or analysis says when it expires. It is fixed when the resource is created. An analysis expires no later than the first of its input files to expire. Test files expire 24 hours after upload (Test mode).

What each action does

ActionResult
Cancel an analysisStops the work. The analysis record is kept
Delete a finished analysisRemoves access to its result. Its input files are kept
Delete a fileRemoves access to the file and to every analysis that uses it, and cancels their work in progress
A resource expiresRemoves access as a deletion does. Cleanup follows
Delete an integrationRevokes its keys and removes all its content, including its deletion and idempotency records

An empty 204 confirms that the resource is deleted for the API. The data may still exist at that point. Uploaded files, preview PDFs and all data derived from them are removed in the background. This cleanup has no fixed deadline.

After a deletion

  • Reading a deleted or expired resource of yours returns 410 resource_deleted.
  • Reading an unknown resource, or one that is not yours, returns 404.
  • Deleting a resource that is already deleted returns an empty 204 again.
  • Deleting an expired resource can return 410.

AirCredit keeps a record of each create request after its resource is deleted, until the integration is deleted. A retry with the same Idempotency-Key and body then returns 410. The same key with a different body still returns 409 idempotency_conflict (Repeated requests).

Data with its own lifetime

Usage and operational data have their own retention periods. Billing history is kept after files, analyses and integrations are deleted. Delivery logs, audit records, backups and copies at our service providers do not follow expires_at alone. This API promises no deadline for erasing backups or copies at service providers.

On this page