Privacy and erasure
Binding for implementation. This page lists every store of personal data, how long it is kept and how it is deleted; how the jurisdiction applies; the retention and erasure jobs step by step; legal holds; subject-access export; and what remains after deletion (backups, logs, processors). The user-facing explanation is in Privacy, retention and erasure.
| Requirements | FR-PRV-1, FR-PRV-2, FR-PRV-3, FR-PRV-4, FR-PRV-5, FR-PRV-6, FR-PRV-7, FR-IDN-4, FR-IDN-7, FR-IDN-9, FR-ADR-5, FR-SRCH-11, FR-DOM-9, FR-CON-8, FR-CON-14, FR-CON-15, FR-KEY-4 (partner deletion), NFR-PRV-1 |
| Edge cases | I1–I13, J7, A5, A6, A13, F6, J8, J12, W34, N4, N7, O7, O15, O19 |
| Code | crates/worker/src/jobs/ (JobRunner, step planners), crates/core/src/jobs/ (pure step logic, receipt builder), crates/worker/src/mailbox/erase.rs, crates/worker/src/mailbox/export.rs |
| Tables | jobs, erasure_requests, exports, address_tombstones, suppressions, ses_ingest, identity_keys, key_tombstones, notification_prefs, partners, draft_index, agent_signups, agent_signup_refusals, the console tables (users, members, invitations, login_tokens, sessions, oauth_identities, oauth_states, waitlist) (D1); steps, meta (JobRunner); every IdentityMailbox table; the Notifier and TenantEvents tables (Data model) |
1. Principles
- Minimise. Store the least that delivers the feature: vectors hold no text; queues hold pointers; logs hold pseudonyms; suppressions and tombstones hold keyed hashes.
- Delete together. A message’s rows, index entries, references, vectors and objects are deleted by the same job, and the receipt counts each store (FR-PRV-3, FR-SRCH-11).
- Prove deletion. Every erasure ends with probe queries whose results are in the receipt (F6).
- Say what remains. Backups, processor-side logs and suppressions survive by design and are listed here (section 11).
2. Data inventory
| Store | Personal data | Purpose | Retention | Deletion mechanism |
|---|---|---|---|---|
R2 inbound-staging/{yyyy}/{mm}/{dd}/{ulid}.eml (with the envelope in its metadata), inbound-staging/ses/{key} for the SES source, and inbound-staging/role/… for role mail waiting to be relayed | Whole raw message, envelope | Accept mail when the directory lookup fails transiently (J7); hand SES mail to the normal pipeline | Until routed; at most 15 days | The inbound consumer deletes an outage copy after the move and a role copy after the relay; SES copies stay for re-drives; the R2 lifecycle rule removes every copy (15 days: longer than the 14 days a dead-letter item is kept, so a pointer redriven from the dead-letter queue still finds its object, J7). Not keyed by tenant: erasure cannot find these objects, and section 11 lists them |
Amazon S3 {prefix}-inbound, keys in/{messageId} (only with inbound = ses) | Whole raw inbound message, as SES received it | Hand-over from SES receiving to the Worker | Until every recipient is ingested, normally seconds; never longer than 14 days | The inbound consumer calls DeleteObject once every ses_ingest row of the object is done; the bucket’s lifecycle rule deletes in/ after 14 days. The bucket uses SSE-S3 and blocks all public access (Domains on any DNS host §11) |
Amazon SQS pylota-identity-inbound (only with inbound = ses) | Copies of SES receipt notifications: envelope sender and recipients, the message headers up to 10 KB (including From, To and Subject), verdicts (notification contents, read 2026-10-09) | Backstop for a missed SNS push | Until the every-minute backstop cron handles it; queue retention 14 days | The cron deletes each message after handling it; SQS retention |
Amazon SES receipt rules pm-retired-{n} (SES domains) | Retired agent addresses, in clear, as rule recipients | Bounce mail to retired addresses with 5.1.6 (N7) | While the address is retired; beyond 150 rules the oldest addresses are removed | Removed from the rules by domain removal, identity erasure and tenant erasure (sections 6.5, 6.6) |
| Amazon SES identities | Domain names | Sending and receiving for SES domains | Life of the domain | Domain removal calls DeleteEmailIdentity |
Amazon SES account-level suppression list (only with transport = ses or SES failover) | Clear recipient addresses that hard-bounced or complained, with the reason | SES refuses later sends to them | Until removed: entries “remain there until you remove them” (Using the Amazon SES account-level suppression list, read 2026-10-10) | Kept by design and listed in section 11: the list is account-wide, shared by every SES domain of the deployment, so an entry cannot be attributed to one tenant, and our own hashed suppression keeps refusing the address anyway (I12) |
| Cloudflare Email Sending suppression list | Clear recipient addresses, the reason (bounce, complaint, manual, policy) and the scope: account, or sending_domain with the domain name. Since 2026-09-25 Email Sending creates bounce and complaint entries at sending-domain scope automatically, falling back to account scope when it cannot tell the domain (Suppress recipients for one sending domain, read 2026-10-10) | Cloudflare refuses later sends to them (E_RECIPIENT_SUPPRESSED, Outbound › Provider suppressions) | Complaints: no expiry; hard bounces: no expiry, or 7 days for some; soft bounces: 24 hours; manual entries: as set (Suppression lists, read 2026-10-10) | Domain removal deletes every sending_domain entry of the domain (Identities and domains › Domain removal, so tenant erasure too); counterparty erasure deletes the address’s sending_domain entries on the tenant’s sending domains (section 6.4). account entries and Cloudflare’s read_only policy entries stay: section 11 (I12) |
| Cloudflare Email Routing literal rules (subdomain mail domains) | Agent addresses in clear, as rule matchers | Route each address of a subdomain mail domain to the Worker | Life of the address | Deleted by identity deletion and erasure (section 6.5, step 2), address deletion and domain removal |
R2 t/{ten}/i/{idn}/m/{msg}/raw.eml | Whole raw inbound message | Re-parse, raw download, export, dispute evidence | retention.raw_days (default 90) | Retention job; erasure |
R2 t/{ten}/i/{idn}/out/{msg}.eml | Composed outbound message | Sent copy, raw download, export | retention.raw_days | Retention job; erasure |
R2 …/a/{att}, …/a/{att}.md | Attachment bytes and extracted text | Download, extraction, search | As the message (retention.message_days, default kept) | Retention job (message purge); erasure |
R2 t/{ten}/exports/{exp}.zip | Every message in the export | Subject-access export | 7 days | Retention job sets the export expired and deletes the object; every erasure of the tenant expires the tenant’s unexpired exports, and an export that was running restarts (section 6.11, I11); tenant erasure |
R2 backup bucket (PM_BACKUP_BUCKET, optional, off by default; set on Pylota Identity Cloud) | Copies of t/ objects under the same keys | Recovery from a bug that deletes blobs (section 5.4) | As the source object | Every retention and erasure delete is applied to both buckets; tenant erasure sweeps t/{tenant_id}/ in both; a copy that lands after the source was deleted is removed by the backup job itself (section 5.4, I11) |
IdentityMailbox.messages, threads, deliveries, attachments, labels | Addresses, names, subjects, bodies, filenames, SMTP responses, calendar objects (calendar_json, whose parties hold truncated keyed hashes only, Calendar invitations §10) | The mailbox | retention.message_days (default kept) | Retention job; erasure |
IdentityMailbox.fts, fts_tri, refs | Index terms and extracted references (plates, phone numbers, emails, amounts) derived from content | Keyword search | As the message | Deleted in the same transaction as the message row |
IdentityMailbox.contacts | Counterparty addresses, names, counts | Contacts, known-sender signal | Until the counterparty or identity is erased | Counterparty, identity and tenant erasure |
IdentityMailbox.outbox | Event payloads: message summaries, addresses, up to 64 KB of extracted text | Webhook dispatch and replay | retention.events_days (default 30), counted from occurred_at, once dispatched | Retention job; erasure deletes events referencing erased messages |
TenantEvents Durable Object (one per tenant) | Event envelopes: message summaries, addresses, up to 64 KB of extracted text; durable consumer names and key IDs; stream-token hashes; erased message and identity IDs for 7 days | The event feed, consumers and the WebSocket stream (Event feed) | retention.events_days after the append, within a 6 GB budget; tokens 60 s | Tenant retention job (Purge); every erasure scope (section 6); tenant erasure deletes the object’s storage |
IdentityMailbox.idempotency | Response bodies of sends (recipients, subject summary) | Safe retries | 30 days | Hygiene step of the retention job; erasure |
IdentityMailbox.delivery_stubs | Keyed hashes of recipient addresses, recipient domains, provider message IDs and delivery statuses of outbound messages that per-identity expiry deleted; no content and no clear address | Late bounces and complaints still suppress and count (Parity additions § 7.13) | 30 days after the send | Daily maintenance; counterparty erasure of the address; identity and tenant erasure (WipeAll) |
IdentityMailbox.verifications | Verification codes and links | wait | 24 hours | Hygiene step; erasure (cascade) |
IdentityMailbox.rate_windows | Sender addresses in hourly windows | Inbound throttle, token brute-force limits | 48 hours (Design conventions §4, daily maintenance) | Hygiene step; counterparty erasure deletes the counterparty’s rows (section 6.4); identity and tenant erasure |
IdentityMailbox.chunks | Character offsets only | Semantic index bookkeeping | As the message | Cascade with the message row |
Mailbox drafts (with draft_sync) and R2 t/{tenant_id}/i/{identity_id}/drafts/ | Draft recipients, subjects, bodies, attachments | Messages an agent is writing or that wait for approval or a schedule (Drafts) | 30 days after the last change (or retention.message_days, or the identity’s retention.message_hours, when shorter); sent and canceled records keep no content, except a draft canceled under a legal hold until the hold ends | Mailbox maintenance (Hygiene), every erasure scope, WipeAll (Drafts §13) |
IdentityMailbox.screenings | IDs, enumerations, times, the deciding key or user ID | Screening hold records (Screening hold) | As the message (cascade) | Every scope that deletes the message deletes the row (cascade), counted as screenings_deleted (Screening hold §18) |
IdentityMailbox.screening_feedback | The verdict, the caller’s notes (≤ 500 characters, personal data), the actor | Feedback on screening verdicts | As the message (cascade) | As above, counted as screening_feedback_deleted |
Mailbox uploads and R2 t/{ten}/i/{idn}/up/{upl} | Files an agent staged to send, and their filenames | Attachments staged for sends and drafts (Uploads) | At most 7 days, capped by retention.message_days and the identity’s retention.message_hours; tombstones 7 days without bytes | Their own expiry, DELETE, the Hygiene sweep as a backstop; every erasure scope (Uploads §9) |
IdentityMailbox.metric_counts | None: counts per hour and day by event type and domain | Event counts of the metrics API (Metrics) | 192 hours (hourly), 92 days (daily) | Their own pruning; identity and tenant erasure (WipeAll or the prefix delete); message, thread and counterparty erasure leave them (Metrics §7) |
Vectorize pm-mail-chunks | Embeddings derived from content; IDs; filter metadata (identity_id, thread_id, sent_at, sender_domain, direction, has_attachment, verdict, kind); no text, subjects or addresses | Semantic search | As the message | deleteByIds from the chunk map; namespace sweep for tenant erasure (section 7.5) |
D1 identities | Accountable human (owner_name, owner_email), display name, signature, metadata | Identity management, FR-IDN-2 | Life of the identity | Identity and tenant erasure clear or delete the row |
D1 addresses | Agent addresses | Directory | Life of the identity; retired rows kept so they are never reassigned | Moved to address_tombstones on identity deletion or erasure |
D1 domains | Domain names; for smtp_relay, the sealed relay credentials (smtp_sealed; the username is often an address) and the last probe result | Domain management and sending | Life of the domain | Domain removal; tenant erasure |
D1 ses_ingest | S3 object key and the envelope recipient (an agent address) | Exactly-once ingestion of SES messages (N4) | 30 days | Global retention job (ses_ingest step) |
D1 tenants | Workspace name, slug, address suffix, time zone, policy_json; require_two_factor, onboarding_dismissed_at, quota_do_id, notify_do_id, events_do_id, provisional_until and partner_id hold no personal data. The slug and the address suffix are often derived from the business’s name, and for a sole trader that name can identify a person (section 3, “Names kept after tenant erasure”) | The workspace | Life of the tenant | Tenant erasure blanks name and policy_json and keeps the row, so the slug and suffix are never reused; the slug and suffix are kept in clear, on the basis recorded in section 3 |
D1 partners | The partner’s name (an organisation’s name; nothing about a person is asked for), its status and default billing mode | Partner keys (REST API › Partners) | Life of the partner | DELETE /v1/partners/{partner_id} once every tenant of the partner is erased (section 6.10) |
D1 users | Sign-in address, name, last_login_at, last_tenant_id, terms_version and terms_accepted_at, the sealed TOTP secret (totp_sealed, with totp_enabled_at and totp_last_step), the sealed recovery-code hashes (recovery_codes_sealed) | Console accounts | Life of the account | Person deletion (section 6.9); tenant erasure for people left in no workspace |
D1 members | Which person belongs to which workspace, and the role | Console access | Life of the membership | Member removal; person deletion; tenant erasure |
D1 invitations | Invited address, role, inviting user | Invitations | Pending: until accepted, revoked or expired (7 days). Expired and revoked: 30 days after expires_at. Accepted: life of the workspace, because the row records who invited the member and when | Global retention job (console step) for expired and revoked rows; person deletion scrubs the address of the person’s accepted invitations (section 6.9); tenant erasure |
D1 login_tokens | Clear address; keyed hashes of the link token and code; for sign-up and waitlist tokens the plan, next path and accepted terms version | Sign-in, sign-up and waitlist confirmation | 10 minutes; rows deleted 24 hours after expiry | Global retention job (console step); person deletion |
D1 sessions | Keyed hash of the cookie, browser family (user_agent_hint), times | Console sessions | Until 30 days after expiry or revocation | Global retention job (console step); person deletion; tenant erasure |
D1 oauth_identities | Google sub or GitHub numeric ID; the address at linking time (email_at_link) | Google and GitHub sign-in | Life of the account | Person deletion; tenant erasure for people left in no workspace |
D1 oauth_states | Keyed hashes of state and the browser cookie, the sealed PKCE verifier, the next path, plan and accepted terms version | One sign-in flow | 10 minutes; rows deleted 24 hours after expiry | Global retention job (signup step) |
D1 waitlist | Address and plan of interest | Inviting people before open sign-up (FR-CON-8) | A row exists only once confirmed (an unused confirmation link expires after 10 minutes); kept until 30 days after its invitation | Global retention job (signup step); person deletion |
D1 agent_signups | While provisional: the person’s address in clear. Always: the keyed hash of their base address, source, the network hash, the accepted terms version, times | Agent sign-up: the person an agent names confirms or refuses (Agent sign-up) | Provisional: at most 7 days. Verified: life of the tenant (the clear address is removed at verification) | Tenant-scope erasure (delete_d1_rows, before api_keys and identities), which every end of a provisional sign-up starts, with the message-scope erasure of each code email in the system identity’s mailbox when it ends unverified; person deletion replaces human_hash of the rows they verified with the row’s own ID (section 6.9) |
D1 agent_signup_refusals | Keyed hash of a base address | Refusing later agent sign-ups that name the person | Until the person lifts it | /console/settings (Allow again). Not deleted by person deletion or by any erasure: it records an objection to contact, as a suppression does (section 7.6); it holds no clear data |
D1 billing_accounts | Stripe customer and subscription IDs | Plans and billing (Billing) | Life of the tenant | Tenant erasure, after its cancel_billing step (section 6.6) |
D1 billing_events | Stripe event IDs, types and outcomes; the tenant ID | Webhook deduplication and the stripe_webhook_errors alert (Billing › Webhook endpoint) | 400 days from received_at | Global retention job (billing_events step); tenant erasure |
D1 address_tombstones | Keyed hash of the address | Never reassign an address (A5) | Permanent | Never deleted (no clear-text address) |
D1 suppressions | Keyed hash, masked hint, optional note and source message ID | Honour bounces, complaints and objections | expires_at or permanent | Counterparty erasure clears note and source_message_id and keeps the rest (I7); tenant erasure deletes |
D1 sender_lists | Clear addresses or domains chosen by the tenant, for the whole tenant or for one identity (Parity additions §3) | Allow and block lists | Until the tenant removes them | Identity erasure deletes the identity’s entries, tenant erasure every entry (sections 6.5, 6.6); otherwise the tenant’s own DELETE …/lists/… (section 7.3) |
D1 webhook_endpoints, webhook_deliveries, event_index | URLs; event IDs and types; the endpoint’s sealed custom delivery headers (headers_sealed), credentials of the receiver rather than personal data, deleted with the endpoint (Parity additions §8) | Webhooks and replay | Deliveries and index: the tenant’s retention.events_days (default 30); platform rows (tenant_id IS NULL): 30 days | Retention job; tenant erasure; partner deletion removes a partner’s endpoints and their deliveries (section 6.10) |
D1 idempotency_records | Response bodies of non-mail POSTs: an identity’s owner name and address (identity create and update), agent addresses (address create), a suppressed or listed address (suppression and list writes). Never mail content: search is never recorded, and a replay of release, cancel, resolve or a thread hold stores a reference that is re-read (Data model) | Safe retries | 30 days (expires_at) | Retention job (global step); identity erasure (identity_id); tenant erasure (tenant_id); identity erasure deletes the tenant’s records whose body names the identity ID, counterparty erasure those whose body contains the address (sections 6.4, 6.5); tenant erasure deletes them all |
D1 erasure_requests, jobs | Counterparty HMAC, the identity and the msg_ or thr_ target ID, free-text reason, receipt counts | Accountability for erasure, and re-applying erasures after a restore (section 11) | Erasure records: life of the deployment. Other jobs: 90 days after completion | Retention job (global step) for non-erasure jobs |
D1 audit_log | Key IDs and target IDs; never content or clear addresses | Accountability | Life of the tenant | Tenant erasure deletes all but erasure.* rows |
D1 identity_keys | Public JWKs and sealed Ed25519 seeds, tied to one identity; no person’s name or address | Agent assertions (Agent signing keys) | Life of the identity: retired rows stay until the identity is deleted, so a key ID is never reused | Identity and tenant erasure delete the rows and record each key ID in key_tombstones (sections 6.5 and 6.6) |
D1 service_accounts | The agent’s own accounts at third-party services: the identity’s address, a username or account email at the service, the service’s domains, an agent-written purpose, decision notes, actor IDs; no counterparty data and no mail content | The service sign-up ledger (Service sign-up ledger) | Pending: 7 days, then rejected as expired. Rejected and closed: 90 days after the decision or closure. Approved: life of the identity | Global retention job (service_accounts step); DELETE …/accounts/{account_id}; identity and tenant erasure (sections 6.5 and 6.6) |
D1 draft_index | None: draft, identity and tenant IDs, status, counts and times (Drafts §9.2) | Listing drafts that wait for approval or a schedule | As the draft | Kept in step by the mailbox; message, thread and counterparty erasure delete the rows of erased drafts (scrub_control_plane); identity and tenant erasure (sections 6.3–6.6) |
D1 key_tombstones | Key IDs (RFC 7638 thumbprints) of deleted identity keys and deleted_at; no identity, tenant or address | Never publish a deleted key ID again (O7) | Permanent | Never deleted (it holds no personal data) |
D1 notification_prefs | Which person wants which notification kind in which workspace: mode, filter, the followed inboxes (identity_ids), paused_reason | Notifications (Notifications §2) | Life of the membership | Member removal deletes the person’s rows for that workspace (O19); person deletion deletes all their rows (section 6.9); tenant erasure deletes the workspace’s rows |
Notifier Durable Object (one per tenant) | Person (usr_), identity and message IDs, counts and times in pending, held, windows and sent; never mail content, subjects, senders or addresses (Notifications §8) | Coalescing, waiting for triage, schedules and daily caps of notifications | Pending items until their window sends them; held rows at most 5 minutes; or until the person is removed (O19) | Member removal drops the person’s pending and held items; tenant erasure deletes the object’s storage (delete_all, section 6.6) |
D1 usage_daily, TenantQuota | Counts only, including the assertions and http_signatures metrics, and the usage-alert markers alerted:{feature}:{threshold}:{period} in TenantQuota.meta; on the default tenant, keyed hashes and counts of agent sign-up (sysmail:signup:*, asu:*) | Usage, caps, abuse windows, usage alerts, agent sign-up limits | 92 days (usage); 1,000 outcomes per identity; one UTC day (sysmail:signup:*) and 48 hours (asu:*) | Retention job; the object’s daily cleanup; identity and tenant erasure |
JobRunner meta | During a counterparty erasure or export only: the clear target address | Matching messages | Until the job’s finalise step, which also runs when the job fails or is canceled (section 4, I13) | Deleted by finalise |
DomainMonitor | Domain names, DNS results, RDAP fingerprint (hash) | Domain health | Last 500 checks | Domain removal; tenant erasure (delete_all) |
| Queues | Pointers; inbound pointers carry the envelope sender and recipient (Inbound) | Async work | Until consumed; dead-letter items at most 14 days | Consumers ack; queue retention |
D1 dlq_items (Observability) | Pointers as received; inbound pointers include the envelope addresses | Dead-letter records and redrive | 14 days | Global retention job (dlq step); counterparty erasure deletes the tenant’s rows whose pointer names the address, identity erasure the rows naming the identity, tenant erasure every row of the tenant (sections 6.4–6.6) |
| Workers Logs | Pseudonyms and IDs only (FR-PRV-6) | Debugging | 7 days (Cloudflare) | Expiry |
Analytics Engine pylota_identity_metrics | Tenant and domain IDs only | Metrics and alerts | 3 months (Cloudflare) | Expiry |
R2 phone-staging/… | Raw provider events: SMS text, numbers | Process and reconcile provider events | Until the consumer processes them; at most 15 days | Deleted after processing; lifecycle rule. Not keyed by tenant, so listed as a residual |
Mailbox sms_messages, sms_conversations, sms_media, R2 media | Counterparty numbers, text, media | The identity’s messages and calls | The tenant’s retention.message_days and the identity’s retention.message_hours, as mail | Retention; message, conversation, counterparty, identity and tenant erasure |
Mailbox sms_verifications | Codes | Verification codes for sms/wait and vault fills | 24 hours, or 1 hour after release; at deposit to the vault | Maintenance alarm |
Mailbox calls | Counterparty numbers, times, durations | The identity’s messages and calls | As SMS | As SMS |
D1 phone_consent | Keyed hash and masked hint | Honour opt-outs | While the tenant exists; opt-outs survive counterparty erasure as hashes | Tenant erasure |
D1 phone_compliance_profiles, phone_compliance_documents, R2 t/{ten}/phone/docs/ | Company data, representative’s identity data, identity documents | Register numbers in the tenant’s own name | §4.6 | Crypto-shred and delete; receipt |
D1 phone_numbers | The tenant’s own numbers (business data) | The tenant’s numbers | Life of the identity | Identity deletion, tenant erasure |
D1 phone_onboarding_drafts | Business descriptions, sample messages and URLs an agent drafted; no personal data by schema | Prepare a registration a person submits | Until its request is created, or 30 days untouched | Deleted then; tenant erasure |
D1 phone_compliance_profiles of a sole_trader | The proprietor’s name, address, mobile (sealed) and tax data (sealed) | Register numbers in the tenant’s own name | As any profile (§4.6) | As any profile |
D1 phone_requests | Port-in losing-carrier secrets (sealed) | Port-in submission | Cleared when the port ends; the row for 400 days after it ends | Retention job; tenant erasure |
D1 phone_provider_events, phone_message_index | Provider IDs, no content | Process and reconcile provider events | 30 days | Retention job |
D1 phone_charges | None beyond IDs | Billing | 400 days after invoicing | Retention job; tenant erasure keeps only aggregate lines on the Stripe invoice |
Mailbox sms_messages withheld as vault_code | Code-bearing SMS | Codes for vault fills | 24 hours | Maintenance alarm; every erasure scope |
| Vault managed secret | Port-out PINs | Port-out guard | Life of the number | delete_managed at release and port-out; the vault’s erasure |
D1 (vault_items, vault_item_versions), R2 t/{tenant_id}/vault/ (vault items, versions and session objects) | Credentials and sessions of the tenant’s and its agents’ third-party accounts; usernames are personal data | Use credentials without reveal | Until deleted; session versions until their TTL; previous versions for their overlap | Crypto-shred (Vault § 16.2); identity and tenant erasure |
D1 vault_grants, vault_uses | Who may use what, when, for which run | Approvals and their record | 90 days after they end | The global retention job’s vault step; erasure |
D1 vault_audit, vault_audit_anchors | IDs, sites (registrable domains), times, outcomes; no values, usernames, titles, purposes or URLs | Accountability for every vault change | 400 days by age, never by count | The vault step, anchored; tenant erasure |
Mailbox: hidden vault_code mail and its verifications rows | One-time codes | Codes delivered only into vault fills | 24 hours | Mailbox maintenance; every erasure scope |
Webhook receivers, AI processing and the email providers are covered in section 11.
3. Jurisdiction and residency
PM_JURISDICTION (eu or default) is chosen at idvy setup and applied at creation (FR-PRV-1):
| Resource | How eu is applied | Can it change later? |
|---|---|---|
D1 pylota-identity | Created with jurisdiction: "eu" | No. Cloudflare sets a D1 jurisdiction only at creation |
R2 pylota-identity-blobs | Created with the eu jurisdiction; the binding names jurisdiction = "eu" | No |
| Every Durable Object | ID from unique_id_with_jurisdiction("eu"), stored in D1 (mailbox_do_id, monitor_do_id, runner_do_id, quota_do_id, notify_do_id) | No. Existing objects keep their IDs |
With default, the same resources are created without a jurisdiction and objects use unique_id().
Changing jurisdiction means a new deployment and a migration, which v1.0 does not provide.
What the jurisdiction does not cover. It controls where D1, R2 and Durable Objects store data and where the database and objects run. It does not control:
- Where the Worker runs. Requests and queue consumers run in the data centre that receives them and read jurisdiction-bound data from there (Cloudflare D1 data-location docs, read 2026-10-09).
- Queues, which carry pointers only. Inbound pointers carry the envelope sender and recipient (Inbound).
- Vectorize, which has no documented data-location option. It stores vectors, vector IDs and the eight filter fields only: never text, subjects or addresses. Embeddings are derived from content and are treated as personal data: they are erased with their message.
- Workers AI (embeddings, reranking, triage, the agentic planner,
toMarkdown), which processes mail content in transit. WhenPM_AI_GATEWAYis set, content-bearing calls disable gateway log collection and caching (Security › STRIDE, TB5). - Email Routing and Email Sending, which process mail on Cloudflare’s network. Email Sending keeps an
activity log for 30 days and, when Email preview is on, a copy of each sent message for about
seven days. New sending domains have preview turned on automatically (Cloudflare Email Service docs,
read 2026-10-09). Domain onboarding therefore sets
preview_enabled: falseon every sending domain throughPATCH /zones/{zone_id}/email/sending/subdomains/{subdomain_id}, andidvy doctorfails if any sending domain has preview enabled. - Workers Logs and Analytics Engine, which hold no personal data (section 2).
- DNS-over-HTTPS lookups, which send sender and tenant domain names to the configured resolvers (by default Cloudflare and Google).
- Amazon Web Services, only for domains with
inbound = sesortransport = ses(thedns_records,send_onlyandsmtp_relaywithinbound: sesmethods, and SES failover). SES processes message content inPM_SES_REGION; raw inbound mail rests in the S3 bucket until it is ingested (normally seconds, never longer than the 14-day lifecycle rule), with SSE-S3 and no public access; SNS and SQS carry receipt notifications. WithPM_JURISDICTION=eu,idvy setup sesrefuses an SES region outside the EU and the UK unless--allow-non-euis given, and/healthreportsses_region(Domains on any DNS host §11). For the SES region,eumeans “EU or UK”: the UK has an EU adequacy decision under the GDPR (European Commission adequacy decisions, renewed 19 December 2025, read 2026-10-09), so London (eu-west-2, this deployment’s SES region, decided 2026-10-09) is an acceptable data location. This is not Cloudflare’seujurisdiction above, which means the European Union only (R2 data location, read 2026-10-09). - The customer’s own mail provider, for an
smtp_relaydomain: outbound content goes to the relay the customer chose and configured. - Google and GitHub, when console sign-in with them is enabled: the provider learns that the person signs in to this deployment and returns their verified address and account ID. No mail content is involved.
DPIA. Automated processing of business correspondence with AI models is likely to need a data protection impact assessment by the deployer. This page and the data inventory are the data-flow input for it. Pylota Identity does not provide legal advice and does not act as controller or processor for a self-hosted deployment.
The processors to list in it:
| Processor | When | What it processes |
|---|---|---|
| Cloudflare | Always | Everything: Workers, D1, R2, Durable Objects, Queues, Vectorize, Workers AI, Email Routing, Email Sending |
| Amazon Web Services | Optional: only with inbound = ses or transport = ses | Message content in SES, S3, SNS and SQS in PM_SES_REGION |
| Google, GitHub | Optional: only when their sign-in is enabled | The person’s verified address and provider account ID |
| Stripe | Only with PM_BILLING=stripe | Billing contacts and payment details of workspace owners (Billing) |
The operator of PM_SCANNER_URL | Optional: only when the variable is set | Attachment bytes of inbound mail, sent for malware scanning (Inbound › Attachment safety) |
Google (Google Public DNS, https://dns.google/resolve) | By default: it is the second of the two PM_DOH_RESOLVERS | Domain names: sender domains looked up for SPF, DKIM and DMARC, and tenant domains checked by the domain monitor. No addresses or content |
| RDAP servers of the domain registries, found through the IANA RDAP bootstrap registry | Domain health checks of tenant domains | Domain names only (Identities and domains) |
The customer’s SMTP relay provider is the customer’s own choice and contract, not a processor of the deployment.
Names kept after tenant erasure. Tenant erasure keeps the tenants row with its slug and address
suffix, so that neither is ever given to another workspace: a reused suffix would route mail sent to
the erased workspace’s old addresses to a new owner. Both are usually derived from the business’s name,
and for a sole trader that name can identify a person. The owner accepted this residue on 2026-10-10
(decision D29). The basis recorded here for the DPIA is legitimate interests (UK and EU GDPR
Art. 6(1)(f)): preventing misdelivery of correspondents’ mail outweighs keeping a business name that the
workspace itself chose and published in its addresses. The data is minimised: the workspace name and
policy are blanked, the row holds no person’s name, address or contact detail, and nothing links the
slug to the erased mail. Section 11 lists the residue.
4. JobRunner
Retention, erasure and export run as JobRunner state machines driven by the object’s alarm
(ADR 0005).
start() all steps done/skipped
queued ──────────▶ running ───────────────────────────────▶ completed
│ ▲
step error │ │ alarm (backoff)
▼ │
(retry step) ── retry limit reached ──▶ finalise ──▶ failed
queued/running ── cancel (tenant erasure supersedes) ──▶ finalise ──▶ canceled
retry limit: the 10th failed attempt on one step; for erasure jobs, the first failed attempt
after meta.retry_until, normally deadline_at − 4 h (section 4, "Errors")
- Creation. The handler inserts the
jobsrow (statusqueued, a newrunner_do_idfromunique_id_with_jurisdiction,created_by_key_id= the calling key) and, for erasure, theerasure_requestsrow (statusqueued,target_id= themsg_orthr_ID for message and thread scope,created_by_key_id,deadline_at, andresumes_idwhen it resumes or continues an earlier request, section 6.1), or, for an export, theexportsrow (statusqueued,scope,job_id, andidentity_idfor identity scope), in one D1 batch; then sendsJobRequest::Start { job_id, kind, tenant_id, params, resume_job_id }(resume_job_idis set only for a resumption, section 6.1). IfStartfails, the every-minute cron starts any job stillqueuedafter 60 seconds. - Steps.
Startwrites the step list for the job kind intosteps(allpending) and armsalarm:stepfor now. Each alarm runs the first non-finished step for a slice of at most 20 seconds or 1,000 items, storescursorandcounts_json, and re-arms immediately while work remains. - Idempotency. Every step can be re-run from its cursor with the same result: deletes of missing objects, rows or vectors count as success and are not counted twice (counts come from the store’s own response or from rows deleted in the committed transaction).
- Errors. A failed slice increments
attempts, storeslast_error(a machine code), and re-arms after30 s × 2^(attempts − 1), capped at 1 hour. A successful slice resetsattemptsto 0.- Jobs other than erasure: after 10 failed attempts on one step the job is
failed, and thejob_failed:{kind}alert fires (Observability › Alert list). - Erasure jobs retry automatically with no attempt limit until
meta.retry_until, whichStartsets toerasure_requests.deadline_at − 4 h(20 hours after the first request, section 6.1), or to 4 hours after the job starts if that is later. Only a resumption of a failed request (section 6.1) starts that late: it keepsdeadline_at, soerasure_overduestill reports it as late, but it gets a working window instead of failing on its first transient error. The third consecutive failed attempt of any step fireserasure_stalled:{erasure_id}(page), so the operator learns of it with about 19 hours left; the job resolves that alert itself when the step next succeeds or the job ends. The first failed attempt aftermeta.retry_untilmakes the jobfailed: the request becomesfailed,erasure.failed(withstepanderror) is emitted, and theerasure_failedalert fires (Observability). A failed erasure is restarted with a new request for the same scope and target, which resumes it at the failed step (section 6.1).
- Jobs other than erasure: after 10 failed attempts on one step the job is
- Finalise on every end. A job that fails or is canceled runs its kind’s
finalisestep before the status is mirrored, exactly as a completed job does.finalisetouches only the runner’s own storage and R2, so it cannot be blocked by the fault that failed the job; a crash before it finishes re-runs it on the next alarm. It deletesmeta.target_addressand every other job-local copy of personal data, and for an export it also aborts the open multipart upload (section 9.1). No job ends with a clear address in its storage (I13). - Mirroring. On each step transition the runner updates
jobs.statusandjobs.updated_atin D1. When the first step starts it setsjobs.status, anderasure_requests.statusorexports.status, fromqueuedtorunningin one D1 batch. On completion it writesjobs.result_json,jobs.completed_atand, for erasure, theerasure_requestsrow (completedorcompleted_with_holds,receipt_json,completed_at). Afailedjob setserasure_requests.statusorexports.statustofailedin the same batch. - Cancel. A job is canceled only by tenant erasure (section 6.6, step 1), which cancels the tenant’s
other
queuedandrunningjobs: the runner stops at its next slice, runsfinalise, and one D1 batch setsjobs.status, anderasure_requests.statusorexports.status, tocanceled. A canceled erasure emits noerasure.completed; the tenant erasure that superseded it covers the same data. - Events go through the runner’s own outbox (Design conventions).
- Deadline. NFR-PRV-1 requires erasure within 24 hours of the first request. Each erasure request
stores
deadline_at:created_at+ 24 hours, or, for a request that resumes a failed one, the failed request’sdeadline_at(section 6.1). Theerasure_overduealert fires for any erasure stillqueuedorrunningafterdeadline_at − 4 h.
4.1 Mailbox operations used by jobs
These MailboxRequest variants are added by this design. All run inside the mailbox, all take the
caller’s tenant_id and identity_id in the RPC envelope, and all write in one transaction_sync
per call.
| Operation | Returns / does |
|---|---|
RetentionPlan { raw_cutoff_ms, message_cutoff_ms, after_rowid, limit } | Messages older than a cutoff outside held threads, with their R2 keys and vector IDs |
PurgeRaw { message_ids } | Sets raw_r2_key = NULL (the raw endpoint then returns 410 raw_expired) |
PurgeEvents { cutoff_ms }, Hygiene { now_ms } | Deletes dispatched outbox rows older than the cutoff; expired idempotency, verifications, rate_windows. Hygiene also purges drafts by Drafts §13.1 and expires pending approvals, and runs the uploads expiry sweep as a backstop (Uploads §9) |
ErasurePlan { target, after_rowid, limit } | { messages: [{ rowid, id, thread_id, r2_keys, vector_ids, uploads: [{ id, r2_key }] }], drafts: [{ id, r2_keys }], held: [{ thread_id, reason }], next_after_rowid }. uploads lists the still-existing uploads the message’s attachments were copied from (attachments.upload_id, Uploads §9); drafts the drafts the target erases (Drafts §13.2) |
EraseRows { rowids, counterparty, draft_ids, upload_ids, mode } | Deletes the rows (section 6.2) and returns counts and the deleted message IDs, which it also leaves pending in erased_ids for the event log. mode is Erasure (requests), Retention (tenant retention, section 5.2 step 3: as Erasure, and for outbound messages a content-free delivery stub) or Expiry (per-identity expiry, section 5.5), which keeps a content-free idempotency stub and, for outbound messages, a content-free delivery stub |
ProbeKeyword { target } | Number of messages still matching the target |
CountAll | Counts per table, used before a wipe (drafts, uploads, screenings and screening_feedback included, for the receipt) |
WipeAll | delete_all(), then writes a three-row tombstone meta (erased = '1', tenant_id, identity_id) so the object refuses every later request with identity_not_found |
ExportBatch { target, after_rowid, limit } | Message records and R2 keys for export |
ForgetSender { target } | Deletes the rate_windows rows whose sender matches a counterparty target; returns the count |
UploadPlan { after, limit }, EraseUploads { ids } | For erasure of a held identity: lists the uploads with their keys, then deletes the rows → count (Uploads §5.2) |
ActiveHolds { now_ms } | Clears holds whose until has passed (audit hold.expired, section 8) and returns the number of threads still held |
target is one of Message { id }, Thread { id }, Counterparty { address },
CounterpartyHash { hash } or All. CounterpartyHash is used only when an erasure is re-applied after a
restore, because the erasure record keeps the address’s HMAC and never the address (section 11): the
mailbox computes HMAC-SHA256(PM_HASH_KEY, a) for each normalised address a a message, contact,
participant list, draft or rate_windows row holds, and matches it against hash. Calendar
objects keep no clear address: their parties entries are the first 16 bytes of that HMAC, so both
targets compare the first 16 bytes of the target’s hash with them (Calendar invitations §10). It matches exactly the
messages that Counterparty matches, more slowly; the keyword probe uses the same comparison instead
of a participant: search.
5. Retention
5.1 Scheduling
The */15 cron starts one retention job per tenant per UTC day: it selects up to 50 active tenants
whose latest retention job was created before today (UTC) and creates a job for each. A deployment
with more tenants catches up over the day’s 96 runs. A separate global job (tenant_id = NULL) runs
once per day for control-plane tables.
5.2 Steps of a tenant retention job
| # | Step | Does |
|---|---|---|
| 1 | plan | Reads the tenant’s effective retention policy and fixes the cutoffs: raw_cutoff = now − raw_days, message_cutoff = now − message_days (skipped when null), events_cutoff = now − events_days. The system identity (is_system = 1, default tenant only) always uses raw_days = 7 and message_days = 30, whatever the policy says, because its mailbox holds sign-in, invitation and notification mail addressed to people (Identities › The system identity) |
| 2 | raw | For each identity (cursor identity_id:rowid), RetentionPlan for raw cutoff → delete raw.eml and out/{msg}.eml objects → PurgeRaw. Objects are deleted before the column is cleared, so a crash leaves no unreferenced object |
| 3 | messages | Only when message_days is set: for each identity, RetentionPlan for message cutoff → deleteByIds for the vector IDs → delete every R2 key of the batch → EraseRows (mode: Retention, which |
keeps the delivery stubs of Parity additions § 7.13), whose deleted IDs the mailbox’s log_erase purpose then deletes from the tenant’s event log, so the log keeps no event of a message that retention removed (Event feed § 11.3) | ||
| 4 | events | For each identity, PurgeEvents { events_cutoff }. In D1, in batches (section 6.12): DELETE FROM event_index WHERE rowid IN (SELECT rowid FROM event_index WHERE tenant_id = ?1 AND occurred_at < ?2 LIMIT 1000), repeated until it deletes nothing, and the same for webhook_deliveries.created_at; then EventsRequest::Purge { appended_before: events_cutoff } on the tenant’s TenantEvents object, repeated until it reports done, its count added to the audit row as log_events_deleted (Event feed §11.2) |
| 5 | hygiene | For each identity, Hygiene (which also purges drafts and sweeps expired uploads, section 4.1). Expire exports: exports rows past expires_at → delete the ZIP object → status expired |
| 6 | holds | For each identity, ActiveHolds, which clears holds whose until has passed (audit hold.expired, section 8). For an identity still deleting whose latest identity-scope erasure request is completed_with_holds, an answer of 0 creates the continuation: an identity-scope request with reason hold_released:{era_id} and resumes_id = that request, audit-logged (erasure.create; section 6.5) |
| 7 | audit | One audit_log row per step that deleted anything: action = "retention.purge", target_type = "tenant", details_json = { "step", "cutoff_ms", "identities", "r2_objects_deleted", "messages_deleted", "vectors_deleted", "events_deleted" }, plus log_events_deleted (step 4) and drafts_deleted (step 5) when non-zero (FR-PRV-2) |
Every R2 delete in steps 2, 3 and 5 is sent to BACKUP too when it is configured (section 5.4).
Held threads (section 8) are excluded by RetentionPlan in steps 2 and 3. Messages
in held threads keep their raw MIME and rows until the hold ends; the next daily run then purges them.
Webhook replay reaches back 30 days from each event’s occurred_at (or retention.events_days, if
shorter). Replay reads payloads from the outbox, which keeps them for events_days, so a tenant with
events_days below 30 can replay only that far; a longer events_days keeps the payloads and the
delivery log longer but never extends replay past 30 days (Webhooks › Replay).
events_days is 1–365.
5.3 Global retention job
| Step | Does | Test |
|---|---|---|
idempotency | DELETE FROM idempotency_records WHERE expires_at < ?now (batches of 1,000) | it::retention::global_job_steps |
platform_events | event_index and webhook_deliveries rows with tenant_id IS NULL older than 30 days | it::retention::global_job_steps |
jobs | Non-erasure jobs rows completed, failed or canceled more than 90 days ago, and their JobRunner objects (WipeAll) | it::retention::global_job_steps |
usage | usage_daily rows older than 92 days | it::retention::global_job_steps |
dlq | dlq_items older than 14 days | it::retention::global_job_steps |
signing_keys | signing_keys rows whose verify_until has passed | it::retention::global_job_steps |
identity_keys | UPDATE identity_keys SET status = 'retired', retired_at = ?now WHERE status = 'retiring' AND verify_until < ?now. The rows stay until the identity is erased, so a thumbprint is never reused (Agent signing keys); the JWKS already leaves out a retiring key past verify_until, so this step never changes what is published | it::retention::global_identity_keys |
billing_events | DELETE FROM billing_events WHERE received_at < ?now − 400 days (batches of 1,000) (Billing › Webhook endpoint) | it::retention::global_billing_events |
service_accounts | pending_approval rows past expires_at set rejected with rejected_reason = 'expired', each with an account.rejected platform event in the same batch (batches of 100); then rows with status rejected or closed whose decided_at or closed_at is more than 90 days ago deleted (Service sign-up ledger §7) | it::accounts::erasure_and_retention |
ses_ingest | ses_ingest rows whose done_at (set with done, dropped or lost) is more than 30 days ago. queued and held rows are never pruned: the backstop cron owns them | it::retention::global_ses_ingest |
console | login_tokens rows 24 hours past expires_at; sessions 30 days after expiry or revocation; invitations with status expired or revoked 30 days after expires_at | it::retention::global_console_rows |
signup | oauth_states and pending_auth rows 24 hours past expires_at; users.totp_pending_sealed and totp_pending_expires_at cleared 24 hours past totp_pending_expires_at; waitlist rows 30 days after their invitation (there are no unconfirmed rows: an unused confirmation link simply expires after 10 minutes) | it::retention::global_signup_rows |
staging | Only the outage copies inbound-staging/{yyyy}/{mm}/{dd}/{ulid}.eml (J7); never inbound-staging/ses/ or inbound-staging/role/, which their own consumers and the lifecycle rule handle. The inbound consumer deletes an outage copy once its message is committed, so an object older than 1 hour that still exists is unrouted: it is re-queued once a day as InboundJob::Staged, built from the object’s custom metadata (envelope_from, envelope_to, received_at) and its size (a pointer may sit in a dead-letter queue for up to 14 days). Objects are never deleted here (the 15-day lifecycle rule does that). An object still unrouted 14 days after it was written counts in inbound_lost_total | it::retention::global_job_steps |
held_erasures | For each erasing tenant whose latest tenant-scope erasure request is completed_with_holds: ActiveHolds on the mailbox of every identity still deleting; when every answer is 0, create a tenant-scope erasure request with reason hold_released:{era_id} and resumes_id = that request, audit-logged (erasure.create), which finishes the erasure (section 6.6, “Holds in a tenant being erased”) | it::erasure::i2_hold_tenant_scope |
phone | phone_provider_events and phone_message_index rows older than 30 days; phone_requests 400 days after they ended (port-in secrets were cleared when the port ended); phone_charges 400 days after invoicing; phone_onboarding_drafts untouched for 30 days; phone_number_releases hashes after 90 days (Phone numbers § 24) | it::retention::global_job_steps |
vault | Terminal grants and uses after 90 days (their ticket hashes and sealed keys were cleared when they ended); vault_audit rows older than 400 days, writing the last deleted row’s seq and row_hash to vault_audit_anchors first; revoked consumers after 400 days; never a row by count. The every-minute vault cron and the daily vault sweep handle overlaps, nonces, expired sessions and orphan R2 objects (Vault § 16.1) | it::retention::global_job_steps, it::vault::audit_chain_and_age_only |
audit | One audit_log row per step with counts (tenant_id = NULL) | it::retention::global_job_steps |
Each step is added to jobs/retention.rs, with its test, by the milestone that builds the feature
writing its table’s rows (Build plan › M14 names them); the job
runs the steps in the order above.
5.4 Optional R2 backup copy
R2 has no object versioning and no replication (PutBucketVersioning and PutBucketReplication are
not implemented, per the R2 S3 API compatibility page, last updated 2026-07-31, read 2026-10-09). R2
bucket locks exist, but a lock rule blocks deletion, so it would stop retention and erasure from
deleting personal data; the design does not use them. Without help, a bug that deletes blobs loses
them.
The optional backup covers that case. It is off by default, and on for Pylota Identity Cloud, which
sets PM_BACKUP_BUCKET = "pylota-identity-backup" (ADR 0016
records why a nightly copy replaces the event-driven copy the plan proposed):
- Setting
PM_BACKUP_BUCKETmakesidvy setupcreate that bucket in the deployment’s jurisdiction and bind it asBACKUP(Configuration). - Once per UTC day the
*/15cron starts abackupjob (jobs.kind = 'backup',tenant_id = NULL). Its one step listst/in key order (cursor = the last key) and copies toBACKUP, under the same key and with the same custom metadata, every object uploaded since the previous run’s start, except keys under…/up/(Uploads §9): restoring an upload is never useful, and a copy would outlive the upload’s expiry. Errors retry under the JobRunner backoff; the result counts copied, skipped and errored objects (backup_objects_total{result=copied|skipped|error}). - The backup never deletes an object that still exists in
BLOBS. Retention and erasure delete each key fromBLOBSfirst and then fromBACKUP, in the same step, and tenant erasure sweepst/{tenant_id}/in both. A copy can still be in flight when an erasure runs: the job has read the object fromBLOBSand writes it toBACKUPafter the erasure deleted both. So after everyputtoBACKUP, the job sends aheadfor the same key toBLOBS; whenBLOBSno longer has it, the job deletes the key fromBACKUPat once (counted asbackup_objects_total{result=revoked}). Whatever the interleaving, the copy is gone once both the erasure’s delete and the job’s check have run (I11). An object deleted fromBLOBSby anything else before the night’s run is removed fromBACKUPby the same check only if the job copies it again; otherwise it stays inBACKUPuntil the operator restores or removes it. - Restoring is a manual copy back from
BACKUPtoBLOBSfor the affected keys, listed from the mailbox rows that point at missing objects. - Cost: one list operation per 1,000 objects in
t/each night, and one write per new object.
5.5 Per-identity expiry
An identity can set retention.message_hours (1–8,760, or null for the tenant’s policy alone), so that its
mail is gone within hours whatever the rest of the workspace keeps (FR-PRV-7). When the tenant’s
message_days is also set, the shorter applies. The full design is
Parity additions §7; in summary:
- Who.
identities:write; setting a number where there wasnull, or lowering it, deletes mail sooner and also needserasure:manage. Every change writesidentity.retention_updateand emitsidentity.updated. The system identity keeps its fixed 30 days (section 5.2). - How the mailbox learns it. D1 keeps
identities.message_hours; anrpc_intentsrow (opset_retention) andMailboxRequest::SetRetention { message_hours, version }carry it to the mailbox, which storesmeta.retention_message_hoursand re-plans at once (alarm:expiry = now) when the value is set or lowered. - What expires. Every message, inbound or outbound and of every status,
message_hoursafterreceived_at, except a message in a thread under an active legal hold (until the hold ends, section 8) and an outbound message stillqueuedor with a transport claim younger than 5 minutes. Expiry deletes whatEraseRowsdeletes (section 6.2), the message’s R2 objects inBLOBSandBACKUPand its vectors, and writeserased_ids; a draft expiresmessage_hoursafter its last change. The event log’s copies of the message’s events go too, through the mailbox’slog_erasepurpose (Event feed § 11.3). It keeps what tenant retention keeps:contacts,rate_windows, suppressions,event_indexrows and audit rows. - Late bounces and complaints still count. Each delivery of an expired outbound message with a provider
message ID becomes a content-free
delivery_stubsrow (keyed recipient hash, provider message ID, status,first_reply, sending domain) for 30 days after the send, so a complaint or hard bounce that arrives after the message expired still suppresses the address and reachesRecordOutcome, the abuse pauses andmetric_counts, with no message event (Parity additions § 7.13). - The expiry alarm. The mailbox does the work itself (
alarm:expiry,mailbox/expiry.rs), with noJobRunner: in slices of at most 100 messages or 20 seconds it plans the due rows, deletes their vectors and R2 objects, then in one transaction re-checks each row and runsEraseRowswithmode: Expiry. A failure backs off from 30 seconds to 5 minutes, and the daily maintenance alarm re-arms an alarm that was lost. - Timing. At most 15 minutes after the due time while R2, Vectorize and the mailbox answer (Pylota Identity
target);
retention_expiry_overdue:{identity_id}fires when a due row is more than 1 hour overdue. - A retried send never sends twice. In
mode: Expiryan outbound message’s idempotency row is kept until its ownexpires_at, with no content and a keyed fingerprint; a retry with the same key and body gets410 message_expired, a different body409 idempotency_conflict. An erasure request still deletes the row (section 6.2, step 4). - One-time codes are available for the shorter of 24 hours and
message_hours. - What expiry cannot recall. Copies outside the mailbox: webhook payloads already delivered, the copies
event-feed consumers received, exports completed earlier, recipients’ copies of outbound mail, and the
processor logs and recovery windows of section 11. An export collecting while messages expire leaves them out
and counts them in
jobs.result_json.expired_during_export. - Receipts. One audit row per identity per UTC day that expired anything (
action = "retention.expire",target_type = "identity"), with the day, the counts of an erasure receipt (section 10),drafts_deleted,held_skipped,first_expired_atandlast_expired_at(FR-PRV-2), written by the daily maintenance alarm with a deterministic ID, so a repeated flush writes one row.
6. Erasure
6.1 Request
POST /v1/erasure-requests (erasure:manage), or DELETE /v1/identities/{id} (identity scope,
reason identity_deleted), or DELETE …/messages/{id} (message scope, reason message_deleted).
-
Validation runs before anything is written: the target must exist and be in the key’s scope (Security › Authorisation); otherwise the resource’s
*_not_found. A resumption (below) is the exception: the failed job may already have deleted the target’s rows, so it is validated against the failed request instead (the same tenant, and itsidentity_idin the key’s scope). -
For
counterparty, the address is normalised (lower case, IDNA A-label domain) andcounterparty_hash = hex(HMAC-SHA256(PM_HASH_KEY, address))is stored in D1. The clear address is passed only to the JobRunner, which keeps it inmeta.target_addressuntil thefinalisestep. -
The response is
202with the erasure request object (status: "queued",deadline_at=created_at+ 24 hours). Repeating a request creates a new request and job; erasure is idempotent, so a second run deletes nothing and reports zero counts. -
Resuming a failed erasure, every scope. When the latest request of the tenant with the same scope and target (
target_idfor message and thread scope, the keyed hash of the address for counterparty scope,identity_id, or the tenant) isfailed, the new request resumes it:202with a new request whoseresumes_idis the failed one and whosedeadline_atis copied from it, because NFR-PRV-1 counts from the first request. A counterparty request carries the address as always (the failed job’sfinalisedeleted its copy). The new job resumes the failed one:JobRequest::Startcarriesresume_job_id, and the new runner first callsJobRequest::Snapshoton the failed job’s runner, which returns itssteps,heldanddeleted_vectorsrows (Data model › Other Durable Objects), copies them withattemptsreset to 0, and continues at the failed step from its cursor. The copied vector IDs matter for identity scope: afterWipeAllthe mailbox can no longer list them, and the semantic probe and any re-sentdeleteByIdsneed them. The receipt is cumulative. At most one request resumes or continues a given request:erasure_requests.resumes_idhas a partial unique index, and a second request racing the first gets200with the first. -
Tenant scope is different, because its job is the only writer of the tenant’s status from
erasingon (I8). On a tenant alreadyerasing, what happens depends on the latest tenant-scope request of that tenant:Latest tenant-scope request Answer queuedorrunning200with that request (the sameera_ID); nothing startsfailedA resumption, as above: 202with a new request whoseresumes_idis the failed one and whosedeadline_atis copied, continuing at the failed step. A tenant lefterasingby a failed job is therefore never stuckcompleted_with_holds202with a new request whoseresumes_idis that one: a continuation that runs every step again and finishes the erasure if no hold remains, or endscompleted_with_holdsagain (section 6.6, “Holds in a tenant being erased”)On an
erasedtenant the request returns409 tenant_erased. For a non-platform key, any other write to anerasingorerasedtenant (or to anything in it) is refused as*_not_found(Security § 5.2, step 4), except the hold routes on a tenant that iserasingwith holds (section 8); reading the tenant and its erasure requests keeps working for its partner key (section 6.10). The CLI commandidvy erasure retry <era_id>submits the same scope and target again, which resumes the failed request (CLI and setup). -
An erasure request never returns
423 legal_hold: held items are skipped and listed (FR-PRV-4, api.md). Only the single-messageDELETE …/messages/{message_id}checks the thread’s hold first and answers423 legal_holdwithout creating a request.
6.2 What EraseRows deletes
In one transaction per batch, for each message rowid:
DELETE FROM fts WHERE rowid = ?1andDELETE FROM fts_tri WHERE rowid = ?1, and, while a tokenizer-mode reindex has created them, the same fromfts_nextandfts_tri_next(Search §7.2), so a swap can never bring an erased row back.DELETE FROM messages WHERE rowid = ?1, cascading todeliveries,attachments,labels,refs,chunks,verifications,screeningsandscreening_feedback.DELETE FROM outbox WHERE payload_jsonreferences the message ID (the outbox payload builder stores the message ID in a top-leveldata.message_idordata.message.id; the delete usesjson_extract). It also matchesmessage.labels_changedrows whosedata.messageslists the message: the entry is removed withjson_remove, the row is deleted when no entry is left, and the count of deleted rows goes toevents_deleted(Parity additions §4.3, rule 8).DELETE FROM idempotency WHERE message_id = ?1. Per-identity expiry (mode: Expiry, section 5.5) keeps the row instead, as a stub without content, until its ownexpires_at, and turns each delivery of an outbound message that has aprovider_message_idinto adelivery_stubsrow before step 2 deletes it (Parity additions § 7.13).- Update the thread’s counters and
participants_json; delete a thread left with no messages. - For a counterparty target, also: delete the
contactsrow for the address, remove the address fromparticipants_jsonof every surviving thread, and delete thedelivery_stubsrows whoseaddress_hashis the target’s keyed hash. - Delete the drafts of the plan (Drafts §13.2): the draft row, its
draft_syncrow (writing adeleterow), itsidempotencyrows and its outbox rows; countdrafts_deleted. - Delete the
uploadsrows the plan lists for the batch’s messages; their objects were deleted before the transaction, with the message’s keys (Uploads §9); countuploads_deleted.
Counts returned per batch: messages, attachments, FTS rows (rows deleted from fts; fts_tri rows are
deleted alongside and not counted), refs, outbox events, screening records and screening feedback (counted
before the delete, because a cascade reports no count), drafts and uploads; and the IDs of the messages
deleted, which an erasure job passes to the event log (sections 6.3 and 6.4). The same transaction writes
those IDs to erased_ids with log_erased_at = NULL and sets alarm:log_erase = now, in every mode, so the
mailbox itself deletes the log’s copies after tenant retention and per-identity expiry too, and repeats an
erasure job’s call that was lost (Event feed § 11.3).
6.3 Message and thread scope
| # | Step | Does |
|---|---|---|
| 1 | init | Records the target; resolves the identity’s mailbox_do_id |
| 2 | erase_mailbox | ErasurePlan { Message | Thread }. A held thread yields no messages and one held entry. For each batch: deleteByIds(vector_ids) → delete each R2 key (raw.eml, out/{msg}.eml, inbound and outbound attachments and their .md, the objects of the uploads the attachments were copied from, and the drafts/{id}/ objects of the plan’s drafts) from BLOBS and, when configured, BACKUP → EraseRows; after each EraseRows batch, EventsRequest::EraseMessages with the batch’s message IDs (Event feed § 11.3) |
| 3 | scrub_control_plane | Delete event_index rows for the deleted event IDs, and draft_index rows for the erased draft IDs; expire the tenant’s exports (section 6.11) |
| 4 | probe | Section 6.7 |
| 5 | receipt | Section 10 |
| 6 | finalise | Clears job-local target data |
6.4 Counterparty scope (I1)
A message matches when the normalised address equals from_address, appears in to_json, cc_json,
bcc_json or reply_to_json, or is a deliveries.address of the message, or is a party of the message’s
calendar object (the parties list of calendar_json, Calendar invitations §10).
A draft matches when the address is in its to_json, cc_json, bcc_json or resolved_json, or when its
source or sent message matches (Drafts §13.2). A message that only
mentions the address in its body is not “to or from” the counterparty and is not erased; erase it with
message scope if needed.
| # | Step | Does |
|---|---|---|
| 1 | init | Stores meta.target_address; lists the tenant’s identities (every status except deleted), or, when the job’s params carry identity_ids, only those identities |
| 2 | erase_mailboxes | For each identity (cursor identity_id:rowid): ErasurePlan { Counterparty } → per batch deleteByIds → delete R2 keys (in BACKUP too, when configured) → EraseRows { counterparty }; after each EraseRows batch, EventsRequest::EraseMessages with the batch’s message IDs (Event feed § 11.3); then ForgetSender { Counterparty }. As in message scope, the R2 keys include the objects of the uploads the matched messages’ attachments were copied from, and of the matched drafts. Held threads are collected into held |
| 3 | scrub_control_plane | suppressions for (tenant_id, counterparty_hash): set note = NULL, source_message_id = NULL, keep the row (I7); delete event_index rows for deleted event IDs, and draft_index rows for the erased draft IDs; delete the tenant’s dlq_items whose pointer’s envelope sender or recipient, normalised, is the address (the Worker reads the tenant’s rows, at most 14 days’ worth, and compares); DELETE FROM idempotency_records WHERE tenant_id = ?1 AND instr(response_body, ?2) > 0 with the normalised address; expire the tenant’s exports (section 6.11). With PM_CF_API_TOKEN: GET /accounts/{PM_CF_ACCOUNT_ID}/email/sending/suppressions?email={address} and DELETE …/suppressions/{suppression_id} for each entry whose scope is sending_domain with one of the tenant’s own domains and that is not read_only (our hashed suppression keeps refusing the address, so the provider’s clear copy is not needed; I12); account entries and entries of the shared platform domain, which other tenants’ sends also create, are kept (section 11). Without the token the provider step is skipped and counted in jobs.result_json as provider_suppressions_skipped |
| 4 | probe | Section 6.7, for every identity in identities_affected |
| 5 | receipt | Section 10 |
| 6 | finalise | Deletes meta.target_address |
Counterparty erasure is not an objection: mail the counterparty sends afterwards is stored as usual. To stop contact, the tenant adds a suppression (outbound) or a receive-block entry (inbound).
Restricting the identities. JobRequest::Start params for a counterparty erasure (stored in
jobs.params_json) may carry identity_ids, a list of identity IDs of the job’s tenant. It is internal
only: POST /v1/erasure-requests has no such field and never sets it. Person deletion (section 6.9,
step 5) sets it to the system identity, so a person’s deletion erases the system mail sent to them and
leaves the default tenant’s other mailboxes untouched. identities_affected and the probes then cover only
those identities.
Phone numbers. A counterparty may be an E.164 number: its SMS, media and calls in every identity of the
tenant are deleted, and its consent entry keeps the keyed hash only
(Phone numbers § 24). Vault rows are not touched by counterparty, message or thread
scope; a hidden vault_code message is erased with its message like any other.
6.5 Identity scope (FR-IDN-4)
| # | Step | Does |
|---|---|---|
| 1 | init | identities.status = 'deleting'; revoke every identity-level key (revoked_at = now, prev_hash = NULL) |
| 2 | tombstone_addresses | For every address row of the identity (all statuses): INSERT OR IGNORE into address_tombstones (address_hash, identity_id, reason) with reason erased, delete the addresses row, and delete its literal routing rule. For DELETE /v1/identities/{identity_id} the handler has already done the tombstones and row deletes in its D1 batch with reason deleted (Identities and domains › Delete) and passes the deleted rows’ (zone_id, routing_rule_id) pairs in the job’s params_json, so this step only deletes those rules. From here inbound to these addresses gets 550 5.1.1 (A6, A13) after at most the 60-second directory cache. On an SES domain, each retired address is also removed from the pm-retired-{n} rule named by addresses.ses_bounce_rule (for DELETE /v1/identities/{identity_id} the handler passes these names in params_json with the rule pairs), so its mail is dropped like an unknown address’s instead of being bounced as retired |
| 3 | erase_mailbox | No holds: page through chunks for every vector ID → deleteByIds; list and delete every R2 object under t/{ten}/i/{idn}/ (in BACKUP too, when configured); CountAll (recorded for the receipt); WipeAll. CountAll includes the uploads, drafts, screenings and screening_feedback rows. With holds: as counterparty step 2 with target All, deleting R2 objects by key and keeping held threads; then UploadPlan and EraseUploads delete every upload of the identity and its objects, because a hold covers threads and an upload belongs to none (Uploads §9) |
| 4 | scrub_control_plane | identities: clear owner_name, owner_email, signature_text, signature_html, client_id, client_fingerprint, set display_name = '', metadata_json = '{}', send_policy_json = '{}', and status = 'deleted' (no holds) or keep deleting (holds). In one D1 batch, INSERT OR IGNORE INTO key_tombstones (kid, deleted_at) the id of every identity_keys row of the identity, then delete those rows, so a deleted key ID is never published again (O7; the JWKS already answers 404 identity_not_found from step 1, when the identity became deleting); delete event_index and webhook_deliveries rows for the identity’s events, and idempotency_records with identity_id = the identity; delete the identity’s service_accounts and draft_index rows, and its sender_lists rows (identity_id = the identity), counted as list_entries_deleted; QuotaRequest::ForgetIdentity deletes its outcomes and counters; DELETE FROM idempotency_records WHERE tenant_id = ?1 AND instr(response_body, ?2) > 0 with the identity ID (the identity create and update responses carry the owner’s name and address); delete the tenant’s dlq_items whose pointer names the identity; expire the tenant’s exports (section 6.11). Webhook identity_ids filters keep the opaque ID: removing it could widen an endpoint to every identity; EventsRequest::EraseIdentity with the held threads (Event feed § 11.3) |
| 5 | probe | Section 6.7. A wiped mailbox answers identity_not_found, recorded as zero hits |
| 6 | receipt | Section 10. When the identity is now deleted (no holds remain), emits identity.deleted with identity_id and erasure_request_id, once: the event is written only by the job that moves the identity to deleted (the first job when there are no holds, otherwise the follow-up hold_released job) |
| 7 | finalise | — |
Holds on an identity being deleted. The request completes as completed_with_holds: everything
outside held threads is gone, the addresses are tombstoned, and the identity stays deleting. The hold
routes stay usable on a deleting identity for tenant, partner and platform keys with erasure:manage. When the
daily retention job (its holds step, section 5.2) finds a deleting identity with no remaining holds (removed, or until passed),
it creates a new identity-scope erasure request with reason hold_released:{era_id} and resumes_id =
that request, audit-logged, which finishes the deletion and emits erasure.completed. Identities of a
tenant that is being erased are handled by the global job’s held_erasures step instead (section 6.6).
Phone numbers. DELETE /v1/identities/{id} is refused while the identity holds a live number
(409 identity_has_phone_numbers), so numbers are released first; the mailbox wipe covers sms_* and calls.
Vault. In step scrub_control_plane, before service_accounts: the identity’s identity-scoped vault items
are crypto-shredded (versions, uses, grants, R2 objects by key); its uses of tenant-scoped items and then its
grants on them are deleted; vault audit rows are kept unchanged (IDs only) and their vault_audit_runs rows,
which hold the run identifiers outside the hash chain, are deleted
(Vault § 16.3).
6.6 Tenant scope
A tenant-scope request needs tenants:erase as well as erasure:manage
(Security › Creating keys, W35): platform
keys, the tenant’s partner’s keys, and tenant keys the workspace owner minted hold it; admins never do.
Order: stop routing, then billing (money stops before anything else is removed), then domains and mailboxes, then D1 rows, then the vector namespace.
| # | Step | Does |
|---|---|---|
| 1 | stop_routing | tenants.status = 'erasing', which only this job changes afterwards (a PATCH with status gets 409 tenant_erased, and non-platform keys can no longer write to the tenant) (inbound for every tenant address now gets 550 5.1.1; outbound consumers drop messages for the tenant); revoke every tenant and identity key; disable the tenant’s webhook endpoints (enabled = 0, disabled_reason = 'manual'); cancel the tenant’s other running jobs; CloseStreams { All, 4404 } on the tenant’s TenantEvents |
| 2 | cancel_billing | Skipped when PM_BILLING=off, or when the tenant has no billing_accounts.stripe_customer_id. Otherwise read the customer’s subscriptions (GET /v1/subscriptions?customer=…&expand[]=data.schedule, every status except canceled) and cancel each one, the plan subscription and every top-up subscription, at once (a subscription that carries a schedule, such as a downgrade waiting for the period end, has the schedule released first with POST /v1/subscription_schedules/{id}/release): immediate cancellation with invoice_now=true and prorate=false, so anything not yet invoiced is billed on a final invoice, with no proration credit and no refund (Billing › Stripe integration records why). The step is done when the read returns none, so a re-run after a partial failure cancels only what is left; a customer Stripe no longer knows counts as done. Failures retry under the job’s backoff (section 4). The third failed attempt fires billing_cancel_failed:{tenant_id} (page; Observability › Alert list), so the operator cancels in the Stripe Dashboard at once, while the step keeps retrying until deadline_at − 4 h like any erasure step (section 4). Webhooks for this tenant afterwards are answered 200 and recorded ignored_erased, except that a live subscription created after the deletion is cancelled (cancelled_after_erasure; Billing › Webhook endpoint) |
| 3 | remove_domains | For each tenant domain, run the domain_remove steps of Identities and domains › Domain removal inline (literal rules, catch-all, routing, sending onboarding, event subscription, the SES identity with DeleteEmailIdentity and its DKIM CNAMEs, including a failover identity, the domain’s addresses in pm-retired-{n} receipt rules, ownership record, zone); then DomainMonitor delete_all |
| 4 | erase_identities | For each identity: identity steps 2 and 3 (tombstone every address, including retired ones; erase the mailbox). An identity with held threads keeps them, with their R2 objects and vectors, and stays deleting (below) |
| 5 | delete_d1_rows | In this order, all WHERE tenant_id = ?1, each table in batches of at most 1,000 rows (section 6.12): webhook_deliveries, webhook_endpoints, event_index, suppressions, sender_lists (counted as list_entries_deleted), idempotency_records (scope = ?1 OR tenant_id = ?1: the tenant’s own records, and the records of platform and partner keys whose stored response belongs to the tenant, such as the POST /v1/tenants that created it), rpc_intents, usage_daily, identity_keys (after INSERT OR IGNORE INTO key_tombstones of every row’s id, as in identity scope), service_accounts, draft_index, notification_prefs, agent_signups, api_keys, identities (except rows still deleting with holds, which are scrubbed as in identity step 4 and kept), domains, exports, non-erasure jobs, invitations, sessions (active workspace = this tenant), members, billing_events, billing_accounts, dlq_items, audit_log rows whose action does not start with erasure. (or hold., while holds remain); then tenants set status = 'erased', name = '', policy_json = '{}' (the row, slug and suffix stay, so neither is reused; with holds, status stays erasing); TenantQuota delete_all and Notifier delete_all, so no pending notification survives, and EventsRequest::Erase on TenantEvents (counted, then delete_all() and meta.erased). Every person the members delete left with no workspace is then deleted as in section 6.9, which also removes their oauth_identities, login_tokens and waitlist row |
| 6 | sweep_vectors | Vectorize has no method to delete a namespace (Vectorize client API, read 2026-10-09: only deleteByIds). Query the tenant namespace with a fixed probe vector (topK = 100, returnMetadata: "none"), deleteByIds the IDs returned, wait 10 seconds, and repeat until two consecutive queries return nothing (at most 100 rounds per alarm slice; section 6.8). With holds: skipped, because the held vectors would answer every query; the vectors of everything not held were deleted by ID in step 4, and the continuation runs the sweep |
| 7 | sweep_r2 | List and delete every object under t/{tenant_id}/, in BLOBS and, when configured, BACKUP. With holds: only t/{tenant_id}/exports/ and the t/{tenant_id}/i/{idn}/ prefix of each identity wiped without holds; the other objects of a held identity were deleted by key in step 4, and the continuation sweeps the whole prefix |
| 8 | probe | Section 6.7, plus: t/{tenant_id}/ lists empty; a namespace query returns nothing; D1 counts for the tenant are zero except the kept rows (every table of step 5, agent_signups and draft_index among them). With holds, the prefix and namespace probes cover only what steps 6 and 7 swept, and held items are excluded as in every scope |
| 9 | receipt | Section 10. erasure.completed goes to platform endpoints and, for a tenant a partner’s key created, to that partner’s endpoints (the tenant’s own endpoints are disabled). With holds the status is completed_with_holds and the tenant stays erasing |
| 10 | finalise | — |
Suppressions are deleted in tenant erasure because the tenant can no longer send; I7 applies to counterparty erasure.
Holds in a tenant being erased (I2). A tenant erasure never deletes a held
thread, in any step, and the tenant is not erased while one remains:
- Each identity with a held thread keeps that thread’s messages, their R2 objects and their vectors, its
mailbox (holding only held threads) and its
identitiesrow, scrubbed as in identity step 4 and leftdeleting. Its addresses are tombstoned and its domains removed like any other, so nothing new arrives; its keys and identity keys are gone, so nothing is sent or signed. - Everything else of the tenant is erased by the same steps: billing, domains, the other identities,
every other D1 row, people left with no workspace, the
TenantQuota,NotifierandTenantEventsobjects. - The request ends
completed_with_holds, with each held thread inreceipt.held, and the tenant stayserasing, so every write from a non-platform key is still refused. Until it iserasedit counts toward its partner’smax_tenantsand blocks the partner’s deletion (J12, J18); its slug and suffix stay taken either way. - The held mail stays readable through the API with a platform key, and with the tenant’s partner key
when a partner created it (reads resolve on an
erasingtenant, Security § 5.2). The hold routes (POSTandDELETE …/hold) stay usable on these identities for platform and partner keys witherasure:manage, so a hold can be extended or released. The tenant’s own keys were revoked, and a self-serve workspace with no partner is reached by the platform operator only. - Once no hold remains (released, or
untilpassed), the global retention job’sheld_erasuresstep (section 5.3) creates the continuation request,hold_released:{era_id}. It runs all ten steps again: the steps already done find nothing left, the held threads are now erased,delete_d1_rowsdeletes the remainingidentitiesrows andhold.*audit rows, steps 6 and 7 sweep the namespace and the whole prefix, and the tenant becomeserased. A continuation can also be started at once with a new tenant-scope request (section 6.1). - Pylota, the first partner, releases its own holds before it erases a tenant, so its erasures end
completed; the rule above is what happens when it does not.
Phone numbers. A step phone_release runs right after stop_routing: cancel open phone requests (blocked
ones included), release every live number (the erasure request is the person’s decision, because it needs
tenants:erase), cancel porting orders that can be cancelled, deactivate 10DLC campaigns, delete the tenant’s
provider resources and connectors and its onboarding drafts, then the compliance data, except documents in their
KYC retention period, which are listed in the receipt (Phone numbers § 24).
Vault. Step stop_routing closes open vault uses; step delete_d1_rows deletes, in order,
vault_custody_slots, vault_keys (the crypto-shred), vault_uses, vault_grants, vault_item_versions,
vault_items, tenant-level vault_consumers, vault_audit and vault_audit_anchors except the
vault.revoke_all row the erasure writes; step sweep_r2 sweeps t/{tenant_id}/vault/.
6.7 Probes (F6)
| Probe | How | Receipt field |
|---|---|---|
| Keyword | For each affected identity, ProbeKeyword { target }: a search for the erased message IDs and, for counterparty scope, the address as a participant: filter (Search §6.7); it must return no hits | probe.keyword_hits (sum) |
| Semantic | getByIds over every vector ID deleted by the job (kept in the runner’s deleted_vectors table) and every vector ID an erased message could have ({msg}:0–{msg}:63, {msg}:a{k}:0–{msg}:a{k}:199), in batches (section 6.8), so a vector an index job wrote after the deletion is found (I10); count IDs still returned. Tenant scope adds the namespace query of step 6 | probe.semantic_hits |
| Event log | EventsRequest::Probe on the tenant’s TenantEvents: the rows still found for the erased message IDs (or the identity, outside held threads) must be 0 (Event feed § 11.3) | probe.log_hits |
| Objects | A prefix list of each erased message’s m/{msg}/ and out/{msg} keys and each erased draft’s drafts/{id}/ (a prefix list of the identity or tenant for those scopes); an object found is deleted and the probe repeated | not in the receipt; a non-zero result re-runs the deleting step |
A non-zero probe re-runs the step that should have deleted the item (counted as an attempt). The job completes only with all probes at zero, except held items.
For the vault: no vault_items, vault_item_versions, vault_keys or vault_custody_slots row of the scope
remains, and t/{tenant_id}/vault/ lists empty for a tenant scope.
6.8 Waiting for Vectorize
Vectorize mutations are asynchronous: deleteByIds returns a mutation ID and the change becomes visible
after a few seconds (Vectorize client API, read 2026-10-09). Deletes are sent in batches of 500, to both
indexes while a re-embed is running (Search §6.7). The semantic
probe calls getByIds on the deleted IDs every 10 seconds for up to 2 minutes, until none is returned.
If IDs remain after that, the probe step fails this attempt: the step that deleted them runs again
(re-sending deleteByIds for the remaining IDs) under the job’s backoff (section 4).
6.9 People (console accounts)
A person can delete their own account at /console/settings once they own no workspace; otherwise the
request gets 409 owner_required (W34,
Cloud sign-up §10). Tenant erasure runs the same
deletion for every person it leaves with no workspace (section 6.6, step 5).
- A person deleting their own account first leaves each workspace as in
Console › Members: the
membersrow and the person’snotification_prefsrows for that workspace are deleted, their pending notifications there are dropped (O19), the seat is released andmember.removedis emitted. - In one D1 batch: delete the person’s
sessions,pending_authrows, thelogin_tokensfor their address, theiroauth_identities, theirnotification_prefsrows in every workspace, and anywaitlistrow for their address; replace the keyed hash on the agent sign-ups they verified (UPDATE agent_signups SET human_hash = id WHERE verified_user_id = ?usr); and scrub the address of the invitations they accepted (UPDATE invitations SET email = ?usr_id WHERE status = 'accepted' AND email = ?address), whose rows stay with their workspaces as the record of who invited the member. - In the same batch, scrub the
usersrow rather than delete it, becauseinvitations.invited_byand audit rows refer to its ID:emailbecomes the row’s ownusr_ID;name,last_tenant_id,terms_version,terms_accepted_at,totp_sealed,totp_enabled_at,totp_last_stepandrecovery_codes_sealedare cleared;status = 'disabled'. The address is then free, and signing up again creates a new person. - Write an audit row
user.deletewithtenant_id = NULLand only theusr_ID indetails_json. - Start a counterparty erasure of the person’s former address on the default tenant, with
identity_idsset to the system identity alone (section 6.4, “Restricting the identities”), so the sign-in, invitation and notification mail sent to them is deleted now rather than at the 30-day cutoff, and mail in the default tenant’s other mailboxes is untouched. Its receipt is kept like any erasure record.
Invitations to the address that were not accepted stay with the workspaces that sent them: a pending one
expires after 7 days, and the global retention job deletes expired and revoked rows 30 days after
expires_at (section 5.3). Section 11 lists them.
6.10 Partners
A partner holds only its name, its status, its limits and its default billing mode; its customers’ data
lives in its tenants, which tenant erasure covers (section 6.6). A partner key with erasure:manage can
start that erasure for each of its own tenants (POST /v1/erasure-requests with scope: "tenant").
While the tenant is erasing and after it is erased, the partner key can still read
GET /v1/tenants/{tenant_id} (status, slug and partner_id; the name is '' once erased) and the
tenant’s erasure requests (GET /v1/erasure-requests?tenant_id=… and GET /v1/erasure-requests/{id},
with the receipt), so it can show its customer the outcome. Every write to that tenant from a
non-platform key gets 404 tenant_not_found (I8).
DELETE /v1/partners/{partner_id} (platform key, partners:manage) deletes a partner only when every
tenant with its partner_id is erased (J12); otherwise 409 partner_has_tenants
and nothing changes. It is a soft delete. In one D1 batch, guarded by that condition on every statement
(Data model › Notes), it:
- deletes the partner’s webhook endpoints (
webhook_endpoints.partner_id), and with them their delivery rows (ON DELETE CASCADE); - revokes and deletes its partner keys (
api_keys.partner_id), so their next request is401 unauthenticated; - deletes its
idempotency_records(scope= the partner ID); - sets the
partnersrow tostatus = 'deleted',name = ''anddeleted_at = now.
The row stays, so tenants.partner_id of its erased tenants keeps pointing at it and is never changed:
the provenance of an erased tenant (which partner created it) survives, and no NULL can appear where a
partner was. A deleted partner keeps only its ID, status, limits, billing mode and timestamps, none of
which is personal data. GET /v1/partners/{partner_id} shows it with status: "deleted"; PATCH, a
second DELETE and minting a key for it get 404 partner_not_found.
It writes the audit row partner.delete with tenant_id = NULL and only the ptn_ ID as its target.
The audit_log rows about the partner (partner.*, and key.create/key.revoke of its keys) keep only
IDs and stay like other audit rows of the deployment. Nothing else refers to the partner.
6.11 Exports and copies in flight (I11)
An export ZIP and a backup copy are copies of mail, so an erasure must reach them too.
-
Exports. Every erasure scope, in its
scrub_control_planestep, expires each export of the tenant that iscompletedand not yetexpired: it deletes the ZIP fromBLOBS(andBACKUP) and setsstatus = 'expired'. All of them, not only the ones that could hold the erased data: an export lives 7 days and can be made again, so the simple rule is also the safe one. The export’sexport.completedevent already went out; a laterGET /v1/exports/{export_id}showsexpired. -
An export running during an erasure.
initwaits, re-arming every 60 seconds without counting an attempt, while an erasure of the tenant isqueuedorrunning, then recordsmeta.collect_started_at. Thecompletestep (section 9.1) marks the export completed with one conditional statement, so no erasure can slip in between a check and the update:UPDATE exports SET status = 'completed', r2_key = ?2, size = ?3, expires_at = ?4 WHERE id = ?1 AND NOT EXISTS ( SELECT 1 FROM erasure_requests WHERE tenant_id = ?5 AND (status IN ('queued', 'running') OR completed_at > ?6));with
?6=meta.collect_started_at. An erasure created after this statement finds the exportcompletedand expires it (above). When the statement changes no row, an erasure ran, or is running, since collection started, and the ZIP may hold what it erased: the job deletes the ZIP, aborts nothing (the upload is complete) and restarts atinit, which waits for that erasure to end. A second such conflict fails the export (exports.status = 'failed',details.reason = "superseded_by_erasure"injobs.result_json), and the caller asks again. -
The backup copy. Section 5.4: after each
puttoBACKUPthe job checks thatBLOBSstill has the key, and deletes its copy when it does not.
6.12 Batched deletes in D1
D1 queues the requests to a database behind the ones it is running: a slow query delays every request
behind it, and a queue that grows too long fails with “D1 DB is overloaded” (Debug D1,
read 2026-10-10). A query may run for up to 30 seconds (D1 limits,
read 2026-10-10). A single DELETE … WHERE tenant_id = ?1 over a large tenant’s event_index or
webhook_deliveries could hold the database for that long, and every tenant’s email() directory
lookup would fail over to staging meanwhile. So every bulk delete in a job (retention step 4, tenant
step 5, the global steps) deletes at most 1,000 rows per statement:
DELETE FROM event_index WHERE rowid IN (
SELECT rowid FROM event_index WHERE tenant_id = ?1 LIMIT 1000);
repeated until a statement deletes nothing, with the step’s cursor recording the table it is on. Each
statement uses the index on tenant_id (or the cutoff column), so it touches only the rows it deletes.
The alarm slice limit (20 seconds or 1,000 items, section 4) bounds how many statements one slice runs.
7. Special cases
7.1 Counterparty erasure across identities
The JobRunner iterates every identity of the tenant with the same normalised address, so one request
covers every mailbox (FR-PRV-3). identities_affected lists the identities where anything was deleted
or held. Only counterparty_hash is stored in D1, so the erasure record does not itself retain the
address.
7.2 Suppressions after erasure (I7)
A suppression records an objection to contact (UK and EU GDPR Art. 21) or a delivery failure the sender
must respect. After counterparty erasure it keeps address_hash, address_hint (masked, for example
j***@example.com), reason, created_at and expires_at, and loses note and source_message_id.
Sends to the address are still refused because the send path hashes each recipient and looks it up.
The integrator can remove it with DELETE /v1/tenants/{tenant_id}/suppressions/{address}.
7.3 Allow and block lists
sender_lists entries, of the tenant scope and of the identity scope
(Parity additions §3), are the tenant’s own
configuration and are not changed by counterparty erasure: removing a block entry would re-open contact, and the
entry is not a message. The privacy guide tells integrators to remove entries for an erased counterparty with
the lists API when appropriate. Identity erasure deletes the identity’s entries and tenant erasure every entry,
both counted as list_entries_deleted (sections 6.5 and 6.6).
7.4 What agent assertions and signed requests disclose
An agent assertion is made to be read by its audience (Agent signing keys §4.2).
It discloses the identity’s ID (sub), its primary address (email), and under unverified its display
name (name), the workspace name (org) and whether the identity has an accountable human
(accountable_human, a boolean),
ai_agent: true, the issuer and the times, plus the nonce and ext the caller chose. It never holds
the accountable owner’s name or address (FR-IDN-2 data), and the service never inspects ext beyond
its size and claim-name rules: what goes there is the integrator’s choice and responsibility. The token
is never stored or logged; usage_daily keeps only a count (assertions).
A signed HTTP request discloses to the site the deployment’s origin (Signature-Agent) and the
identity’s primary address in the signed From header; nothing is stored but a count
(http_signatures). The JWKS and the key directory hold public keys only. The JWKS answers an
unknown, deleted, paused or suspended identity with the same 404 identity_not_found, and identity IDs
are ULIDs never derived from addresses, so it cannot be used to test whether an address exists.
After identity erasure, only key_tombstones remains: thumbprints with no link to the identity, its
tenant or any address. Copies of assertions and signed requests that third parties received are
outside the deployment’s reach (section 11).
7.5 Notifications
Notification emails go to people’s console sign-in addresses and never contain content from mail: no
subject, sender, snippet or attachment name. A new_mail email names the inbox address and counts
messages; only mail visible in the inbox is counted, never quarantined, hidden, spam, loopback or
test-tenant mail (Notifications §1, O15). The
Notifier object holds person, identity and message IDs and counts, never addresses or content.
Each notification is an ordinary transactional send from the system identity on the default tenant,
so its composed message (the person’s address, counts, inbox addresses, the workspace name and links)
is kept in the system identity’s mailbox for 30 days, and out/{msg}.eml for 7 days, whatever the default
tenant’s policy says (section 5.2). Deleting the person erases it at once (section 6.9, step 5).
7.6 Agent sign-up refusals
A person whom an agent named at sign-up can refuse it, and every later sign-up that names them
(Agent sign-up). agent_signup_refusals keeps only the keyed hash of their base address,
until they lift it at /console/settings (Allow again). Like a suppression (section 7.2), it records an
objection to contact, so neither person deletion nor any erasure scope deletes it; it holds no clear data.
8. Legal holds
POST /v1/identities/{identity_id}/threads/{thread_id}/hold { "reason", "until" }setsthreads.hold_json = { reason, until, set_by, set_at };DELETE …/holdclears it. Both neederasure:manageand writeaudit_logrows (hold.set,hold.removed).- A hold is active while
hold_jsonis set anduntilisnullor later than now. An expired hold is ignored and cleared by the next tenant retention run’sholdsstep (section 5.2), or, on a tenant being erased, by the globalheld_erasuresstep (audithold.expiredeither way). - A hold covers the whole thread, including messages that arrive after it was set, and the drafts whose
thread, source message or sent message is in it (Drafts §13.2). A held draft is
kept against its writer too: a patch of its content, labels or metadata answers
423 legal_hold, andDELETEcancels it (it is never sent) without clearing it (Drafts §4.4). Uploads belong to no thread and are never held (Uploads §9). - While active: retention skips the thread (raw and messages), and so does per-identity expiry (section 5.5); every erasure scope skips it and lists
{ thread_id, reason }inreceipt.held, and the request endscompleted_with_holds(FR-PRV-4, I2). Identity deletion behaves as in section 6.5; tenant erasure keeps the held threads, their objects and vectors, keeps the tenanterasingand finishes after the last hold ends (section 6.6, “Holds in a tenant being erased”). - On an
erasingtenant, the hold routes are the one write that partner keys may still make (platform keys too), so a hold can be extended or released; a new hold can only be set on a thread that still exists, which on such a tenant means a held one (Security § 5.2). - Holds do not hide messages: held threads stay readable and searchable within normal scope rules.
9. Subject-access export
POST /v1/exports with scope: "counterparty" and counterparty_address, or scope: "identity" and
identity_id (FR-PRV-5, I3). An export is a read of mail, so it needs
erasure:manage and messages:read and attachments:read, and it is refused to identity keys
(403 permission_denied): a key minted only for deletions cannot read the workspace through it, and an
agent asked by a message to “send us an export” holds an identity key (I14). Whether
the requesting key also holds quarantine:review is recorded in the job’s meta.include_held when the
export is created.
An identity export also writes sms.json and calls.json (the identity’s, or for counterparty scope the
counterparty’s across identities), and vault.json with vault items as metadata only (kind, title, origins,
health, dates, the ledger entry): no value and no ciphertext is ever exported.
9.1 Job steps
| # | Step | Does |
|---|---|---|
| 1 | init | Waits while an erasure of the tenant is queued or running, then records meta.collect_started_at (section 6.11); stores the target (clear address in JobRunner meta for counterparty scope); starts an R2 multipart upload at t/{ten}/exports/{exp}.zip and stores its upload ID in meta.upload_id |
| 2 | collect | For each identity, ExportBatch: for each message, read raw.eml (inbound) or out/{msg}.eml (outbound) from R2. If the raw object is past raw_days, rebuild the message with mail-builder from the stored fields and attachments (eml_source: "reconstructed"). Remove any Bcc: header (bcc_redacted: true). Append ZIP entries to the current part; upload a part when it reaches at least 5 MiB. The ZIP central-directory entries for each batch are stored in JobRunner meta under zip_cd:{n} |
| 3 | finish_zip | Writes messages.json, the central directory and the end record; completes the multipart upload and deletes meta.upload_id |
| 4 | complete | One conditional UPDATE exports (section 6.11) sets status = 'completed', r2_key, size and expires_at = created_at + 7 days, only while no erasure of the tenant is queued or running and none completed after meta.collect_started_at. When it changes no row, delete the ZIP and restart at init, at most once. Otherwise emit export.completed; audit export.completed |
| 5 | finalise | Deletes meta.target_address and zip_cd:*. Also runs when the export fails or is canceled (section 4): if meta.upload_id is still set, it aborts that multipart upload (R2MultipartUpload.abort()) so no uploaded part is left behind, and it deletes a completed ZIP of a canceled export |
R2 keeps the uploaded parts of an incomplete multipart upload until it is completed or aborted, and
aborts it after 7 days by default (Upload objects,
read 2026-10-10). idvy setup adds a lifecycle rule to BLOBS that aborts incomplete multipart uploads
after 1 day (wrangler r2 bucket lifecycle add … --abort-multipart-days 1), a backstop for an abort that
never ran (I13).
Held, quarantined, screening, hidden and throttled messages are included as .eml only when meta.include_held is
set, because reading them through the API needs quarantine:review too; otherwise each appears in
messages.json with its id, identity_id, status and dates and content_withheld: "quarantine_review_required", and no .eml (I14). With it, an export is a read of
everything the deployment holds about the subject in the workspace’s mailboxes. The system identity’s mailbox is never
read by an export, whichever tenant it is on (A15); a person’s system mail is covered
by person deletion (§6.9). The ZIP is written with a pure-Rust ZIP writer (for example the
zip crate with only a pure-Rust deflate backend), pinned at build time.
The event log (Event feed §11.6), uploads (Uploads §9) and event counts (Metrics §7) are not exported: the first holds copies of message data the export already holds, the second is a staging area whose sent bytes are in the exported messages’ attachments, and the third is not about a data subject.
9.2 ZIP layout
exp_01JA4….zip
├── messages.json
├── sms.json
├── calls.json
├── vault.json (identity scope only)
└── eml/
└── idn_01J9Z3K8V4…/
├── 20260914T081203Z_msg_01J9….eml
└── 20260915T093011Z_msg_01JA….eml
9.3 messages.json
{
"export_id": "exp_01JA4…",
"tenant_id": "ten_01J9…",
"scope": "counterparty",
"counterparty_hash": "5c1e…",
"generated_at": "2026-10-09T10:20:00Z",
"generator": "pylota-identity/1.0.0",
"identities": ["idn_01J9…", "idn_01JA…"],
"messages": [
{
"id": "msg_01J9…", "identity_id": "idn_01J9…", "thread_id": "thr_01J9…",
"direction": "inbound", "status": "received", "kind": "normal",
"from": { "address": "jo@example.net", "name": "Jo Rivera" },
"to": [ { "address": "bookings.acme@agents.example", "name": "" } ],
"cc": [], "bcc": [], "reply_to": [],
"subject": "Change of dates for BK-2291",
"sent_at": "2026-09-14T08:12:00Z", "received_at": "2026-09-14T08:12:03Z",
"labels": ["booking"], "flags": [],
"trust": { "verdict": "pass", "spf": "pass", "dkim": "pass", "dmarc": "pass", "arc": "none",
"known_sender": true, "quarantined": false },
"triage": { "category": "customer_request", "summary": "Asks to move pick-up to Friday.",
"needs_reply": 0.92, "urgency": 2, "risk_flags": [] },
"attachments": [ { "id": "att_01J9…", "filename": "licence.jpg", "content_type": "image/jpeg",
"size": 81234, "sha256": "9f2c…" } ],
"deliveries": null,
"calendar": null,
"screening": { "status": "clear", "mode": "hold", "reason": "model_clear", "signals": [],
"model": "@cf/openai/gpt-oss-20b", "started_at": "2026-09-14T08:12:03Z",
"deadline_at": "2026-09-14T08:14:03Z", "completed_at": "2026-09-14T08:12:05Z",
"late": false, "released_by": null },
"screening_feedback": [],
"eml_path": "eml/idn_01J9…/20260914T081203Z_msg_01J9….eml",
"eml_source": "original",
"bcc_redacted": false
}
]
}
deliveriesis set for outbound messages:[{ "address", "field", "status", "smtp_code", "updated_at" }].calendaris the message’s calendar object as the API returns it, without the internalpartieslist, ornull(Calendar invitations §10).screeningis the message’s screening record as the API returns it, ornull, andscreening_feedbacklists the feedback given on the message (verdict,notes,created_at): an assessment of a person’s mail is data about them (Screening hold §18).- In a counterparty export,
bcccontains the counterparty’s own address when present and nothing else; other Bcc recipients are never disclosed. - Messages contain other people’s data. The controller reviews the export before disclosing it.
9.4 Download link
GET /v1/exports/{export_id} returns download_url, minted on each read with the current link key in
the signed link format of Security › Signed links:
https://mail.example.com/v1/links/{token}
payload = "l1:{kid}:export:{tenant_id}:{export_id}:{nonce}:{expires_unix_s}"
expires = min(now + 1 hour, the export's expires_at)
nonce = 16 random bytes, Crockford base32
- The download needs no API key; the MAC authenticates it. A bad MAC, an expired link or an expired
export returns
404 export_not_found. - A link works once (I14). After the MAC, expiry and target checks pass, the
handler runs
INSERT INTO link_uses (nonce, expires_at) VALUES (?1, ?2) ON CONFLICT DO NOTHING; when it changes no row the link was already used, and the answer is404 export_not_foundlike any refused link. So a link that leaks after the download, or that an agent was talked into sending on, gives nothing. A broken download needs a new link (GET /v1/exports/{export_id}mints one); range requests are not served. The global retention job deleteslink_usesrows pastexpires_at. - A link is a bearer URL, so it lives one hour, and a new one is minted on every
GET; the export itself stays downloadable untilexpires_at(7 days).DELETE /v1/exports/{export_id}(erasure:manage, auditexport.delete) revokes every link at once: it deletes the ZIP of acompletedexport and setsexpired, or stops aqueuedorrunningone (canceled), and the link check’s “the target still exists” step then refuses every earlier link. - The response is the ZIP with
Content-Type: application/zip,Content-Disposition: attachment; filename="exp_….zip"and the attachment-serving headers of Security. GET /v1/links/{token}serves both export and large-attachment links (REST API).
10. Receipt
The receipt matches the erasure request object:
{
"messages_deleted": 14, "attachments_deleted": 9, "r2_objects_deleted": 38,
"fts_rows_deleted": 14, "refs_deleted": 51, "vectors_deleted": 63,
"events_deleted": 31, "log_events_deleted": 31, "drafts_deleted": 2, "uploads_deleted": 1,
"screenings_deleted": 3, "screening_feedback_deleted": 1, "list_entries_deleted": 0,
"identities_affected": ["idn_01J9…", "idn_01JA…"],
"held": [ { "thread_id": "thr_01JA…", "reason": "PCN dispute WM12345678" } ],
"probe": { "keyword_hits": 0, "semantic_hits": 0, "log_hits": 0 }
}
| Field | Counts |
|---|---|
messages_deleted | messages rows deleted (including by WipeAll, from CountAll) |
attachments_deleted | attachments rows deleted |
r2_objects_deleted | R2 objects whose delete succeeded or that were already absent at the planned key |
fts_rows_deleted | Rows deleted from fts (one per message) |
refs_deleted | refs rows deleted |
vectors_deleted | Vector IDs passed to deleteByIds (including the tenant namespace sweep) |
events_deleted | outbox rows deleted |
log_events_deleted | Rows deleted from the tenant’s event log |
drafts_deleted | drafts rows deleted (including by WipeAll, from CountAll) |
uploads_deleted | uploads rows deleted (including by WipeAll, from CountAll) |
screenings_deleted | screenings rows deleted (with their messages) |
screening_feedback_deleted | screening_feedback rows deleted (with their messages) |
list_entries_deleted | sender_lists rows deleted (identity and tenant scope) |
sms_deleted, sms_media_deleted, calls_deleted | SMS, media and call rows deleted |
phone_numbers_released | Numbers released; for platform and partner keys each with {provider_number_id, provider_order_id, e164, vapi_phone_number_id} |
phone_documents_deleted, phone_documents_retained | KYC documents shredded; documents kept in their retention period, each with retain_until |
phone_consent_entries_deleted, phone_onboarding_drafts_deleted | Consent entries and onboarding drafts deleted |
provider_deletions | Provider-side deletions attempted and failed |
vault_items_deleted, vault_versions_shredded, vault_uses_deleted, vault_audit_deleted | Vault rows deleted |
vault_keys_shredded | Tenant vault keys deleted (tenant scope) |
identities_affected | Identities where anything was deleted or held |
held | One entry per held thread skipped |
probe | Section 6.7: keyword_hits, semantic_hits and log_hits; null values only when the job failed before the probe step |
statusiscompleted,completed_with_holds(at least oneheldentry) orfailed.- A receipt is always produced (NFR-PRV-1): a failed job writes the counts reached so far, and
erasure.failedcarries the failed step and error code. - The receipt is stored in
erasure_requests.receipt_jsonandjobs.result_json, and sent inerasure.completed.
11. What remains after deletion
| Residual | Duration | Notes |
|---|---|---|
| D1 Time Travel | 30 days (Workers Paid) | A restore within that window brings erased D1 rows back (I6) |
| Durable Object point-in-time recovery | 30 days | Covers each SQLite-backed object’s whole database |
TenantEvents point-in-time recovery | 30 days | Never used: a damaged log is rebuilt from the owners’ outboxes (Event feed § 9.3) |
| R2 | None by default | R2 has no versioning, point-in-time recovery or replication, so a deleted object is gone. The optional backup bucket (section 5.4) is deleted from in the same steps as BLOBS, so it holds no erased data. A deployer who copies the bucket any other way must apply erasure to that copy too; it::erasure::i6_backup_purge asserts that no object remains under erased prefixes in BLOBS or BACKUP and that the Worker has no other R2 binding |
| Suppressions | Until expiry or removal | Hash and masked hint only (I7) |
| Agent sign-up refusals | Until the person lifts them | Keyed hash of a base address only (section 7.6) |
| Event counts per hour and day | Kept 192 hours and 92 days, after message and counterparty erasure | Numbers only (Metrics §7) |
| Unsent uploads | Until expires_at (at most 7 days) | Not exported; not in the backup bucket (Uploads §9) |
| Address tombstones | Permanent | Keyed hash only (A5) |
| Erasure records | Life of the deployment | Counterparty hash, reason, counts |
| Cloudflare Email Sending activity log | 30 days | Processor-side; outside the Worker’s reach |
| Cloudflare Email Routing activity log and analytics | 31 days | Processor-side: per received message the sender, recipient, subject and Message-ID (the emailRoutingAdaptive dataset keeps “the past 31 days”; Metrics and analytics, read 2026-10-10). Outside the Worker’s reach |
Cloudflare Email Sending suppressions at account scope, of the shared platform domain, and read_only policy entries | Complaints and some hard bounces never expire; others 7 days or 24 hours | Clear addresses. Account-scope entries can come from any sending domain of the account and cannot be attributed to one tenant, so counterparty erasure leaves them; Cloudflare-managed policy entries cannot be deleted through the API (Suppression lists, read 2026-10-10). The operator can delete an account-scope entry by hand (DELETE /accounts/{account_id}/email/sending/suppressions/{suppression_id}) when a data subject asks; doing so lets mail to the address be sent again where our own suppression has expired (I12) |
| Amazon SES account-level suppression list (SES transport) | Until removed | Clear addresses that hard-bounced or complained. Kept for the same reason; the operator can remove one with SES DeleteSuppressedDestination (I12) |
R2 inbound-staging/ objects | At most 15 days | Raw messages that were staged because the directory lookup failed, or that came through SES. Not keyed by tenant; a staged message for an erased address is refused (550 5.1.1) when it is routed and its object deleted |
tenants slug and address suffix of an erased tenant | Life of the deployment | Kept so that neither is reused; the basis is in section 3 (“Names kept after tenant erasure”) |
| Restore working files | Until idvy ops restore cleanup, which the runbook runs at its end | The D1 exports a restore writes on the operator’s machine (mode 0600) hold every D1 row, including addresses (Observability › Restore from PITR) |
| Email preview | About 7 days | Disabled by onboarding; residual only if re-enabled by hand |
| Amazon S3 inbound objects (SES domains) | Until ingested; never longer than 14 days | Deleted by the consumer once every recipient is done, or by the lifecycle rule; a message erased in that window can still sit in S3 until then |
| Amazon SQS notifications (SES domains) | Until the backstop cron handles them; at most 14 days | Envelope addresses and headers of received mail |
| SES itself (if used) | As configured in the deployer’s AWS account | Processor-side |
ses_ingest rows | 30 days | Object key and agent recipient address; not keyed by tenant, so tenant erasure leaves them to the global retention job |
Scrubbed users rows | Life of the deployment | The opaque usr_ ID only, kept because invitations and audit rows refer to it |
| Invitations to a deleted person’s address that were not accepted | Pending: until they expire (7 days). Expired or revoked: 30 days after expires_at | The clear address, role and inviting workspace. They belong to the workspaces that sent them; the global retention job deletes them (section 5.3). Accepted invitations keep only the person’s usr_ ID (section 6.9) |
| Stripe (Cloud billing) | As Stripe keeps its customer and invoice records | Processor-side. Tenant erasure’s cancel_billing step cancels the plan subscription and every top-up subscription at once, with no proration and no refund, right after routing stops and before anything else is removed (section 6.6); it does not delete the Stripe customer or its invoices, which Stripe keeps under its own retention |
billing_events rows of an erased tenant written after the erasure | 400 days | Stripe event IDs of the webhooks that follow the cancellation, recorded ignored_erased (or cancelled_after_erasure when a late subscription had to be cancelled); deleted by the global retention job (section 5.3) |
| Webhook receivers | The integrator’s systems | The integrator must apply erasure to copies it received |
| Verifiers of agent assertions and sites that received signed requests | The third party’s systems | They hold what the tokens and From headers disclosed (section 7.4): the identity’s address, display name and workspace name |
| Key tombstones | Permanent | Thumbprints of deleted identity keys only (O7) |
| Workers Logs | 7 days | Pseudonyms only |
| Telnyx message and call detail records | Telnyx’s own retention | Numbers, times, costs; content not kept when the messaging profile’s redaction is on. Processor-side |
| Telnyx KYC copies after the last number | Until deleted by the executor | A copy still linked by the provider is retried daily for 30 days, then reported |
Vapi call data of vapi routes | The tenant’s own Vapi account | Call content and transcripts |
| KYC documents in their retention period | Until retain_until | Held under the reason kyc_retention and listed in the receipt |
R2 phone-staging/ objects | At most 15 days | Raw provider events; not keyed by tenant |
| Vault rows restored by D1 Time Travel | Until the erasure re-application after the restore | In partner custody, restored rows cannot be opened once the partner has discarded its unlock keys |
| Vault sessions at the site | The site’s own session lifetime | Deleting a session item does not sign the session out at the site |
Restores and erasure (I6). A D1 or Durable Object restore can resurrect erased data. The restore runbook (Observability) therefore:
- exports the whole D1 database before restoring, while the deployment is frozen, and after the
restore re-applies every change made after the restore point
Tthat the restore is not meant to undo, deletions included (idvy ops restore d1), so erased D1 rows, suppressions, tombstones, member removals and key revocations made afterTcome back as they were; - re-applies, after a mailbox restore, every erasure request that completed after
T:POST /v1/platform/erasure-requests/{erasure_id}/reapplycreates a new request with reasonreapply_after_restore:{era_id}from the stored row alone. Message and thread scope use the storedidentity_idandtarget_id; identity and tenant scope the stored IDs; counterparty scope matches by the storedcounterparty_hash(CounterpartyHashtarget, section 4.1), because the address itself is kept nowhere. The D1 side of every erasure is already back (step 1), so a re-applied identity-scope request runs onlyerase_mailbox,probeandreceipt, and a re-applied tenant-scope request runserase_identities(the mailbox step only) over the source receipt’sidentities_affected, thensweep_vectors,sweep_r2,probeandreceipt; the tenant stayserased. Only a request that endedcompletedorcompleted_with_holdsis re-applied (409 erasure_not_completedotherwise: aqueuedorrunningone erases the restored data itself, and afailedone is resumed). Erasure requests and their receipts are never lost to a D1 restore, because step 1 re-inserts the rows written afterT.
12. Logs
Logs follow Security › Logging rules: no content, no clear addresses,
pseudonyms only, invocation_logs = false. Dead-letter records keep pointers in D1 for at most 14 days and
are never returned by GET /v1/platform/dlq (idvy dlq list): it shows the queue, kind, tenant and
times only. The I5 test greps the captured output of the whole integration run for
canaries.
13. Tests
| Test | Proves | Covers |
|---|---|---|
it::erasure::i1_counterparty | Counterparty erasure across two identities removes rows, attachments, extracted text, FTS (and fts_next while a tokenizer reindex runs), refs, vectors, raw and sent copies, outbox events and the contact; surviving threads lose the participant; the counterparty’s rate_windows rows, the tenant’s dlq_items naming the address and the idempotency_records whose body contains it are gone; receipt counts match the seeded data; probes are zero | I1, FR-PRV-3 |
it::erasure::i2_hold | Held threads survive retention and every erasure scope; the receipt lists them with reasons; status completed_with_holds; hold expiry releases them | I2, FR-PRV-4 |
it::erasure::i2_hold_tenant_scope | Tenant erasure of a workspace with one held thread: billing, domains, the other identities and every other D1 row are erased; the held thread’s messages, R2 objects (both buckets) and vectors survive, its identity stays deleting and the tenant stays erasing; the receipt is completed_with_holds; the partner key reads the held thread and releases the hold (DELETE …/hold), while every other partner-key write gets 404; the next held_erasures run creates hold_released:{era_id}, which erases the thread, sweeps the namespace and the prefix, and leaves the tenant erased | I2, section 6.6 |
it::erasure::f6_probe_empty | After erasure, keyword, semantic and object probes return nothing; a fake Vectorize that keeps one vector makes the job retry, then fail with erasure.failed | F6, FR-SRCH-11 |
it::privacy::system_mail_retention_and_person_delete | The system identity’s mailbox drops messages after 30 days and raw MIME after 7 even when the default tenant keeps mail forever; deleting a person erases the sign-in, invitation and notification mail sent to them at once, through a counterparty erasure whose identity_ids is the system identity alone: mail to or from the same address in the default tenant’s other identities is untouched, and the receipt’s identities_affected names only the system identity | FR-PRV-2, FR-PRV-3, section 6.4 |
it::calendar::erasure_and_holds | Counterparty erasure of an attendee or organizer address that appears only in an invitation’s calendar_json, also by CounterpartyHash after a restore; message, thread, identity and tenant erasure; a held thread keeps its calendar messages; receipt counts and probes | V51, section 6.4 |
it::calendar::export_and_logs | messages.json includes calendar without parties; captured logs contain none of the canary UID, summary or attendee addresses | V52, section 9.3 |
it::erasure::i6_backup_purge | With BACKUP bound, every erasure scope leaves no object under erased prefixes in either bucket; no R2 binding other than BLOBS and BACKUP | I6 |
it::erasure::i6_reapply_by_hash | After a simulated mailbox restore to before a counterparty, a message and an identity erasure, POST /v1/platform/erasure-requests/{id}/reapply erases the same data again from the stored rows alone: the counterparty one by counterparty_hash with no address supplied; the new requests carry reason reapply_after_restore:{era_id}; probes are zero | I6, section 11 |
it::erasure::i11_inflight_copies | An erasure expires the tenant’s completed exports (ZIP deleted, status expired); an export whose collection overlapped an erasure (completed after meta.collect_started_at, or still queued or running at complete) deletes its ZIP and restarts once, its init waiting until the erasure ends, and a second conflict fails it; an erasure created just after an export completed expires it; a backup copy written after an erasure deleted its key from both buckets is removed by the backup job’s own check (backup_objects_total{result=revoked}) | I11, sections 5.4, 6.11 |
it::erasure::i12_provider_suppressions | With the Cloudflare API fake holding an account entry, a sending_domain entry on the tenant’s domain, one on another tenant’s domain and a read_only entry for the erased address, counterparty erasure deletes only the tenant’s sending_domain entry; without PM_CF_API_TOKEN it skips and counts provider_suppressions_skipped; domain removal deletes every sending_domain entry of the domain | I12, sections 2, 6.4 |
it::jobs::i13_finalise_on_fail_and_cancel | A counterparty erasure failed past its deadline and one canceled by a tenant erasure both end with no target_address in the runner’s meta; a failed and a canceled export leave no open multipart upload (the R2 fake lists none) and no ZIP | I13, section 4 |
it::erasure::batched_deletes | Tenant erasure and the retention events step delete 5,000 event_index and webhook_deliveries rows of one tenant in statements of at most 1,000 rows each, resuming from the cursor after an injected failure | section 6.12 |
it::retention::global_job_steps | The global job runs its steps in order, resumes after a failed step without repeating a finished one, and writes one audit row per step with its counts; the idempotency, platform_events, jobs, usage, dlq, signing_keys and staging steps delete (or, for staging, re-queue) exactly the rows past their cutoff | section 5.3 |
it::retention::global_console_rows | The console step deletes login_tokens 24 hours past expiry, sessions 30 days after expiry or revocation, and invitations expired or revoked more than 30 days ago; pending and accepted invitations stay | section 5.3 |
it::retention::global_billing_events | The billing_events step deletes rows received more than 400 days ago, including those of an erased tenant | section 5.3 |
it::retention::global_ses_ingest | The ses_ingest step deletes done, dropped and lost rows 30 days after done_at, and never a queued or held row | section 5.3 |
it::retention::global_signup_rows | The signup step deletes oauth_states 24 hours past expiry and waitlist rows 30 days after their invitation; an uninvited row stays | section 5.3 |
it::retention::global_identity_keys | The identity_keys step marks retiring keys past verify_until retired and keeps the rows; the JWKS output is unchanged by the step | section 5.3 |
it::retention::backup_copy | The nightly backup job copies new t/ objects with their metadata, never deletes, and a retention purge removes the key from both buckets | section 5.4 |
it::erasure::i7_suppression_kept_hashed | After counterparty erasure the suppression keeps hash, hint and reason, loses note and source, and still blocks a send | I7 |
it::erasure::message_and_thread_scope | Message and thread scopes delete exactly their targets | FR-PRV-3 |
it::erasure::identity_scope | Addresses tombstoned (550 5.1.1 afterwards; on an SES domain, removed from pm-retired-{n} and dropped like unknown mail), keys revoked, identity keys deleted with their kids in key_tombstones, mailbox wiped and refusing requests, D1 row scrubbed, the tenant’s idempotency_records and dlq_items naming the identity deleted, identity.deleted emitted | FR-IDN-4, A13 |
it::assertions::erasure_tombstones_kid | Identity erasure deletes the identity’s keys; their kids are in key_tombstones and are never published again, and key generation refuses a tombstoned thumbprint | FR-IDN-9, O7 |
it::erasure::identity_with_hold_continues | An identity with a held thread ends completed_with_holds; removing the hold leads to a continuation request that completes the deletion | section 6.5 |
it::erasure::tenant_scope_order | Routing stops first (inbound rejected while mailboxes still exist), then the cancel_billing step runs before any domain or mailbox is removed, then domains, mailboxes, D1 rows and the vector sweep; the tenant ends erased; platform endpoints, and for a partner’s tenant the partner’s endpoints, receive erasure.completed | section 6.6 |
it::partners::j12_delete_with_tenants | A partner with a tenant that is not erased cannot be deleted (409 partner_has_tenants); after the tenant’s erasure, deleting the partner keeps the row with status: "deleted" and an empty name, revokes and deletes its keys, deletes its endpoints, their deliveries and its idempotency records, leaves partner_id unchanged on the erased tenant, and writes partner.delete; PATCH, a second DELETE and a key mint for it get 404 partner_not_found | section 6.10, J12 |
it::erasure::i8_erasing_tenant_frozen | While a tenant is erasing and after it is erased, every write from its partner key (identity create, send, domain add, key mint, webhook create, PATCH of the tenant) gets 404 tenant_not_found or the resource’s *_not_found, and the tenant’s own keys get 401 key_revoked; the partner key still reads the tenant and its erasure requests with the receipt; a second tenant-scope erasure returns 200 with the same era_ while the first is running, and 409 tenant_erased once erased; after the job is made to fail past its deadline (the tenant still erasing), a new tenant-scope request from the partner key returns 202 with a new era_ whose resumes_id is the failed one and whose deadline_at is copied, and its job starts at the failed step (earlier steps are not re-run) and leaves the tenant erased; a platform key’s PATCH with status gets 409 tenant_erased; the tenant’s idempotency records, those of the platform and partner keys whose response belongs to the tenant included, are gone after the job | sections 6.1, 6.6, 6.10, I8 |
it::erasure::tenant_cancels_billing | With the Stripe fake holding a plan subscription and two top-up subscriptions, tenant erasure cancels all three at once, with no proration, as its second step, right after routing stops and before any domain, mailbox or D1 row is removed; a failing Stripe call is retried with backoff and the third failure fires billing_cancel_failed; with PM_BILLING=off, or no Stripe customer, the step is skipped; a customer.subscription.deleted webhook after the erasure is answered 200 and recorded ignored_erased, while a live subscription created after the deletion is cancelled (cancelled_after_erasure, Billing › Tests) | section 6.6 |
it::erasure::tenant_console_rows | After tenant erasure no members, invitations, sessions, notification_prefs, identity_keys or billing rows remain for the tenant, every deleted kid is in key_tombstones, and the tenant’s Notifier holds nothing; a member of another workspace keeps their account; a person left with no workspace is scrubbed and loses oauth_identities, login_tokens and waitlist rows | section 6.6 |
it::erasure::tenant_ses_rows | With the SES fake, tenant erasure of a workspace with an SES domain (dns_records or send_only) removes every address of that domain from the pm-retired-{n} receipt rules, so later mail to them is dropped like unknown mail, and leaves no SES identity for the domain | section 6.6 |
it::erasure::person_scope | Account deletion is refused while the person owns a workspace; otherwise it ends each membership, deletes sessions, tokens, oauth_identities, every notification_prefs row and the waitlist row, scrubs the address of the invitations they accepted, and scrubs the users row | section 6.9, W34 |
it::notify::member_removed_drops_pending | Removing a member deletes their notification preferences in that workspace and drops their pending items | O19 |
core::notify::no_content_in_body, it::notify::invisible_mail_never_notifies | A rendered notification holds no subject, sender, snippet or attachment name from the source message; mail that is not visible in the inbox is never counted | section 7.5, O15 |
it::erasure::resume_failed_any_scope | For message, thread, counterparty and identity scope, a request made to fail at the end of its retry window is resumed by a new request with the same scope and target: 202, resumes_id = the failed request, deadline_at copied; the message resumption is accepted although the message rows are already gone; the identity resumption after WipeAll probes the vector IDs the failed job deleted (copied by Snapshot) and finds none; the resumed job keeps retrying for 4 hours although deadline_at − 4 h has passed; two concurrent resumptions create one request (the second gets 200 with it); erasure_failed resolves once the resumption exists; erasure_stalled stays firing between the step’s hourly attempts and resolves when the step succeeds | sections 4, 6.1 |
it::erasure::step_retry_and_fail | Injected R2 and Vectorize faults retry with backoff and resume from the cursor without double counting; the third consecutive failure fires erasure_stalled; the job keeps retrying hourly past 10 attempts and becomes failed, with a partial receipt and erasure.failed, only on the first failed attempt after deadline_at − 4 h; a non-erasure job fails after 10 attempts and fires job_failed:{kind} | NFR-PRV-1 |
it::identities::a5_tombstone_blocks_reuse | A deleted address cannot be assigned to any identity in any tenant | A5 |
it::export::i14_export_permissions | A tenant key with only erasure:manage gets 403 permission_denied (details.required names messages:read and attachments:read); an identity key holding all three gets 403 permission_denied; a tenant key with the three exports a counterparty whose quarantined message appears in messages.json with content_withheld: "quarantine_review_required" and no .eml, and with quarantine:review too the .eml is included; the first download through a link succeeds and a second request with the same link gets 404 export_not_found; a new GET mints a link that works; link_uses rows past expires_at are deleted by the retention job (I14) | FR-PRV-5 |
it::export::i3_counterparty | ZIP layout, one .eml per message, messages.json schema, reconstructed messages after raw_days, Bcc redaction; a signed link that fails when tampered, after its hour, or after the export’s 7 days; each GET mints a new link; DELETE /v1/exports/{export_id} makes every earlier link answer 404 export_not_found at once | I3, FR-PRV-5 |
it::retention::i4_raw | Raw MIME older than raw_days deleted, 410 raw_expired afterwards, audit row written | I4, FR-PRV-2 |
it::retention::i4_messages | With message_days set, messages, attachments, index rows and vectors are purged, except held threads | I4 |
it::retention::i4_events | Outbox, event_index and webhook_deliveries older than events_days purged; with events_days = 10, replay reaches back 10 days, and with events_days = 90, still only 30 | I4, section 5.2 |
it::logs::i5_no_content_in_logs | No content or clear address in captured output, including the dead-letter consumer’s log lines | I5, FR-PRV-6 |
it::domains::preview_disabled | Onboarding a sending domain sets preview_enabled: false (Cloudflare API fake) | section 3 |
core::jobs::receipt_builder | Receipt counts and status derived from step counts; held forces completed_with_holds | section 10 |
core::jobs::backoff_schedule | Step backoff 30 s doubling to a 1-hour cap; a non-erasure job fails after 10 attempts; an erasure job fails only on the first failed attempt after deadline_at − 4 h; erasure_stalled on the third consecutive failure | section 4 |