Data retention
The per-environment retention window and data-export switch. Scoped to the API key’s environment; sandbox and production behave identically.
Read the policy
Requires the data_retention:read scope. An environment with no policy row returns the platform default (retention_days 90, data_export_enabled true) with updated_at set to null — never a 404.
Response
| Field | Type | Notes |
|---|---|---|
objectrequired | "data_retention_policy" | |
retention_daysrequired | integer | range -9007199254740991..9007199254740991 |
data_export_enabledrequired | boolean | |
updated_atrequired | string<ISO-8601> | null |
Update the policy
Requires the data_retention:write scope. Send at least one of retention_days (bounded 7–365, default 90) or data_export_enabled (default true); an empty or out-of-range body is rejected with 400 invalid_retention_policy_request. The environment and project come from the API key, never the body. Send an Idempotency-Key: a retry with the same key replays the stored response and writes no second audit row.
Request body
| Field | Type | Notes |
|---|---|---|
retention_days | integer | range 7..365 |
data_export_enabled | boolean |
Response
| Field | Type | Notes |
|---|---|---|
objectrequired | "data_retention_policy" | |
retention_daysrequired | integer | range -9007199254740991..9007199254740991 |
data_export_enabledrequired | boolean | |
updated_atrequired | string<ISO-8601> | null |
The export switch
When data_export_enabled is false, the contact data export (POST /v1/contacts/{contact_id}/export) is blocked with 403 data_export_disabled. That check runs before the contact is looked up, so a blocked export never reveals whether a contact exists. Patch data_export_enabled back to true to re-enable it.