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:
- JavaScript
- Python
- Rust
- Go
- Java
- Kotlin
- Ruby
- C#
- PHP
- CLI
- cURL
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,
},
});
svix = Svix("AUTH_TOKEN")
svix.message.create(
"app_Xzx8bQeOB1D1XEYmAJaRGoj0",
MessageIn(
event_type="invoice.paid",
event_id="evt_Wqb1k73rXprtTm7Qdlr38G",
payload_retention_period=14,
payload={
"id": "invoice_WF7WtCLFFtd8ubcTgboSFNql",
"status": "paid",
"attempt": 2
}
)
)
svixClient := svix.New("AUTH_TOKEN", nil)
svixClient.Message.Create(ctx, "app_Xzx8bQeOB1D1XEYmAJaRGoj0", &svix.MessageIn{
EventType: "invoice.paid",
EventId: svix.NullableString("evt_Wqb1k73rXprtTm7Qdlr38G"),
PayloadRetentionPeriod: 14,
Payload: map[string]interface{}{
"id": "invoice_WF7WtCLFFtd8ubcTgboSFNql",
"status": "paid",
"attempt": 2,
},
})
let svix = Svix::new("AUTH_TOKEN".to_string(), None);
svix.message()
.create(
"app_Xzx8bQeOB1D1XEYmAJaRGoj0".to_string(),
MessageIn {
event_type: "invoice.paid".to_string(),
event_id: Some("evt_Wqb1k73rXprtTm7Qdlr38G".to_string()),
payload: json!({
"id": "invoice_WF7WtCLFFtd8ubcTgboSFNql",
"status": "paid",
"attempt": 2
}),
..MessageIn::default()
},
None,
)
.await?;
Svix svix = new Svix("AUTH_TOKEN");
svix.getMessage().create("app_Xzx8bQeOB1D1XEYmAJaRGoj0",
new MessageIn()
.eventType("invoice.paid")
.eventId("evt_Wqb1k73rXprtTm7Qdlr38G")
.payloadRetentionPeriod(14)
.payload("{" +
"\"id\": \"invoice_WF7WtCLFFtd8ubcTgboSFNql\"," +
"\"status\": \"paid\"," +
"\"attempt\": 2" +
"}"));
val svix = Svix("AUTH_TOKEN")
svix.message.create("app_Xzx8bQeOB1D1XEYmAJaRGoj0",
MessageIn(
eventType = "invoice.paid",
eventId = "evt_Wqb1k73rXprtTm7Qdlr38G")),
payloadRetentionPeriod = 14,
payload = mapOf<String, Any>(
"id" to "invoice_WF7WtCLFFtd8ubcTgboSFNql",
"status" to "paid",
"attempt" to 2
)
svix = Svix::Client.new("AUTH_TOKEN")
svix.message.create("app_Xzx8bQeOB1D1XEYmAJaRGoj0",
Svix::MessageIn.new({
"event_type" => "invoice.paid",
"event_id" => "evt_Wqb1k73rXprtTm7Qdlr38G"})),
"payload" => {
"id" => "invoice_WF7WtCLFFtd8ubcTgboSFNql",
"status" => "paid",
"attempt" => 2
},
"payload_retention_period" => 14
})
)
var svix = new SvixClient("AUTH_TOKEN", new SvixOptions("https://api.us.svix.com"));
await svix.Message.CreateAsync("app_Xzx8bQeOB1D1XEYmAJaRGoj0", new MessageIn(
eventType: "invoice.paid",
eventId: "evt_Wqb1k73rXprtTm7Qdlr38G",
payloadRetentionPeriod: 14,
payload: new {
id: "invoice_WF7WtCLFFtd8ubcTgboSFNql",
status: "paid",
attempt: 2,
},
));
export SVIX_AUTH_TOKEN="AUTH_TOKEN"
svix message create app_Xzx8bQeOB1D1XEYmAJaRGoj0 '{ "eventType": "invoice.paid", "eventId": "evt_Wqb1k73rXprtTm7Qdlr38G", "payloadRetentionPeriod": 14, "payload": { "id": "invoice_WF7WtCLFFtd8ubcTgboSFNql", "status": "paid", "attempt": 2 } }'
$svix = new Svix('AUTH_TOKEN');
$svix->message->create(
'app_Xzx8bQeOB1D1XEYmAJaRGoj0',
MessageIn::create(
eventType: 'invoice.paid',
payload: [
'id' => 'invoice_WF7WtCLFFtd8ubcTgboSFNql',
'status' => 'paid',
'attempt' => 2
]
)->withPayloadRetentionPeriod(14)->withEventId('evt_Wqb1k73rXprtTm7Qdlr38G')
);
curl -X POST "https://api.us.svix.com/api/v1/app/app_Xzx8bQeOB1D1XEYmAJaRGoj0/msg/" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer AUTH_TOKEN" \
-d '{"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.