Skip to main content

Payload Retention

Svix retains all message payloads (content) for a period of 90 days, after which they are deleted. This ensures that potentially sensitive and private information is not held indefinitely.

Modifying the retention period

While 90 days is a good default for most use-cases, in some cases, a shorter retention period is preferred. Since different messages may require different retention periods, Svix lets you control the wanted retention on a message by message basis.

To change the retention period just pass the wanted retention period when creating the message by setting the payload_retention_period parameter to the wanted number of days.

Here are a few examples for setting the retention to 14 days:

const svix = new Svix("AUTH_TOKEN");
await svix.message.create("app_Xzx8bQeOB1D1XEYmAJaRGoj0", {
eventType: "invoice.paid",
eventId: "evt_Wqb1k73rXprtTm7Qdlr38G",
payloadRetentionPeriod: 14,
payload: {
id: "invoice_WF7WtCLFFtd8ubcTgboSFNql",
status: "paid",
attempt: 2,
},
});

Delete payloads on successful delivery

As part of the enhanced compliance controls available in the Enterprise tier, Svix supports deleting payloads automatically upon successful delivery or the expiry of the retention period. Whichever comes first.

This is useful for when you want to have the lowest retention required due to compliance reasons; as it ensures that the payload is deleted the moment it's no longer required and no longer than the defined retention period.

While it may be useful in some scenarios, we recommend not using this setting unless you absolutely have to. The reason is that having the payload retained even after successful delivery is often useful for debugging and recovering from errors. While the payload is only deleted on successful delivery, we have seen scenarios where the receiver reported a success, but they actually failed to process the event and wanted to redrive it. If the payload is deleted, they won't be able to do that.

This is a per-environment setting which can be enabled from the environment settings page on the dashboard.