Sign in to fill these examples with your own keys. Sign in Start free trial

How do I export my suppression list?

Page through the Suppressions API and write every address to a CSV file.

Newsletter tools such as Sendy, listmonk, and Mautic keep their own subscriber status. When they send through PostShiba over SMTP, bounces go to PostShiba, not to the tool. PostShiba suppresses hard bounces and spam reports and refuses later sends to those addresses with 550 suppressed, but the tool still lists them as active. Export the suppression list and import it into the tool's blocklist to keep your lists clean.

Before you start

  • A Support API key and your Team id, both on API keys. A Support key can read suppressions and cannot send. See API keys.
  • curl and jq.

Export every address

The script pages through the Suppressions API 1,000 rows at a time, using the last row's id as after.

export-suppressions.sh
1export POSTSHIBA_API_KEY="YOUR_API_KEY" 2export TEAM_ID="KjkAJW" 3 4after="" 5: > postshiba-suppressions.csv 6while true; do 7 page=$(curl -sS --get \ 8 --url "https://app.postshiba.com/api/v1/teams/$TEAM_ID/suppressions" \ 9 --header "Authorization: Bearer $POSTSHIBA_API_KEY" \ 10 --data-urlencode "limit=1000" \ 11 ${after:+--data-urlencode "after=$after"}) 12 echo "$page" | jq -r '.[].email' >> postshiba-suppressions.csv 13 [ "$(echo "$page" | jq length)" -lt 1000 ] && break 14 after=$(echo "$page" | jq -r '.[-1].id') 15done 16wc -l postshiba-suppressions.csv

The file has one address per line and no header row.

Export by reason

Each row has a reason: bounce, spamreport, unsubscribe, or manual. To export only hard bounces and spam reports, change the jq filter.

filter-reasons.sh
1echo "$page" | jq -r '.[] | select(.reason == "bounce" or .reason == "spamreport") | .email' >> postshiba-suppressions.csv

Run the export again after each large campaign. Importing an address the tool already blocks does no harm.

Next steps