Prepare a list for download
const url = 'https://api.optizmo.com/optout-list/prepare-download';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', '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","metadataFilter":"order-88421"}'};
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 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "optoutListId": "901fad4c46a1e723", "columns": [ "plain" ], "collectionType": [ "collected" ], "dateRange": { "from": "2021-07-30", "to": "2021-12-13" }, "domainFilter": "gmail.com, co.uk", "metadataFilter": "order-88421" }'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.metadata- The external reference (extRef) captured from the opt-out link’s query string at collection time, returned exactly as captured. Note that this is empty for imported opt-outs, for opt-outs collected before this column was introduced, and wherever no usable reference was captured.
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.ukOnly include optouts whose captured external reference (see the metadata column) exactly matches this value.
- This is a single value, not a list. A comma is matched as a literal character rather than treated as a separator.
- Matching is case-sensitive and exact - no wildcards, no partial matches, and no trimming of leading or trailing whitespace.
- Requesting the
metadatacolumn is not required in order to filter by it. As withdomainFilter, the filter narrows the rows returned whether or not the value itself appears as a column in the file. - The
maxLengthabove is counted in characters, and the value is additionally bounded at 64 bytes of UTF-8 to match the cap applied to captured values at collection time. A value within 64 characters but over 64 bytes - roughly 22 or more CJK characters, or 33 or more accented Latin ones - is rejected with a400 BAD REQUESTrather than accepted and then matched against nothing.
Example
order-88421Responses
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. This includes an empty columns array - at least one column must be
requested.
Authorization not sent or failed.
