Change the Retention Period for a Data Extension

The data extension retention date determines when data extensions are deleted. To make room for more data, you can change the retention date. For example, if you currently keep your data for 30 days, you can change the retention period to seven days to clear the data more quickly. Call the data extension by Name or ObjectID.

You can update the data extension retention period that is specified in these properties:

  • DataRetentionPeriodLength
  • ResetRetentionPeriodOnImport
  • DeleteAtEndofRetentionPeriod
  • RetainUntil
  • DataRetentionPeriod You can’t update RowBasedRetention.

Sample SOAP Request to Set Length of Data Retention Period 

1<?xml version="1.0" encoding="UTF-8"?>
2    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3        <SOAP-ENV:Header>
4            <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
5                <wsu:Timestamp>
6                    <wsu:Created>2011-04-02T05:47:36Z</wsu:Created>
7                    <wsu:Expires>2011-04-02T05:52:36Z</wsu:Expires>
8                </wsu:Timestamp>
9                <wsse:UsernameToken>
10                    <wsse:Username>XXX</wsse:Username>
11                    <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">XXX</wsse:Password>
12                    <wsse:Nonce>0orzEsVptrJo8uRGLWq58zslssM=</wsse:Nonce>
13                    <wsu:Created>2011-04-02T05:47:36Z</wsu:Created>
14                </wsse:UsernameToken>
15            </wsse:Security>
16        </SOAP-ENV:Header>
17        <SOAP-ENV:Body>
18            <UpdateRequest xmlns="http://exacttarget.com/wsdl/partnerAPI">
19                <Options/>
20                    <ns1:Objects xmlns:ns1="http://exacttarget.com/wsdl/partnerAPI" xsi:type="ns1:DataExtension">
21                        <ns1:ModifiedDate xsi:nil="true"/>
22                        <ns1:Name>Name of Data Extension</ns1:Name>
23                        <ns1:DataRetentionPeriodLength>7</ns1:DataRetentionPeriodLength>
24                        <ns1:DataRetentionPeriod>Months</ns1:DataRetentionPeriod>
25                        <ns1:ResetRetentionPeriodOnImport>true</ns1:ResetRetentionPeriodOnImport>
26                        <ns1:DeleteAtEndOfRetentionPeriod>true</ns1:DeleteAtEndOfRetentionPeriod>
27                    </ns1:Objects>
28            </UpdateRequest>
29        </SOAP-ENV:Body>
30    </SOAP-ENV:Envelope>

Sample SOAP Response to Set Length of Data Retention Period 

1<?xml version="1.0" encoding="UTF-8"?>
2    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3        <soap:Header>
4            <wsa:Action>UpdateResponse</wsa:Action>
5            <wsa:MessageID>urn:uuid:d4550cf8-9c0a-4292-8790-1a02b846af76</wsa:MessageID>
6            <wsa:RelatesTo>urn:uuid:f84b65b9-c21c-4240-91f6-fc1ba0076a37</wsa:RelatesTo>
7            <wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
8            <wsse:Security>
9                <wsu:Timestamp wsu:Id="Timestamp-3c4bca15-8e9d-428a-a1fe-51ae413f1a5e">
10                    <wsu:Created>2011-04-02T05:47:36Z</wsu:Created>
11                    <wsu:Expires>2011-04-02T05:52:36Z</wsu:Expires>
12                </wsu:Timestamp>
13            </wsse:Security>
14        </soap:Header>
15        <soap:Body>
16            <UpdateResponse xmlns="http://exacttarget.com/wsdl/partnerAPI">
17                <Results>
18                    <StatusCode>OK</StatusCode>
19                    <StatusMessage>Data Extension updated.</StatusMessage>
20                    <OrdinalID>0</OrdinalID>
21                    <Object xsi:type="DataExtension">
22                        <ns1:ModifiedDate xsi:nil="true"/>
23                        <ns1:ObjectID>146ea26b-eb5c-e011-8559-001e0bbae8cc</ns1:ObjectID>
24                        <ns1:Name>Name of Data Extension</ns1:Name>
25                        <ns1:DataRetentionPeriodLength>7</ns1:DataRetentionPeriodLength>
26                        <ns1:DataRetentionPeriod>Months</ns1:DataRetentionPeriod>
27                        <ns1:ResetRetentionPeriodOnImport>true</ns1:ResetRetentionPeriodOnImport>
28                        <ns1:DeleteAtEndOfRetentionPeriod>true</ns1:DeleteAtEndOfRetentionPeriod>
29                    </Object>
30                </Results>
31                <RequestID>0c9937b3-1f61-4656-8c9a-91e20644f370</RequestID>
32                <OverallStatus>OK</OverallStatus>
33            </UpdateResponse>
34        </soap:Body>
35    </soap:Envelope>

