# Lifecycle & Expiry

Source: https://staging-docs.aiand.com/api/file-lifecycle/

Uploaded files have a finite lifetime. ai& cleans up expired files automatically and lets you delete files on demand.

## Default retention

Files are retained for **30 days** after upload by default. You can set a shorter expiry on individual uploads where the SDK supports it, or delete files explicitly at any time.

## Manual deletion

```bash
curl -X DELETE https://api.aiand.com/v1/files/file-abc123 \
  -H "Authorization: Bearer sk-..."
```

The file becomes inaccessible immediately. A subsequent `GET` returns `404`.

## Automatic cleanup

Once a file passes its `expires_at`, it is removed automatically — bytes and metadata both. Subsequent reads return `404`.

## What happens to references

Once a file is deleted, any chat request that references its `file_id` returns an error. Deletion is not reversible — re-upload the file to use it again.

<Aside type="caution">
  The 30-day retention is intended for active inference workloads, not long-term storage. Persist files you need to keep elsewhere.
</Aside>
