Prepare a list for download
const url = 'https://api.optizmo.com/optout-list/prepare-download';const options = { method: 'POST', headers: {api_key: '<api_key>', 'Content-Type': 'application/json'}, body: '{"optoutListId":"901fad4c46a1e723","columns":["plain"],"collectionType":["collected"],"dateRange":{"from":"2021-07-30","to":"2021-12-13"},"domainFilter":"gmail.com, co.uk"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.optizmo.com/optout-list/prepare-download \ --header 'Content-Type: application/json' \ --header 'api_key: <api_key>' \ --data '{ "optoutListId": "901fad4c46a1e723", "columns": [ "plain" ], "collectionType": [ "collected" ], "dateRange": { "from": "2021-07-30", "to": "2021-12-13" }, "domainFilter": "gmail.com, co.uk" }'Starts preparing a list for download and immediately returns a link to where the download will be available.
NOTE The download link will return a 404 NOT FOUND response until the file is ready. The time it takes to
prepare the download is not constant and may take up to 10 minutes for it to be available. Continue to poll the
download link until it returns the file.
Authorizations
Section titled “Authorizations ”Request Body
Section titled “Request Body ”Details of what should be included in the list download file.
object
The Opt-Out list id, which can be found on the Opt-Out list page under Opt-Out List Details
Example
901fad4c46a1e723Specifies which columns should appear in the exported file
plain- The plain text email or sms opt-out. If this is an MD5 Only list, make sure to also specifyhashedotherwise your list may be full of blanks.hashed- An MD5 or SHA512 hash of the plain text email or sms opt-out.timestamp- When the opt-out was received into the system.campaign- Columns for Campaign, Affiliate & Sub-Affiliate names will be added to the output file. Note that this only applies to opt-outs collected through Optizmo, not opt-outs that have been imported.ip- The ip address that submitted an opt-out via an unsubscribe link.
Specifies which optouts should appear in the download based on how they were collected
collected- Optouts that were received via unsubscribe linksimported- Optouts that were imported into the system via transfers or file uploads
Excludes opt-outs that were received outside of the specified date parameters.
object
Includes optouts collected + imported on or after this date in format yyyy-MM-dd
Example
2021-07-30Includes optouts collected + imported on or before this date in format yyyy-MM-dd
Example
2021-12-13Only include optouts from matching domain names. Enter the last part (root domain) of the domain name(s) you want to restrict optouts to, with multiple domains separated by commas.
Example
gmail.com, co.ukResponses
Section titled “ Responses ”Request to prepare the download has been accepted and is currently underway.
object
A url that the download will be available at once prepared. This will return a 404 NOT FOUND response
until the file has been produced. Continue to poll this endpoint until the file is available.
Note that processing times depend on list size and will take between a few seconds to several minutes to become available.
Example
{ "downloadUrl": "https://temp-storage.optizmo.com/downloads/suppression_list--abc-20210101.zip\""}Invalid request payload sent.
Authorization not sent or failed.