# Data and deletion

> What Cairnflow Cloud stores for an environment, how long it keeps it, and what deleting an environment does.

Source: https://cairnflow.dev/docs/cloud/data-and-deletion

:::caution[Early-access waitlist]
Cairnflow Cloud is not open yet — [join the waitlist](/#pricing) to hear when early access opens.
This page describes the hosted service as it is built for its Beta, and details may change before
it opens. To run cairnflow today, [host it yourself](/docs/self-hosting).
:::

This is the Beta data policy.

## What is stored

For each environment:

- the journal of every invocation: inputs, step results, outputs, errors;
- the state of virtual objects and workflows, and their durable promises;
- schedules;
- durable streams, logs and trace spans of invocations;
- artifacts stored with `ctx.artifact`;
- archives of finished invocations;
- an audit log of who did what.

API keys are stored as hashes: a secret cannot be shown again.

Everything an environment stores sits on the cell's object storage, scoped to that environment.
You cannot bring your own bucket during the Beta.

:::caution
Step results and state are kept in the journal, and the journal is visible in the console to
anyone with access to the environment. Do not return secrets (tokens, API keys) from `ctx.run` or
store them in state: keep them in your service's environment variables or secret manager.
:::

## How long it stays

- **Finished invocations** are removed 7 days after they end. Before removal, each one is written
  to the archive; the console's **Archive** page reads it back. Archives do not expire yet.
- **Purging an invocation** yourself (console or `POST /invocations/{id}/purge`) removes its
  journal, status and idempotency key at once, after archiving it; purging a workflow run also
  removes that workflow's state and promises. Only ended invocations can be purged.
- **Deleted items** sit in the cell's trash for 7 days before they are removed for good, so a
  mistake can be undone.
- **Backups** copy each cell to a second storage provider on a schedule. Each copy expires about
  45 days after it is made.

Retention is also the window of idempotency keys: once an invocation is removed, the same key
starts a new invocation.

## Deleting an environment

When you delete an environment:

1. It is suspended at once: new invocations are refused and scheduled work stops.
2. Every API key is revoked and console sessions end.
3. The environment disappears from the web app.

Its data is then removed **permanently within 60 days**. The delay covers the trash (7 days) and
the last backup that still holds it (about 45 days).

:::caution
Deleting an environment cannot be undone from the web app. Export what you need from the console
first: SQL query results download as CSV.
:::

## Deleting an organization

There is no self-service way to delete an organization yet. Write to
[support@cairnflow.dev](mailto:support@cairnflow.dev).

## Questions

For anything about your data, write to [support@cairnflow.dev](mailto:support@cairnflow.dev) with
your organization name.