Sample SOAP Request to Set End of Data Retention Period 

1<?xml version="1.0" encoding="UTF-8"?>
2    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3        <soap:Header>
4            <wsa:Action>UpdateResponse</wsa:Action>
5            <wsa:MessageID>urn:uuid:d4550cf8-9c0a-4292-8790-1a02b846af76</wsa:MessageID>
6            <wsa:RelatesTo>urn:uuid:f84b65b9-c21c-4240-91f6-fc1ba0076a37</wsa:RelatesTo>
7            <wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
8            <wsse:Security>
9                <wsu:Timestamp wsu:Id="Timestamp-3c4bca15-8e9d-428a-a1fe-51ae413f1a5e">
10                    <wsu:Created>2011-04-02T05:47:36Z</wsu:Created>
11                    <wsu:Expires>2011-04-02T05:52:36Z</wsu:Expires>
12                </wsu:Timestamp>
13            </wsse:Security>
14        </soap:Header>
15        <soap:Body>
16            <UpdateResponse xmlns="http://exacttarget.com/wsdl/partnerAPI">
17                <Results>
18                    <StatusCode>OK</StatusCode>
19                    <StatusMessage>Data Extension updated.</StatusMessage>
20                    <OrdinalID>0</OrdinalID>
21                    <Object xsi:type="DataExtension">
22                        <ns1:ModifiedDate xsi:nil="true"/>
23                        <ns1:ObjectID>146ea26b-eb5c-e011-8559-001e0bbae8cc</ns1:ObjectID>
24                        <ns1:Name>Name of Data Extension</ns1:Name>
25                        <ns1:DataRetentionPeriodLength>7</ns1:DataRetentionPeriodLength>
26                        <ns1:DataRetentionPeriod>Months</ns1:DataRetentionPeriod>
27                        <ns1:ResetRetentionPeriodOnImport>true</ns1:ResetRetentionPeriodOnImport>
28                        <ns1:DeleteAtEndOfRetentionPeriod>true</ns1:DeleteAtEndOfRetentionPeriod>
29                    </Object>
30                </Results>
31                <RequestID>0c9937b3-1f61-4656-8c9a-91e20644f370</RequestID>
32                <OverallStatus>OK</OverallStatus>
33            </UpdateResponse>
34        </soap:Body>
35    </soap:Envelope>

Sample SOAP Response to Set End of Data Retention Period 

1<?xml version="1.0" encoding="UTF-8"?>
2    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3        <soap:Header>
4            <wsa:Action>UpdateResponse</wsa:Action>
5            <wsa:MessageID>urn:uuid:f61440a2-d9c0-4bea-8926-10b0ae7eae31</wsa:MessageID>
6            <wsa:RelatesTo>urn:uuid:a1fac280-09f5-40fb-a069-e2ef627fcde8</wsa:RelatesTo>
7            <wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
8            <wsse:Security>
9                <wsu:Timestamp wsu:Id="Timestamp-f90df106-30d0-46ab-a652-2f651b9d6e7b">
10                    <wsu:Created>2011-04-02T05:42:36Z</wsu:Created>
11                    <wsu:Expires>2011-04-02T05:47:36Z</wsu:Expires>
12                </wsu:Timestamp>
13            </wsse:Security>
14        </soap:Header>
15        <soap:Body>
16            <UpdateResponse xmlns="http://exacttarget.com/wsdl/partnerAPI">
17                <Results>
18                    <StatusCode>OK</StatusCode>
19                    <StatusMessage>Data Extension updated.</StatusMessage>
20                    <OrdinalID>0</OrdinalID>
21                    <Object xsi:type="DataExtension">
22                        <ModifiedDate xsi:nil="true"/>
23                        <ObjectID>146ea26b-eb5c-e011-8559-001e0bbae8cc</ObjectID>
24                        <Name>Name of Data Extension</Name>
25                        <DeleteAtEndOfRetentionPeriod>true</DeleteAtEndOfRetentionPeriod>
26                        <RetainUntil>2/5/2012</RetainUntil>
27                    </Object>
28                </Results>
29                <RequestID>c494ca5e-b93e-4e69-8bb0-4903fcffc631</RequestID>
30                <OverallStatus>OK</OverallStatus>
31            </UpdateResponse>
32        </soap:Body>
33    </soap:Envelope>